Skip to content
Open
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
24 changes: 12 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
- id: check-hooks-apply

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
hooks:
- id: check-merge-conflict
- id: check-case-conflict
Expand All @@ -32,24 +32,24 @@ repos:
args: [--pytest-test-first]

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: a6273196190bb0f68caf1dc68073cf62c719f725 # frozen: v2.14.0
rev: 4380fbb73a154b5f5624794c1c78d9719ccc860f # frozen: v2.16.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2']

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 06e4cc849d03f3a59ca223a4046f4bb5bb2aba6d # frozen: 0.33.0
rev: c4654a7e007c9619a5eb63c39a456572a0fa1851 # frozen: 0.38.0
hooks:
- id: check-dependabot
- id: check-github-workflows

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 57b6ff7bf72affdd12c7f3fd6de761ba18a33b3a # frozen: v2.5.1
rev: 3b42b9776870badc9eaffdef9a4a0834b764d87c # frozen: v2.29.3
hooks:
- id: pyproject-fmt

- repo: https://github.com/executablebooks/mdformat
rev: ff29be1a1ba8029d9375882aa2c812b62112a593 # frozen: 0.7.22
rev: 2d496dbc18e31b83a1596685347ffe0b6041daf0 # frozen: 1.0.0
hooks:
- id: mdformat
args: [--number, --wrap=120, --ignore-missing-references]
Expand All @@ -66,21 +66,21 @@ repos:
- mdformat-mkdocs[recommended]>=v2.0.7

