This repository has been archived by the owner on Mar 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from zhongnansu/test
Update doc and naming
- Loading branch information
Showing
7 changed files
with
111 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
## Development Guide | ||
### Development Environment Set Up | ||
- `pip install virtualenv` | ||
- `virtualenv venv` to create virtual environment for **Python 3** | ||
- `source ./venv/bin/activate` activate virtual env. | ||
- `cd` into project root folder. | ||
- `pip install --editable .` will install all dependencies from `setup.py`. | ||
|
||
### Run CLI | ||
- Start an Elasticsearch instance from either local, Docker with Open Distro SQL plugin, or AWS Elasticsearch | ||
- To launch the cli, use wake word `odfesql` followed by endpoint of your running ES instance. If not specifying | ||
any endpoint, it uses http://localhost:9200 by default. | ||
|
||
### Testing | ||
- Prerequisites | ||
- Build the application | ||
- Start a local Elasticsearch instance (OSS) with | ||
[Open Distro SQL plugin for Elasticsearch](https://opendistro.github.io/for-elasticsearch-docs/docs/sql/) installed | ||
and listening at http://localhost:9200. | ||
- Pytest | ||
- `pip install -r requirements-dev.txt` Install test frameworks including Pytest and mock. | ||
- `cd` into `tests` and run `pytest` | ||
- Refer to [test_plan](./tests/test_plan.md) for manual test guidance. | ||
|
||
### Style | ||
- Use [black](https://github.com/psf/black) to format code, with option of `--line-length 120` | ||
|
||
## Release guide | ||
|
||
- Package Manager: pip | ||
- Repository of software for Python: PyPI | ||
|
||
### Workflow | ||
|
||
1. Update version number | ||
1. Modify the version number in `_init_.py` under `escli` package. It will be used by `setup.py` for release. | ||
2. Create/Update `setup.py` (if needed) | ||
1. For more details refer to https://packaging.python.org/tutorials/packaging-projects/#creating-setup-py | ||
3. Update README.md, Legal and copyright files(if needed) | ||
1. Update README.md when there is a critical feature added. | ||
2. Update `THIRD-PARTY` files if there is a new dependency added. | ||
4. Generate distribution archives | ||
1. Make sure you have the latest versions of `setuptools` and `wheel` installed: `pip install --user --upgrade setuptools wheel` | ||
2. Run this command from the same directory where `setup.py` is located: `python3 setup.py sdist bdist_wheel` | ||
5. Upload the distribution archives to TestPyPI | ||
1. Register an account on [testPyPI](https://test.pypi.org/) | ||
2. `pip install --user —upgrade twine ` | ||
3. `python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*` | ||
6. Install your package from TestPyPI and do manual test | ||
1. `pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple odfe-sql` | ||
7. Upload to PyPI | ||
1. Register an account on [PyPI](https://pypi.org/), note that these are two separate servers and the credentials from the test server are not shared with the main server. | ||
2. Use `twine upload dist/*` to upload your package and enter your credentials for the account you registered on PyPI. | ||
8. Install your package from PyPI using `pip install [your-package-name]` | ||
|
||
### Reference | ||
- https://medium.com/@joel.barmettler/how-to-upload-your-python-package-to-pypi-65edc5fe9c56 | ||
- https://packaging.python.org/tutorials/packaging-projects/ | ||
- https://packaging.python.org/guides/using-testpypi/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ | |
long_description = fh.read() | ||
|
||
setup( | ||
name="escli", | ||
name="odfesql", | ||
author="Zhongnan", | ||
author_email="[email protected]", | ||
version=version, | ||
|
@@ -53,7 +53,7 @@ | |
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
install_requires=install_requirements, | ||
entry_points={"console_scripts": ["escli=escli.main:cli"]}, | ||
entry_points={"console_scripts": ["odfesql=escli.main:cli"]}, | ||
classifiers=[ | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: Apache Software License", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Test Plan | ||
The purpose of this checklist is to guide you through the basic usage of ODFE SQL CLI, as well as a manual test process. | ||
|
||
## Display | ||
* [ ] Test pagination with different output length / width. | ||
* [ ] Test table formatted output. | ||
* [ ] Test successful conversion from horizontal to vertical display with confirmation. | ||
* [ ] Test warning message when output > 200 rows of data. (Limited by ODFE SQL syntax) | ||
|
||
|
||
## Connection | ||
* [ ] Test connection to a local Elasticsearch instance | ||
* [ ] Standard Elastic version, with/without authentication by [X-pack security](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/security-getting-started.html) | ||
* [ ] OSS version, no authentication | ||
* [ ] OSS version, install [ODFE Security plugin](https://opendistro.github.io/for-elasticsearch-docs/docs/install/plugins/) to enable authentication and SSL | ||
* [ ] Test connection to [AWS Elasticsearch domain](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-gsg.html) (with ODFE SQL plugin installed by default) | ||
* [ ] Test connection fail when connecting to invalid endpoint | ||
* [ ] Test reconnection when connection lost during execution | ||
|
||
|
||
## Execution | ||
* [ ] Test successful execution given a query | ||
* [ ] Test unsuccessful execution with an invalid SQL query | ||
* [ ] Test load config file | ||
|
||
|
||
## Nested commands with params | ||
* [ ] Test dump query result to a file | ||
* [ ] Test explain option `-e` | ||
* [ ] Test query and format option `-q`, `-f` | ||
* [ ] Test vertical option `-v` | ||
|
||
|
||
## OS and Python compatibility | ||
* [ ] Manually test on Linux(Ubuntu), Windows and mac-os. | ||
* [ ] Test against python 3.X versions |
This file was deleted.
Oops, something went wrong.