Skip to main content

Common elastic stuff for the projects.

Project description

You need to overwrite to setup your connections

  • ElasticModel You can overwrite this constant in your settings: -- ELASTIC_DEBUG -- ELASTIC_INDEX_PREFIX -- ENV

Other files not directly related to elasticsearch:

  • Utils stuff for Django (paginator)
  • Unit tests

Build command: python setup.py sdist python setup.py bdist_wheel

Run ./build.sh build the package that will be available in the dist/ directory

if wheel return an error like not installed just run pip install wheel, you may need to install some dependencies

Resources about building lib: https://code.tutsplus.com/tutorials/how-to-write-package-and-distribute-a-library-in-python--cms-28693

http://www.diveintopython3.net/packaging.html

Project repo: gitlab.com

Setup in projects guide: -Create a module name elastic.py and override the get_connection to use target elastic service. -Create a unit test to ensure that connection is working. -Elastic periodic model in elastic.py module must inherit like this (ElasticPeriodic, ElasticCustom) -Build the package and install --pip install 'package_file generated by ./build.sh command'

** About tests and changes

If there's fixes changes to do in elastic_lib make the changes directly in your project i.e edit the file elastic from venv/lib/python3.5/site-packages/elastic_lib/elastic.py then run the unit test: pytest venv/lib/python3.5/site-packages/elastic_lib/test_elastic.py

If all unit test are green check the unit test of your project if here also all is green, copy the content of your changes in the elastic_lib project and build a new version. Then update the version in the different project then run the unit test in each project to be sure that it broke nothing.

You can't run the unit test here or on you local.

Build the doc

Install a venv with Python 3.9 somehow 3.10 raise error when importing collections Mapping.

python3.9 -m venv ~/venv-elastic_lib_2/
source ~/venv-elastic_lib_2/bin/activate

Install the dependencies

pip install -r requirements/test.txt

Update the doc/conf.py to set the correct doc version.

Run the command to build the doc and generate the package.

./build.sh

The command should not raise errors, check the docs/_build/html/index.html that the doc is correctly generated.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elastic_lib-24.3.25.tar.gz (33.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page