- repo: https://github.com/provinzkraut/unasyncd
rev: 572842a04440d45bd7d6bee5a6a4d006891d8c66 # frozen: v0.8.1
rev: b776e25a7e51956c222d676c0cc6acd36bf75396 # frozen: v0.10.1
hooks:
- id: unasyncd
additional_dependencies:
- ruff==0.6.1

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: e84319e627902e1b348574ecf3238dc511933dc7 # frozen: v0.11.7
rev: 321478e58f4938179c6b86e4ddfa923d1547a49b # frozen: v0.16.6
hooks:
- id: ruff
args: [--fix, --show-fixes, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: f40886d54c729f533f864ed6ce584e920feb0af7 # frozen: v1.15.0
rev: 7ff8d35ae36a7d2b968f2f90b4c723e292e594ee # frozen: v2.3.1
hooks:
- id: mypy
args: [--config-file=pyproject.toml]
Expand All @@ -94,24 +94,24 @@ repos:
- xsdata>=24.5

- repo: https://github.com/scientific-python/cookie
rev: f801700e5a8beb2f42e63d752d7116aa4dbaa0f1 # frozen: 2025.01.22
rev: 1589a99867d6cac494ac7545fe6a83108580a3ee # frozen: 2026.08.14
hooks:
- id: sp-repo-review

- repo: https://github.com/crate-ci/typos
rev: 15ff058881549e16b0edb975a9b0b0d0cccd612c # frozen: v1
rev: c132f8b9e3ac7f8f0625490b1cb5b906d1d6a63a # frozen: v1
hooks:
- id: typos
args: [--force-exclude]
exclude: src/re3data/_resources/repository.py|tests/conftest.py

- repo: https://github.com/FHPythonUtils/LicenseCheck/
rev: 1396d3408d6c08cad89229fa30ef17a35e35d5c4 # frozen: 2025.1.0
rev: 21abbebb654a297a8e7b62ddebe7a77504171386 # frozen: 2026.0.8
hooks:
- id: licensecheck

- repo: https://github.com/compilerla/conventional-pre-commit
rev: fa1915d04e129bcd0dccabf6aca53cdc19787ab4 # frozen: v4.1.0
rev: 3db014c16a9d31997ab8c07a4d61fcce936c8f0d # frozen: v4.4.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
Expand Down
163 changes: 79 additions & 84 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Text Processing :: Markup :: XML",
"Typing :: Typed",
Expand Down Expand Up @@ -83,22 +84,23 @@ docs = [
"mkdocstrings[python]",
]

[tool.hatch.build.targets.sdist]
only-include = [
[tool.hatch]
build.targets.wheel.packages = [
"src/re3data",
]
exclude = [
build.targets.sdist.exclude = [
"src/re3data/_resources/*.md",
"src/re3data/_resources/*.xml",
]

[tool.hatch.build.targets.wheel]
only-packages = true
packages = [
build.targets.sdist.only-include = [
"src/re3data",
]
build.targets.wheel.only-packages = true

[tool.ruff] # Ref: https://docs.astral.sh/ruff/configuration/
[tool.uv]
default-groups = [ "dev", "test" ]

[tool.ruff] # Ref: https://docs.astral.sh/ruff/configuration/
line-length = 120
src = [
"src",
Expand Down Expand Up @@ -151,7 +153,7 @@ lint.isort.known-first-party = [
]
lint.pydocstyle.convention = "google"

[tool.repo-review] # Ref: https://github.com/scientific-python/cookie/tree/main#list-of-checks
[tool.repo-review] # Ref: https://github.com/scientific-python/cookie/tree/main#list-of-checks
ignore = [
# PC is Pre-commit
"PC111", # blacken-docs
Expand All @@ -162,90 +164,69 @@ ignore = [
"RTD", # read the docs
]

[tool.pytest.ini_options] # Ref: https://docs.pytest.org/en/stable/customize.html
minversion = "8.0"
addopts = [
[tool.typos] # Ref: https://github.com/crate-ci/typos/blob/master/docs/reference.md
# add "spellchecker:disable-line" to ignore specific lines
default.extend-ignore-re = [
"(?Rm)^.*# spellchecker:disable-line$",
]

[tool.mypy] # Ref: https://mypy.readthedocs.io/en/stable/config_file.html#using-a-pyproject-toml-file
python_version = "3.10"
warn_unreachable = true
enable_error_code = [
"ignore-without-code",
"redundant-expr",
"truthy-bool",
]
strict = true
show_error_context = true
show_column_numbers = true
pretty = true

[tool.pytest]
# Ref: https://docs.pytest.org/en/stable/customize.html
ini_options.minversion = "8.0"
ini_options.testpaths = "tests"
ini_options.addopts = [
"-ra",
"--showlocals",
"--strict-markers",
"--strict-config",
"-m not e2e", # default behaviour: do not run e2e tests
]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
filterwarnings = [
"error",
]
log_cli_level = "INFO"
xfail_strict = true
testpaths = "tests"
markers = [
ini_options.markers = [
"e2e: marks tests as end-to-end tests, requesting the live api",
]
ini_options.xfail_strict = true
ini_options.filterwarnings = [
"error",
]
ini_options.log_cli_level = "INFO"
ini_options.asyncio_default_fixture_loop_scope = "function"
ini_options.asyncio_mode = "auto"

[tool.coverage.run] # Ref: https://coverage.readthedocs.io/en/latest/config.html
branch = true
parallel = true
source = [
[tool.coverage]
run.source = [
"re3data",
]
omit = [
run.omit = [
"__main__.py",
]

[tool.coverage.report]
exclude_also = [
"if TYPE_CHECKING:",
# Ref: https://coverage.readthedocs.io/en/latest/config.html
run.branch = true
run.parallel = true
report.fail_under = 90
report.exclude_also = [
"@overload",
"if TYPE_CHECKING:",
]
fail_under = 90
show_missing = true
skip_covered = true
skip_empty = true

[tool.mypy] # Ref: https://mypy.readthedocs.io/en/stable/config_file.html#using-a-pyproject-toml-file
python_version = "3.10"
strict = true
pretty = true
show_column_numbers = true
show_error_context = true
enable_error_code = [
"ignore-without-code",
"redundant-expr",
"truthy-bool",
]
warn_unreachable = true

[tool.uv]
default-groups = [ "dev", "test" ]
report.skip_covered = true
report.skip_empty = true
report.show_missing = true

[tool.licensecheck] # Ref: https://github.com/FHPythonUtils/LicenseCheck/#example-1-pyprojecttoml
using = "PEP631"
format = "ansi"

[tool.unasyncd] # Ref: https://github.com/provinzkraut/unasyncd?tab=readme-ov-file#configuration
add_editors_note = true
ruff_fix = true
ruff_format = true
transform_docstrings = true

[tool.unasyncd.files]
"src/re3data/_client/_async.py" = "src/re3data/_client/_sync.py"
"tests/integration/test_async_client.py" = "tests/integration/test_client.py"

[tool.unasyncd.add_replacements]
"AsyncClient" = "Client"
"re3data.AsyncClient" = "re3data.Client"
"async_client" = "client"
"async_log_response" = "log_response"
"httpx.AsyncClient" = "httpx.Client"
"AsyncRepositoryManager" = "RepositoryManager"

[tool.semantic_release] # Ref: https://python-semantic-release.readthedocs.io/en/latest/configuration.html#settings
commit_author = "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
commit_message = "chore: release {version}\n\nAutomatically generated by python-semantic-release [skip ci]"
major_on_zero = false
[tool.semantic_release] # Ref: https://python-semantic-release.readthedocs.io/en/latest/configuration.html#settings
tag_format = "{version}"
major_on_zero = false
version_toml = [
"pyproject.toml:project.version",
]
Expand All @@ -255,14 +236,28 @@ sed -i "s/^date-released: .*/date-released: $(date "+%Y-%m-%d")/" CITATION.cff
sed -i "s|/compare/[0-9]*\.[0-9]*\.[0-9]*...main|/compare/$NEW_VERSION...main|" CHANGELOG.md
git add CHANGELOG.md CITATION.cff
'''
changelog.mode = "update"
commit_message = "chore: release {version}\n\nAutomatically generated by python-semantic-release [skip ci]"
commit_author = "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
changelog.environment.keep_trailing_newline = false
changelog.exclude_commit_patterns = [ "^build", "^chore", "^style", "^ci" ]
changelog.insertion_flag = "<!-- releases -->"
changelog.mode = "update"
changelog.template_dir = ".github/templates"
changelog.exclude_commit_patterns = [ "^build", "^chore", "^style", "^ci" ]
changelog.environment.keep_trailing_newline = false

[tool.typos] # Ref: https://github.com/crate-ci/typos/blob/master/docs/reference.md
# add "spellchecker:disable-line" to ignore specific lines
default.extend-ignore-re = [
"(?Rm)^.*# spellchecker:disable-line$",
]
[tool.licensecheck] # Ref: https://github.com/FHPythonUtils/LicenseCheck/#example-1-pyprojecttoml
using = "PEP631"
format = "ansi"

[tool.unasyncd] # Ref: https://github.com/provinzkraut/unasyncd?tab=readme-ov-file#configuration
add_editors_note = true
ruff_fix = true
ruff_format = true
transform_docstrings = true
files."src/re3data/_client/_async.py" = "src/re3data/_client/_sync.py"
files."tests/integration/test_async_client.py" = "tests/integration/test_client.py"
add_replacements.AsyncClient = "Client"
add_replacements."re3data.AsyncClient" = "re3data.Client"
add_replacements.async_client = "client"
add_replacements.async_log_response = "log_response"
add_replacements."httpx.AsyncClient" = "httpx.Client"
add_replacements.AsyncRepositoryManager = "RepositoryManager"
8 changes: 4 additions & 4 deletions src/re3data/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import logging
import sys
from pathlib import Path
from typing import Annotated, Any, Optional
from typing import Annotated, Any

from rich.console import Console

Expand Down Expand Up @@ -91,15 +91,15 @@ def callback(
@repositories_app.command("list")
def list_repositories(
query: Annotated[
Optional[str], # noqa: UP007 - typer does not support "str | None"
str | None,
typer.Option(
help="A query to filter the results. If provided, only repositories matching the query will be returned."
),
] = None,
return_type: ReturnType = ReturnType.DATACLASS,
count: bool = False,
outfile: Annotated[
Optional[Path], # noqa: UP007 - typer does not support "Path | None"
Path | None,
typer.Option(
file_okay=True,
dir_okay=False,
Expand All @@ -118,7 +118,7 @@ def get_repository(
repository_id: str,
return_type: ReturnType = ReturnType.DATACLASS,
outfile: Annotated[
Optional[Path], # noqa: UP007 - typer does not support "Path | None"
Path | None,
typer.Option(
file_okay=True,
dir_okay=False,
Expand Down
2 changes: 1 addition & 1 deletion src/re3data/_client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class BaseClient:

def __init__(
self,
client: type[httpx.Client] | type[httpx.AsyncClient],
client: type[httpx.Client | httpx.AsyncClient],
) -> None:
self._client = client(
base_url=BASE_URL,
Expand Down
4 changes: 2 additions & 2 deletions src/re3data/_resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Here's an example:
>>> repository_summary = re3data.repositories.list()[0]
>>> repository_summary.link.href
'https://www.re3data.org/api/beta/repository/r3d100010468'
>>> repository_summary.href # for convenience
>>> repository_summary.href # for convenience
'https://www.re3data.org/api/beta/repository/r3d100010468'
```

Expand All @@ -48,7 +48,7 @@ Here's an example:
>>> repository = re3data.repositories.get("r3d100010468")
>>> repository.re3data_org_identifier
'r3d100010468'
>>> repository.id # for convenience
>>> repository.id # for convenience
'r3d100010468'
```

Expand Down
Loading
Loading