diff --git a/.github/workflows/cd-syftcli.yml b/.github/workflows/cd-syftcli.yml index 0a571848407..39193a79fd7 100644 --- a/.github/workflows/cd-syftcli.yml +++ b/.github/workflows/cd-syftcli.yml @@ -72,11 +72,11 @@ jobs: if: ${{steps.get-hashes.outputs.current_hash != steps.get-hashes.outputs.previous_hash }} id: bump-version run: | - python3 src/syftcli/version.py + python3 syftcli/version.py bump2version patch --allow-dirty --no-commit tox -e lint || true - echo "deployed_version=$(python3 src/syftcli/version.py)" >> $GITHUB_OUTPUT - python3 src/syftcli/version.py + echo "deployed_version=$(python3 syftcli/version.py)" >> $GITHUB_OUTPUT + python3 syftcli/version.py working-directory: ./packages/syftcli - name: Write the new hash @@ -90,7 +90,7 @@ jobs: author_name: Madhava Jay author_email: madhava@openmined.org message: "bump version" - add: "['./packages/syftcli/.bumpversion.cfg','./packages/syftcli/setup.py','./packages/syftcli/src/syftcli/version.py', './scripts/syftcli_hash']" + add: "['./packages/syftcli/.bumpversion.cfg','./packages/syftcli/setup.py','./packages/syftcli/syftcli/version.py', './scripts/syftcli_hash']" pull_strategy: NO-PULL - name: Build and publish diff --git a/.isort.cfg b/.isort.cfg index 418a5bc0a57..e9749ee711d 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -3,9 +3,10 @@ profile=black force_single_line=True known_syft=syft known_grid=grid +known_syftcli=syftcli known_first_party=src remove_redundant_aliases=True -sections=FUTURE,STDLIB,THIRDPARTY,SYFT,GRID,FIRSTPARTY,LOCALFOLDER +sections=FUTURE,STDLIB,THIRDPARTY,SYFT,GRID,SYFTCLI,FIRSTPARTY,LOCALFOLDER lines_between_types=0 force_sort_within_sections=True import_heading_future=future @@ -13,6 +14,7 @@ import_heading_stdlib=stdlib import_heading_thirdparty=third party import_heading_syft=syft absolute import_heading_grid=grid absolute +import_heading_syftcli=syftcli absolute import_heading_firstparty=first party import_heading_localfolder=relative ignore_comments=False diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6898ce9c9a7..6f57cb0cf96 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -62,9 +62,9 @@ repos: name: "absolufy-imports: syft-cli" always_run: true files: ^packages/syftcli - # This will ignore all src/**/*.py where relative imports are okay - # but absolufy only top-level src/.py. where relative imports are not okay for pyinstaller - exclude: ^packages/syftcli/src/(.*)/ + # This will ignore all syftcli/**/*.py where relative imports are okay + # but absolufy only top-level syftcli/.py. where relative imports are not okay for pyinstaller + exclude: ^packages/syftcli/syftcli/(.*)/ args: ["--application-directories=packages/syftcli/"] - repo: https://github.com/pycqa/isort diff --git a/packages/syftcli/.bumpversion.cfg b/packages/syftcli/.bumpversion.cfg index 3e7ddcd71b1..fe5a5d8ad02 100644 --- a/packages/syftcli/.bumpversion.cfg +++ b/packages/syftcli/.bumpversion.cfg @@ -5,6 +5,6 @@ tag_name = {new_version} commit = True commit_message = Bump version: {current_version} → {new_version} -[bumpversion:file:src/syftcli/version.py] +[bumpversion:file:syftcli/version.py] [bumpversion:file:setup.py] diff --git a/packages/syftcli/setup.py b/packages/syftcli/setup.py index cf72435fee3..1d8f782a368 100644 --- a/packages/syftcli/setup.py +++ b/packages/syftcli/setup.py @@ -29,10 +29,10 @@ include_package_data=True, entry_points={ "console_scripts": [ - "syft = src.cli:app", - "syft-cli = src.cli:app", - "syftcli = src.cli:app", - "syftctl = src.cli:app", + "syft = syftcli.cli:app", + "syft-cli = syftcli.cli:app", + "syftcli = syftcli.cli:app", + "syftctl = syftcli.cli:app", ] }, ) diff --git a/packages/syftcli/src/__init__.py b/packages/syftcli/syftcli/__init__.py similarity index 100% rename from packages/syftcli/src/__init__.py rename to packages/syftcli/syftcli/__init__.py diff --git a/packages/syftcli/src/bundle/__init__.py b/packages/syftcli/syftcli/bundle/__init__.py similarity index 100% rename from packages/syftcli/src/bundle/__init__.py rename to packages/syftcli/syftcli/bundle/__init__.py diff --git a/packages/syftcli/src/bundle/create.py b/packages/syftcli/syftcli/bundle/create.py similarity index 100% rename from packages/syftcli/src/bundle/create.py rename to packages/syftcli/syftcli/bundle/create.py diff --git a/packages/syftcli/src/cli.py b/packages/syftcli/syftcli/cli.py similarity index 84% rename from packages/syftcli/src/cli.py rename to packages/syftcli/syftcli/cli.py index 8b022d3de18..cd08cef2451 100644 --- a/packages/syftcli/src/cli.py +++ b/packages/syftcli/syftcli/cli.py @@ -4,10 +4,10 @@ from typer import Typer from typer import echo -# first party -from src.bundle import cmd as bundle_cmd -from src.core.console import console -from src.version import __version__ +# syftcli absolute +from syftcli.bundle import cmd as bundle_cmd +from syftcli.core.console import console +from syftcli.version import __version__ __all__ = "app" diff --git a/packages/syftcli/src/core/__init__.py b/packages/syftcli/syftcli/core/__init__.py similarity index 100% rename from packages/syftcli/src/core/__init__.py rename to packages/syftcli/syftcli/core/__init__.py diff --git a/packages/syftcli/src/core/console.py b/packages/syftcli/syftcli/core/console.py similarity index 100% rename from packages/syftcli/src/core/console.py rename to packages/syftcli/syftcli/core/console.py diff --git a/packages/syftcli/src/core/container_engine.py b/packages/syftcli/syftcli/core/container_engine.py similarity index 100% rename from packages/syftcli/src/core/container_engine.py rename to packages/syftcli/syftcli/core/container_engine.py diff --git a/packages/syftcli/src/core/proc.py b/packages/syftcli/syftcli/core/proc.py similarity index 100% rename from packages/syftcli/src/core/proc.py rename to packages/syftcli/syftcli/core/proc.py diff --git a/packages/syftcli/src/core/register.py b/packages/syftcli/syftcli/core/register.py similarity index 100% rename from packages/syftcli/src/core/register.py rename to packages/syftcli/syftcli/core/register.py diff --git a/packages/syftcli/src/version.py b/packages/syftcli/syftcli/version.py similarity index 100% rename from packages/syftcli/src/version.py rename to packages/syftcli/syftcli/version.py diff --git a/packages/syftcli/tests/hello_test.py b/packages/syftcli/tests/hello_test.py index b68f700b2a1..7915b873059 100644 --- a/packages/syftcli/tests/hello_test.py +++ b/packages/syftcli/tests/hello_test.py @@ -1,8 +1,8 @@ # third party from typer.testing import CliRunner -# first party -from src.cli import app +# syftcli absolute +from syftcli.cli import app runner = CliRunner() diff --git a/packages/syftcli/tests/version_test.py b/packages/syftcli/tests/version_test.py index 12b162b0b45..56f768c97a1 100644 --- a/packages/syftcli/tests/version_test.py +++ b/packages/syftcli/tests/version_test.py @@ -1,8 +1,8 @@ # third party from typer.testing import CliRunner -# first party -from src.cli import app +# syftcli absolute +from syftcli.cli import app runner = CliRunner() diff --git a/tox.ini b/tox.ini index 3b145bda946..9b2eaee3479 100644 --- a/tox.ini +++ b/tox.ini @@ -112,7 +112,7 @@ commands = ; Check if SYFT_CLI_VERSION is set or choosing the current version available bash -c 'if [ -z $SYFT_CLI_VERSION ]; then \ echo "SYFT_CLI_VERSION is not set"; \ - SYFT_CLI_VERSION=$(python3 src/syftcli/version.py); \ + SYFT_CLI_VERSION=$(python3 syftcli/version.py); \ echo "Setting SYFT_CLI_VERSION to $SYFT_CLI_VERSION"; \ else \ echo "SYFT_CLI_VERSION is already set to $SYFT_CLI_VERSION"; \ @@ -121,11 +121,11 @@ commands = echo "Building syftcli-$SYFT_CLI_VERSION for $OSTYPE" && \ if [[ "$OSTYPE" == "darwin"* ]]; then \ - pyinstaller --clean --onefile --name syftcli-v$SYFT_CLI_VERSION-macos-universal2 --distpath ./dist/cli src/syftcli/cli.py --target-arch universal2; \ + pyinstaller --clean --onefile --name syftcli-v$SYFT_CLI_VERSION-macos-universal2 --distpath ./dist/cli syftcli/cli.py --target-arch universal2; \ elif [[ "$OSTYPE" == "linux-gnu"* ]]; then \ - pyinstaller --clean --onefile --name syftcli-v$SYFT_CLI_VERSION-linux-x86_64 --distpath ./dist/cli src/syftcli/cli.py; \ + pyinstaller --clean --onefile --name syftcli-v$SYFT_CLI_VERSION-linux-x86_64 --distpath ./dist/cli syftcli/cli.py; \ else \ - pyinstaller --clean --onefile --name syftcli-v$SYFT_CLI_VERSION-windows-x86_64 --distpath ./dist/cli src/syftcli/cli.py; \ + pyinstaller --clean --onefile --name syftcli-v$SYFT_CLI_VERSION-windows-x86_64 --distpath ./dist/cli syftcli/cli.py; \ fi'