From da84ed5a404bc8fbb9cee73eb639cd322a962142 Mon Sep 17 00:00:00 2001 From: Tuan Pham Date: Tue, 7 Feb 2023 15:07:00 +0700 Subject: [PATCH] Doc/add deploy step (#33) * build: update version to 1.0.0 * doc: add doc to guide how to deploy package to pypi * doc: change CLI to lib * build: update version to 1.0.1 --- DEVELOPING.md | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 +- setup.cfg | 2 +- version.txt | 2 +- 4 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 DEVELOPING.md diff --git a/DEVELOPING.md b/DEVELOPING.md new file mode 100644 index 0000000..ec77306 --- /dev/null +++ b/DEVELOPING.md @@ -0,0 +1,79 @@ +# Guide to contribute to this repository + +## Prerequisite + +1. python3 +2. pip3 +3. virtualenv + ```shell + pip3 install virtualenv + ``` + +## Steps to setup dev environment + +1. Create a python3 virtual environment + ```shell + virtualenv .venv -p python3 + ``` +2. Activate the virtual environment created in step 1 + ```shell + source .venv/bin/activate + ``` +3. Install `setuptools` to package code and `black` to format python code + ```shell + pip3 install setuptools black + ``` +4. Install libraries in file requirements.txt + ```shell + pip3 install -r requirements.txt + ``` + +## Steps to install the CLI to virtual environment and run it + +1. Run command to install CLI in editable mode + ```shell + pip3 install -e . + ``` +2. Verify the CLI + ```shell + which aito + ``` +3. Run `aito` command + ```shell + aito + ``` + +## Steps to package and distribute CLI to TestPyPI + +1. Install `build` to generate distribution packages and `twine` to distribute package to PyPI + ```shell + pip3 install build twine + ``` +2. Run `build` command as the root folder, where file `pyproject.toml` is located + ```shell + rm -rf dist + python3 -m build + ``` + After that command, we will have `tar.gz` and `.whl` files in `dist` folder + +3. Register an account in TestPyPI and create an API token with `Entire account` scope +4. Using twine to upload the distribution packages created in step 2 to TestPyPI + ```shell + twine upload --repository testpypi --skip-existing dist/* + ``` + `--repository` used to choose upload to PyPI or TestPyPI, `--skip-existing` if we want to distribute further versions of the cli. + + You will be prompted for a username and password. For the username, use `__token__`. For the password, use the token value, including the pypi- prefix. +5. Using another virtual environment and install the `aitomatic-cli` using pip to verify that it works + ```shell + deactivate + virtualenv .venv-test -p python3 + source .venv-test/bin/activate + pip3 install -i https://test.pypi.org/simple/ aitomatic + ``` + +## Steps to package and distribute CLI to PyPI + +Similar to steps to distribute to TestPyPI, except: +- Don't need to specify `--repository` when running twine command +- Don't need to specify `-i` when running pip install command diff --git a/README.md b/README.md index 6185af9..d522efa 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Aitomatic CLI +# Aitomatic Library Aitomatic library to interact with K1st model created from Aitomatic platform diff --git a/setup.cfg b/setup.cfg index 67a42a2..06be35b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,7 @@ name = aitomatic version = file: version.txt author = Pham Hoang Tuan author_email = tuan@aitomatic.com -description = aitomatic CLI to manage projects and apps +description = aitomatic library to interact with Aitomatic product long_description = file: README.md long_description_content_type = text/markdown url = https://github.com/aitomatic/aitomatic-cli diff --git a/version.txt b/version.txt index e01e0dd..7dea76e 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.12.4 +1.0.1