From b3ef035e3e73603ec6744ae32b2b2c3d7ce08371 Mon Sep 17 00:00:00 2001 From: Jack Gerrits Date: Mon, 24 Jun 2024 10:36:10 -0400 Subject: [PATCH] add example team (#107) * add example team * add checks --- .github/workflows/checks.yml | 20 ++++- python/pyproject.toml | 4 +- python/teams/team-one/examples/example.py | 3 + python/teams/team-one/pyproject.toml | 86 +++++++++++++++++++ python/teams/team-one/readme.md | 0 .../teams/team-one/src/team_one/__init__.py | 1 + python/teams/team-one/src/team_one/py.typed | 0 python/teams/team-one/tests/test_example.py | 6 ++ 8 files changed, 114 insertions(+), 6 deletions(-) create mode 100644 python/teams/team-one/examples/example.py create mode 100644 python/teams/team-one/pyproject.toml create mode 100644 python/teams/team-one/readme.md create mode 100644 python/teams/team-one/src/team_one/__init__.py create mode 100644 python/teams/team-one/src/team_one/py.typed create mode 100644 python/teams/team-one/tests/test_example.py diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 3e64772db..73219d595 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -11,39 +11,51 @@ on: jobs: format: runs-on: ubuntu-latest + strategy: + matrix: + working-directory: ["./python", "./python/teams/team-one"] steps: - uses: actions/checkout@v4 - name: Install Hatch uses: pypa/hatch@install - run: hatch run ruff format --check - working-directory: ./python + working-directory: ${{ matrix.working-directory }} lint: runs-on: ubuntu-latest + strategy: + matrix: + working-directory: ["./python", "./python/teams/team-one"] steps: - uses: actions/checkout@v4 - name: Install Hatch uses: pypa/hatch@install - run: hatch run ruff check - working-directory: ./python + working-directory: ${{ matrix.working-directory }} mypy: runs-on: ubuntu-latest + strategy: + matrix: + working-directory: ["./python", "./python/teams/team-one"] steps: - uses: actions/checkout@v4 - name: Install Hatch uses: pypa/hatch@install - run: hatch run mypy - working-directory: ./python + working-directory: ${{ matrix.working-directory }} pyright: runs-on: ubuntu-latest + strategy: + matrix: + working-directory: ["./python", "./python/teams/team-one"] steps: - uses: actions/checkout@v4 - name: Install Hatch uses: pypa/hatch@install - run: hatch run pyright - working-directory: ./python + working-directory: ${{ matrix.working-directory }} test: runs-on: ubuntu-latest diff --git a/python/pyproject.toml b/python/pyproject.toml index ce4ecd7c1..fbf4666cb 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -55,7 +55,7 @@ check = [ "ruff format", "ruff check --fix", "pyright", - "mypy", + "mypy --non-interactive --install-types", "pytest -n auto", ] @@ -78,7 +78,7 @@ check = "sphinx-build --fail-on-warning docs/src docs/build" [tool.ruff] line-length = 120 fix = true -exclude = ["build", "dist", "my_project/__init__.py", "my_project/main.py"] +exclude = ["build", "dist"] target-version = "py310" include = ["src/**", "examples/*.py"] diff --git a/python/teams/team-one/examples/example.py b/python/teams/team-one/examples/example.py new file mode 100644 index 000000000..915e2dc4d --- /dev/null +++ b/python/teams/team-one/examples/example.py @@ -0,0 +1,3 @@ +import team_one + +print(team_one.ABOUT) diff --git a/python/teams/team-one/pyproject.toml b/python/teams/team-one/pyproject.toml new file mode 100644 index 000000000..78b192ca9 --- /dev/null +++ b/python/teams/team-one/pyproject.toml @@ -0,0 +1,86 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "team-one" +version = "0.0.1" +description = '' +readme = "readme.md" +requires-python = ">=3.10" +license = "MIT" +keywords = [] +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] +dependencies = [ + "agnext@{root:parent:parent:uri}", +] + +[tool.hatch.envs.default] +installer = "uv" +dependencies = [ + "pyright==1.1.368", + "mypy==1.10.0", + "ruff==0.4.8", + "pytest" +] + +[tool.hatch.envs.default.extra-scripts] +pip = "{env:HATCH_UV} pip {args}" + +[tool.hatch.envs.default.scripts] +fmt = "ruff format" +lint = "ruff check" +test = "pytest -n auto" +check = [ + "ruff format", + "ruff check --fix", + "pyright", + "mypy --non-interactive --install-types", + "pytest", +] + +[tool.hatch.metadata] +allow-direct-references = true + +[tool.ruff] +line-length = 120 +fix = true +exclude = ["build", "dist"] +target-version = "py310" +include = ["src/**", "examples/*.py"] + +[tool.ruff.format] +docstring-code-format = true + +[tool.ruff.lint] +select = ["E", "F", "W", "B", "Q", "I", "ASYNC"] +ignore = ["F401", "E501"] + +[tool.mypy] +files = ["src", "examples", "tests"] + +strict = true +python_version = "3.10" +ignore_missing_imports = true + +# from https://blog.wolt.com/engineering/2021/09/30/professional-grade-mypy-configuration/ +disallow_untyped_defs = true +no_implicit_optional = true +check_untyped_defs = true +warn_return_any = true +show_error_codes = true +warn_unused_ignores = false + +disallow_incomplete_defs = true +disallow_untyped_decorators = true +disallow_any_unimported = true + +[tool.pyright] +include = ["src", "tests", "examples"] +typeCheckingMode = "strict" +reportUnnecessaryIsInstance = false +reportMissingTypeStubs = false \ No newline at end of file diff --git a/python/teams/team-one/readme.md b/python/teams/team-one/readme.md new file mode 100644 index 000000000..e69de29bb diff --git a/python/teams/team-one/src/team_one/__init__.py b/python/teams/team-one/src/team_one/__init__.py new file mode 100644 index 000000000..6dfc2e2c2 --- /dev/null +++ b/python/teams/team-one/src/team_one/__init__.py @@ -0,0 +1 @@ +ABOUT = "This is team one." diff --git a/python/teams/team-one/src/team_one/py.typed b/python/teams/team-one/src/team_one/py.typed new file mode 100644 index 000000000..e69de29bb diff --git a/python/teams/team-one/tests/test_example.py b/python/teams/team-one/tests/test_example.py new file mode 100644 index 000000000..b18982b41 --- /dev/null +++ b/python/teams/team-one/tests/test_example.py @@ -0,0 +1,6 @@ +import team_one + +def test_about() -> None: + about = team_one.ABOUT + + assert isinstance(about, str) \ No newline at end of file