pip install virtualenv
virtualenv venv
to create virtual environment for Python 3source ./venv/bin/activate
activate virtual env.cd
into project root folder.pip install --editable .
will install all dependencies fromsetup.py
.
- Start an OpenSearch instance from either local, Docker with OpenSearch SQL plugin, or AWS Elasticsearch
- To launch the cli, use 'wake' word
opensearchsql
followed by endpoint of your running OpenSearch 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 OpenSearch instance with OpenSearch SQL plugin installed and listening at http://localhost:9200.
- Pytest
pip install -r requirements-dev.txt
Install test frameworks including Pytest and mock.cd
intotests
and 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__.py
undersrc
package. It will be used bysetup.py
for 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-PARTY
files if there is a new dependency added.
- Generate distribution archives
- Make sure you have the latest versions of
setuptools
andwheel
installed:python3 -m pip install --user --upgrade setuptools wheel
- Run this command from the same directory where
setup.py
is located:python3 setup.py sdist bdist_wheel
- Check artifacts under
sql-cli/dist/
, there should be a.tar.gz
file and a.whi
file 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 twine
python3 -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 opensearchsql
- 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]