pip install virtualenvvirtualenv venvto create virtual environment for Python 3source ./venv/bin/activateactivate virtual env.cdinto project root folder.pip install --editable .will install all dependencies fromsetup.py.
- Start an Elasticsearch instance from either local, Docker with Open Distro SQL plugin, or AWS Elasticsearch
- To launch the cli, use 'wake' word
odfesqlfollowed by endpoint of your running ES instance. If not specifying any endpoint, it uses http://localhost:9200 by default. If not provided with port number, http endpoint uses 9200 and https uses 443 by default.
- Prerequisites
- Build the application
- Start a local Elasticsearch instance (OSS) with Open Distro SQL plugin for Elasticsearch installed and listening at http://localhost:9200.
- Pytest
pip install -r requirements-dev.txtInstall test frameworks including Pytest and mock.cdintotestsand runpytest
- Refer to test_plan for manual test guidance.
- Use black to format code, with option of
--line-length 120
- Package Manager: pip
- Repository of software for Python: PyPI
- Update version number
- Modify the version number in
__init__.pyundersrcpackage. It will be used bysetup.pyfor release.
- Modify the version number in
- Create/Update
setup.py(if needed)- For more details refer to https://packaging.python.org/tutorials/packaging-projects/#creating-setup-py
- Update README.md, Legal and copyright files(if needed)
- Update README.md when there is a critical feature added.
- Update
THIRD-PARTYfiles if there is a new dependency added.
- Generate distribution archives
- Make sure you have the latest versions of
setuptoolsandwheelinstalled:python3 -m pip install --user --upgrade setuptools wheel - Run this command from the same directory where
setup.pyis located:python3 setup.py sdist bdist_wheel - Check artifacts under
sql-cli/dist/, there should be a.tar.gzfile and a.whifile with correct version. Remove other deprecated artifacts.
- Make sure you have the latest versions of
- Upload the distribution archives to TestPyPI
- Register an account on testPyPI
python3 -m pip install --user --upgrade twinepython3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
- Install your package from TestPyPI and do manual test
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple odfe-sql-cli
- Upload to PyPI
- Register an account on PyPI, note that these are two separate servers and the credentials from the test server are not shared with the main server.
- Use
twine upload dist/*to upload your package and enter your credentials for the account you registered on PyPI.You don’t need to specify --repository; the package will upload to https://pypi.org/ by default.
- Install your package from PyPI using
pip install [your-package-name]