diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ef3f97e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,63 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - run: pip install ruff + - run: ruff check . + - run: ruff format --check . + + test-sdk: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - run: pip install hatch + - name: Run tests + working-directory: packages/flopro-sdk + run: hatch run test + + test-adk: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - run: pip install hatch + - name: Run tests + working-directory: packages/flopro-adk + run: hatch run test + + build: + runs-on: ubuntu-latest + needs: [lint, test-sdk, test-adk] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - run: pip install build + - name: Build flopro-sdk + run: python -m build packages/flopro-sdk + - name: Build flopro-adk + run: python -m build packages/flopro-adk diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ae05ed7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release to PyPI + +on: + push: + tags: + - "flopro-sdk/v*" + - "flopro-adk/v*" + +jobs: + determine-package: + runs-on: ubuntu-latest + outputs: + package-dir: ${{ steps.parse.outputs.package-dir }} + package-name: ${{ steps.parse.outputs.package-name }} + steps: + - name: Parse tag + id: parse + run: | + TAG="${GITHUB_REF#refs/tags/}" + PACKAGE_NAME="${TAG%%/v*}" + echo "package-dir=packages/${PACKAGE_NAME}" >> "$GITHUB_OUTPUT" + echo "package-name=${PACKAGE_NAME}" >> "$GITHUB_OUTPUT" + + build: + needs: determine-package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - run: pip install build + - name: Build package + run: python -m build ${{ needs.determine-package.outputs.package-dir }} + - uses: actions/upload-artifact@v4 + with: + name: dist + path: ${{ needs.determine-package.outputs.package-dir }}/dist/ + + publish: + needs: [determine-package, build] + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/${{ needs.determine-package.outputs.package-name }} + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..714a467 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +__pycache__/ +*.pyc +.venv/ +.pytest_cache/ +*.egg-info/ +dist/ +build/ diff --git a/packages/flopro-adk/CHANGELOG.md b/packages/flopro-adk/CHANGELOG.md new file mode 100644 index 0000000..3742d31 --- /dev/null +++ b/packages/flopro-adk/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## 0.1.0 + +- Initial release diff --git a/packages/flopro-adk/README.md b/packages/flopro-adk/README.md new file mode 100644 index 0000000..438ac38 --- /dev/null +++ b/packages/flopro-adk/README.md @@ -0,0 +1,3 @@ +# flopro-adk + +FloPro Agent Development Kit. Depends on flopro-sdk. diff --git a/packages/flopro-adk/flopro_adk/__init__.py b/packages/flopro-adk/flopro_adk/__init__.py new file mode 100644 index 0000000..04f8b7b --- /dev/null +++ b/packages/flopro-adk/flopro_adk/__init__.py @@ -0,0 +1,2 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 diff --git a/packages/flopro-adk/pyproject.toml b/packages/flopro-adk/pyproject.toml new file mode 100644 index 0000000..3656b82 --- /dev/null +++ b/packages/flopro-adk/pyproject.toml @@ -0,0 +1,33 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "flopro-adk" +version = "0.1.0" +description = "FloPro Agent Development Kit" +readme = "README.md" +license = "Apache-2.0" +requires-python = ">=3.10" +dependencies = ["flopro-sdk>=0.1.0"] + +[project.urls] +Homepage = "https://github.com/amzn/FloPro" + +[tool.hatch.envs.default] +dependencies = [ + "pytest", + "ruff", +] +pre-install-commands = [ + "pip install -e {root:uri}/../flopro-sdk", +] + +[tool.hatch.envs.default.scripts] +test = "pytest -v" +lint = "ruff check ." +format-check = "ruff format --check ." + +[tool.pytest.ini_options] +addopts = "--import-mode=importlib" +testpaths = ["tests"] diff --git a/packages/flopro-adk/tests/__init__.py b/packages/flopro-adk/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/packages/flopro-adk/tests/test_import.py b/packages/flopro-adk/tests/test_import.py new file mode 100644 index 0000000..aa627bb --- /dev/null +++ b/packages/flopro-adk/tests/test_import.py @@ -0,0 +1,6 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + + +def test_import_adk(): + import flopro_adk # noqa: F401 diff --git a/packages/flopro-sdk/CHANGELOG.md b/packages/flopro-sdk/CHANGELOG.md new file mode 100644 index 0000000..3742d31 --- /dev/null +++ b/packages/flopro-sdk/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## 0.1.0 + +- Initial release diff --git a/packages/flopro-sdk/README.md b/packages/flopro-sdk/README.md new file mode 100644 index 0000000..aa4b8a7 --- /dev/null +++ b/packages/flopro-sdk/README.md @@ -0,0 +1,3 @@ +# flopro-sdk + +Core SDK for FloPro. diff --git a/packages/flopro-sdk/flopro_sdk/__init__.py b/packages/flopro-sdk/flopro_sdk/__init__.py new file mode 100644 index 0000000..04f8b7b --- /dev/null +++ b/packages/flopro-sdk/flopro_sdk/__init__.py @@ -0,0 +1,2 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 diff --git a/packages/flopro-sdk/pyproject.toml b/packages/flopro-sdk/pyproject.toml new file mode 100644 index 0000000..b1be770 --- /dev/null +++ b/packages/flopro-sdk/pyproject.toml @@ -0,0 +1,29 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "flopro-sdk" +version = "0.1.0" +description = "FloPro Core SDK" +readme = "README.md" +license = "Apache-2.0" +requires-python = ">=3.10" + +[project.urls] +Homepage = "https://github.com/amzn/FloPro" + +[tool.hatch.envs.default] +dependencies = [ + "pytest", + "ruff", +] + +[tool.hatch.envs.default.scripts] +test = "pytest -v" +lint = "ruff check ." +format-check = "ruff format --check ." + +[tool.pytest.ini_options] +addopts = "--import-mode=importlib" +testpaths = ["tests"] diff --git a/packages/flopro-sdk/tests/__init__.py b/packages/flopro-sdk/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/packages/flopro-sdk/tests/test_import.py b/packages/flopro-sdk/tests/test_import.py new file mode 100644 index 0000000..01de05f --- /dev/null +++ b/packages/flopro-sdk/tests/test_import.py @@ -0,0 +1,6 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + + +def test_import_sdk(): + import flopro_sdk # noqa: F401 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..d8743ea --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[tool.ruff] +target-version = "py310"