semvec/pypi-packages huggingface dataset:
django-before 1.0.0
Tools that are needed BEFORE any others in each django project
License: MIT
Keywords: django settings.py

django-before, before django project
====================================

django-before - tools that are needed BEFORE any others in each django project.

subpather
---------
make_subpather - tool to calculate relative paths from root directory.

.. code-block:: python

    # at the beginning of settings.py
    from django_before import make_subpather

    # e.g. I have project structure where this file is here: project_root/src/django_project/settings/base.py
    # so root of my project is 4 levels higher:
    subroot = make_subpather(__file__, 4)

    # know I can handy get paths relative to root of the project:
    MEDIA_ROOT = subroot('static_content/media/')

    DIR_SAMPLE_IMAGES = subroot('src/crm/res/sample_images')

json settings reader
-------------------------
make_json_settings_reader - tool to read settings from json file (e.g. secret settings).

.. code-block:: python

    # create settings reader
    secrets = make_json_settings_reader(subroot('conf/secrets.json'))

    # use it for reading settings
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.postgresql_psycopg2',
            'NAME': 'mydbname',
            'USER': 'mydbuser',
            'PASSWORD': secrets['DATABASE_PASSWORD'],
        }
    }

    SECRET_KEY = secrets['SECRET_KEY']


Data in json file must be represented as dict:

.. code-block:: json

    {
      "SECRET_KEY": "user123",
      "DATABASE_PASSWORD": "user123"
    }
sparse_vector 0.4
A sparse vector in pure python, based on numpy.
License: MIT
Keywords: sparse,vector,list,container,iterable

Sparse Vector
=============

A *sparse vector* is a 1D numerical list where most (say, more than 95%
of) values will be ``0`` (or some other default) and for reasons of
memory efficiency you don't wish to store these. (cf. `Sparse
array <http://en.wikipedia.org/wiki/Sparse_array>`__)

This implementation has a similar interface to Python's 1D
``numpy.ndarray`` but stores the values and indices in linked lists to
preserve memory.

``sparse_vector`` is for numerical data only, if you want any type of
data, have a look at
`sparse\_list <https://pypi.python.org/pypi/sparse_list>`__, the parent
library, a dictionary-of-keys implementation of a sparse list in python.

If you need 2D matrices, have a look at ``scipy.sparse``, they also have
a linked lists implementation, ``lil_matrix``.

Installation
------------

Available on `the
cheeseshop <https://pypi.python.org/pypi/sparse_vector>`__.

Installation is simply:

.. code:: bash

    $ pip install sparse_vector

Usage
-----

See the
`unit-tests <https://github.com/Goutte/python_sparse_vector/blob/master/test_sparse_vector.py>`__!

Contributing
------------

1. Fork it
2. Create your feature branch (``git checkout -b my-new-feature``)
3. Commit your changes (``git commit -am 'Add some feature'``)
4. Ensure the tests pass for all Pythons in
   ``.travis.yml <https://github.com/johnsyweb/python_sparse_vector/blob/master/.travis.yml>``\ \_\_
5. Push to the branch (``git push origin my-new-feature``)
6. Create new Pull Request

Thanks
------

-  `johnsyweb <http://johnsy.com/about/>`__ for the original
   ``sparse_list``.