From d77b6d3f097a6badab898eb6f9d76e83ca50cacf Mon Sep 17 00:00:00 2001 From: Richard Eckart de Castilho Date: Tue, 19 Mar 2024 18:48:45 +0100 Subject: [PATCH] No issue: Introduce subpackage cli, add more metadata to pyproject.toml --- .github/workflows/publish_to_pypi.yml | 38 ++++++++++++++++++++++++ Makefile | 2 +- inception/cli/__init__.py | 0 inception/{ => cli}/commands/__init__.py | 0 inception/{ => cli}/commands/project.py | 2 +- inception/{cli.py => cli/main.py} | 4 +-- inception/{ => cli}/utils.py | 0 pyproject.toml | 14 ++++++--- 8 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/publish_to_pypi.yml create mode 100644 inception/cli/__init__.py rename inception/{ => cli}/commands/__init__.py (100%) rename inception/{ => cli}/commands/project.py (97%) rename inception/{cli.py => cli/main.py} (80%) rename inception/{ => cli}/utils.py (100%) diff --git a/.github/workflows/publish_to_pypi.yml b/.github/workflows/publish_to_pypi.yml new file mode 100644 index 0000000..c78e9c7 --- /dev/null +++ b/.github/workflows/publish_to_pypi.yml @@ -0,0 +1,38 @@ +name: Publish to PyPi + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install dependencies + run: | + pip install poetry + make dependencies +# - name: Run tests +# run: | +# pytest + - name: Build package + run: | + make build + - name: Publish package to TestPyPI + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.test_pypi_password }} + repository-url: https://test.pypi.org/legacy/ + - name: Publish package to PyPI + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.pypi_password }} diff --git a/Makefile b/Makefile index 8c99fe3..993b906 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ docs: poetry run mkdocs serve # Building and publishing -build: unit-tests lint +build: lint # unit-tests lint poetry build publish: build diff --git a/inception/cli/__init__.py b/inception/cli/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/inception/commands/__init__.py b/inception/cli/commands/__init__.py similarity index 100% rename from inception/commands/__init__.py rename to inception/cli/commands/__init__.py diff --git a/inception/commands/project.py b/inception/cli/commands/project.py similarity index 97% rename from inception/commands/project.py rename to inception/cli/commands/project.py index 61c99e5..114ed33 100644 --- a/inception/commands/project.py +++ b/inception/cli/commands/project.py @@ -7,7 +7,7 @@ import click -from inception.utils import make_client, list_matching_projects, get_project_from_name, list_matching_zip_files +from inception.cli.utils import make_client, list_matching_projects, get_project_from_name, list_matching_zip_files class FileIfNotRegex(click.ParamType): diff --git a/inception/cli.py b/inception/cli/main.py similarity index 80% rename from inception/cli.py rename to inception/cli/main.py index d13b740..dde56e9 100644 --- a/inception/cli.py +++ b/inception/cli/main.py @@ -2,8 +2,8 @@ import click -from inception.commands import export_projects -from inception.commands.project import import_projects, delete_project, list_projects +from inception.cli.commands import export_projects +from inception.cli.commands.project import import_projects, delete_project, list_projects @click.group(help="CLI tool for INCEpTION") diff --git a/inception/utils.py b/inception/cli/utils.py similarity index 100% rename from inception/utils.py rename to inception/cli/utils.py diff --git a/pyproject.toml b/pyproject.toml index c7b1158..e3aae50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,17 @@ [tool.poetry] name = "inception-cli" version = "0.1.0-dev" +readme = "README.md" +# homepage = "https://github.com/inception-project/inception-cli" +repository = "https://github.com/inception-project/inception-cli" +# documentation = "https://github.com/inception-project/inception-cli" description = "INCEpTION command line tool" -authors = ["The INCEpTION Project"] -license = "Apache License 2.0" +authors = [ "The INCEpTION Project" ] +maintainers = [ "Richard Eckart de Castilho" ] +keywords = [ "INCEpTION" ] +license = "Apache-2.0" packages = [ - { include = "inception" }, + { include = "inception/cli" }, ] [tool.poetry.dependencies] @@ -32,7 +38,7 @@ line-length = 120 target_version = ['py38'] [tool.poetry.plugins."console_scripts"] -inception-cli = "inception.cli:cli" +inception-cli = "inception.cli.main:cli" [build-system] requires = ["poetry_core>=1.0.0"]