Skip to content

Commit

Permalink
Update template files and faster tests (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito authored Mar 15, 2024
1 parent d02fbcf commit de0e322
Show file tree
Hide file tree
Showing 24 changed files with 1,041 additions and 1,006 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ repos:
- id: no-commit-to-branch
args: [--branch, dev, --branch, int, --branch, main]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
rev: v0.3.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.9.0
hooks:
- id: mypy
args: [--no-warn-unused-ignores]
2 changes: 1 addition & 1 deletion .pyproject_generation/pyproject_custom.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies = [
"ghga-event-schemas~=3.0.0",
"ghga-service-commons[api,auth]>=2.0.0, <3",
"hexkit[mongodb,akafka]>=2.1.0",
"httpx>=0.25.2",
"httpx>=0.27.0",
"typer>=0.9.0",
]

Expand Down
24 changes: 13 additions & 11 deletions .pyproject_generation/pyproject_template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ exclude = [
"build",
"dist",
]
line-length = 88
src = ["src", "tests", "examples", "scripts"]
target-version = "py39"

[tool.ruff.lint]
fixable = [
"UP", # e.g. List -> list
"I", # sort imports
"D", # pydocstyle
]
ignore = [
"E", # pycodestyle errors
"W", # pycodestyle warnings - pycodestyle covered by black
Expand All @@ -49,7 +59,6 @@ ignore = [
"D206", # indent-with-spaces (ignored for formatter)
"D300", # triple-single-quotes (ignored for formatter)
]
line-length = 88
select = [
"C90", # McCabe Complexity
"F", # pyflakes codes
Expand All @@ -63,25 +72,18 @@ select = [
"SIM", # flake8-simplify
"D", # pydocstyle
]
fixable = [
"UP", # e.g. List -> list
"I", # sort imports
"D", # pydocstyle
]
src = ["src", "tests", "examples", "scripts"]
target-version = "py39"

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 10

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"scripts/*" = ["PL", "S", "SIM", "D"]
"tests/*" = ["S", "SIM", "PLR", "B011"]
".devcontainer/*" = ["S", "SIM", "D"]
"examples/*" = ["S", "D"]
"__init__.py" = ["D"]

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "pep257"

[tool.mypy]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ The service requires the following configuration parameters:

- **`workers`** *(integer)*: Number of workers processes to run. Default: `1`.

- **`api_root_path`** *(string)*: Root path at which the API is reachable. This is relative to the specified host and port. Default: `"/"`.
- **`api_root_path`** *(string)*: Root path at which the API is reachable. This is relative to the specified host and port. Default: `""`.

- **`openapi_url`** *(string)*: Path to get the openapi specification in JSON format. This is relative to the specified host and port. Default: `"/openapi.json"`.

Expand Down
2 changes: 1 addition & 1 deletion config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
"type": "integer"
},
"api_root_path": {
"default": "/",
"default": "",
"description": "Root path at which the API is reachable. This is relative to the specified host and port.",
"title": "Api Root Path",
"type": "string"
Expand Down
2 changes: 1 addition & 1 deletion example_config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
access_grant_max_days: 730
access_grant_min_days: 7
access_upfront_max_days: 180
api_root_path: /
api_root_path: ''
auth_algs:
- ES256
auth_check_claims:
Expand Down
27 changes: 14 additions & 13 deletions lock/requirements-dev-template.in
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
# common requirements for development and testing of services

pytest>=7.2.0
pytest-asyncio>=0.20.3
pytest-cov>=4.0.0
pytest>=7.4.0
pytest-asyncio>=0.23.0
pytest-cov>=4.1.0
pytest-profiling>=1.7.0
snakeviz>=2.2.0
logot>=1.2.0

pre-commit>=3.1.1
pre-commit>=3.6.0

mypy>=1.0.0
mypy>=1.8.0
mypy-extensions>=1.0.0

ruff>=0.0.290
ruff>=0.3.0

click>=8.1.0
typer>=0.7.0
typer>=0.9.0

httpx>=0.23.3
pytest-httpx>=0.21.3
httpx>=0.27.0
pytest-httpx>=0.30.0

urllib3>=1.26.15
requests>=2.28.2
urllib3>=1.26.18
requests>=2.31.0

stringcase>=1.2.0
jsonschema2md>=1.0.0
setuptools>=67.7.2
setuptools>=69.1.0

# required since switch to pyproject.toml and pip-tools
pip-tools>=7.3.0
pip-tools>=7.4.0
tomli>=2.0.1
tomli_w>=1.0.0
2 changes: 1 addition & 1 deletion lock/requirements-dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
-r requirements-dev-template.in

# additional requirements can be listed here
testcontainers[kafka,mongo]>=3.4.1
testcontainers[kafka,mongo]>=4
992 changes: 492 additions & 500 deletions lock/requirements-dev.txt

Large diffs are not rendered by default.

Loading

0 comments on commit de0e322

Please sign in to comment.