Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
path: dist

- name: Generate artifact attestation for sdist and wheel
uses: actions/attest-build-provenance@v2.3.0
uses: actions/attest-build-provenance@v2.4.0
with:
subject-path: "dist/*"

Expand Down
32 changes: 11 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Install the project
run: uv sync --locked --group test

- uses: pre-commit/action@v3.0.1
with:
extra_args: --hook-stage manual --all-files
- name: Run PyLint
run: pipx run nox -s pylint -- --output-format=github
run: uv run --frozen nox -s pylint -- --output-format=github

checks:
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
Expand All @@ -43,26 +43,16 @@ jobs:
python-version: ["3.9", "3.13"]
runs-on: [ubuntu-latest, windows-latest, macos-14]

include:
- python-version: "pypy-3.10"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Install package
run: python -m pip install .[test]
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Install the project
run: uv sync --locked --group test

- name: Test package
run: >-
python -m pytest -ra --cov --cov-report=xml --cov-report=term
uv run --frozen pytest --cov --cov-report=xml --cov-report=term
--durations=20

- name: Upload coverage report
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1 align='center'> <code>is_annotated</code> </h1>
<h2 align="center">Check if an object is an <code>Annotated</code> type.</h2>
<h3 align="center">Check if an object is an <code>Annotated</code> type.</h3>

This is a micro-package, containing the single function `isannotated` to check
if a type hint is an `Annotated` type. `Annotated` objects can't be checked by
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

nox.needs_version = ">=2024.3.2"
nox.options.sessions = ["lint", "pylint", "tests"]
nox.options.default_venv_backend = "uv|virtualenv"
nox.options.default_venv_backend = "uv"


@nox.session
Expand Down
35 changes: 21 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,22 @@
readme = "README.md"
requires-python = ">=3.9"

[project.optional-dependencies]
dev = ["is_annotated[test]"]
test = [
"optional_dependencies >= 0.3",
"pytest >=6",
"pytest-cov >=3",
"pytest-github-actions-annotate-failures",
"sybil",
]
[dependency-groups]
dev = [
"cz-conventional-gitmoji>=0.6.1",
"ipykernel>=6.29.5",
"pre-commit>=4.0.1",
"uv>=0.6.4",
{ include-group = "test" },
]
test = [
"optional_dependencies >= 0.3",
"pytest >=6",
"pytest-cov >=3",
"pytest-github-actions-annotate-failures",
"sybil",
"nox"
]

[project.urls]
"Bug Tracker" = "https://github.com/GalacticDynamics/is_annotated/issues"
Expand All @@ -67,7 +74,7 @@
filterwarnings = ["error"]
log_cli_level = "INFO"
minversion = "6.0"
testpaths = ["tests/", "src/"]
testpaths = ["src/", "tests/"]
xfail_strict = true


Expand Down Expand Up @@ -103,18 +110,18 @@
"PLR09", # Too many <...>
"PLR2004", # Magic value used in comparison
"TD002", # Missing author in TODO
"TD003" # Missing issue link on the line following this TODO
"TD003", # Missing issue link on the line following this TODO
]

[tool.ruff.lint.per-file-ignores]
"noxfile.py" = ["T20"]
"tests/**" = ["ANN", "INP001", "S101", "T20"]

[tool.ruff.lint.isort]
combine-as-imports = true
combine-as-imports = true
extra-standard-library = ["typing_extensions"]
known-first-party = ["optional_dependencies"]
known-local-folder = ["is_annotated"]
known-first-party = ["optional_dependencies"]
known-local-folder = ["is_annotated"]


[tool.pylint]
Expand Down
5 changes: 4 additions & 1 deletion src/is_annotated/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
__all__ = ["isannotated"]

from typing import Annotated
from typing_extensions import TypeGuard, _AnnotatedAlias
from typing_extensions import ( # pylint: disable=no-name-in-module
TypeGuard,
_AnnotatedAlias,
)

AnnotationType = type(Annotated[int, "_"])

Expand Down
Loading
Loading