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 OpenSearch instance from either local, Docker with OpenSearch SQL plugin, or AWS OpenSearch
- To launch the cli, use 'wake' word
opensearchsqlfollowed 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.
- Pytest
pip install -r requirements-dev.txtInstall test frameworks including Pytest and mock.cdintosrc/main/python/opensearchsql_cli/testsand runpytest
- Refer to README.md for manual test guidance.
- Use black to format code.
# Format all files
black .
- Package Manager: pip
- Repository of software for Python: PyPI
- Update version number
- Modify the version number in
__init__.py. 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 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]