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
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ src/schemas/json/pyproject.json @ya7010
src/schemas/json/partial-fastapi.json @tiangolo
src/schemas/json/partial-scheduled.json @tiangolo

# Managed by Inwards:
src/schemas/json/partial-inwards.json @SirCypkowskyy

# Managed by Contextive Team:
src/schemas/json/contextive-glossary.json @chrissimon-au
src/test/contextive-glossary/ @chrissimon-au
Expand Down
6 changes: 6 additions & 0 deletions src/api/json/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -1477,6 +1477,12 @@
"fileMatch": [],
"url": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/partial-scheduled.json"
},
{
"name": "partial-inwards.json",
"description": "Inwards architecture linter configuration for pyproject.toml",
"fileMatch": [],
"url": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/partial-inwards.json"
},
{
"name": "bozr.suite.json",
"description": "Bozr test suite file",
Expand Down
6 changes: 6 additions & 0 deletions src/negative_test/pyproject/inwards-ignore-inw000.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#:schema ../../schemas/json/pyproject.json
[tool.inwards]
layers = [{ name = "domain", modules = ["shop.domain"] }]

[tool.inwards.rules]
ignore = ["INW000"]
3 changes: 3 additions & 0 deletions src/negative_test/pyproject/inwards-missing-layers.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#:schema ../../schemas/json/pyproject.json
[tool.inwards]
root = "src"
2 changes: 2 additions & 0 deletions src/schema-validation.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
"partial-cibuildwheel.json", // pyproject.json[tool.cibuildwheel]
"partial-dfc.json", // pyproject.json[tool.dfc]
"partial-fastapi.json", // pyproject.json[tool.fastapi]
"partial-inwards.json", // pyproject.json[tool.inwards]
"partial-mypy.json", // pyproject.json[tool.mypy]
"partial-pdm.json", // pyproject.json[tool.pdm]
"partial-pdm-dockerize.json", // pyproject.json[tool.pdm.dockerize]
Expand Down Expand Up @@ -1263,6 +1264,7 @@
"partial-cibuildwheel.json",
"partial-dfc.json",
"partial-fastapi.json",
"partial-inwards.json",
"partial-mypy.json",
"partial-pdm.json",
"partial-pdm-dockerize.json",
Expand Down
2 changes: 1 addition & 1 deletion src/schemas/json/crucible-code-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
},
"color": {
"default": "auto",
"description": "Whether to write colour: auto follows the terminal and NO_COLOR, always and never override it",
"description": "Whether a terminal is written in colour: auto follows NO_COLOR, always and never override it; a file or pipe gets none",
"enum": ["auto", "always", "never"],
"type": "string"
},
Expand Down
759 changes: 759 additions & 0 deletions src/schemas/json/partial-inwards.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/schemas/json/pyproject.json
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,11 @@
"title": "Scheduled Jobs",
"description": "Scheduled jobs in Python's `pyproject.toml`.\n\nThis is a specification for declaring recurring scheduled jobs in Python projects, in `pyproject.toml`.\n\nIt defines how jobs are declared and how providers would run them.\n\nIt does not provide a specific implementation for running scheduled jobs, because that is provider specific.\n\nFor example, a file at `app/jobs.py` could define:\n\n```python\ndef clean_files():\n print(\"Running cleanup...\")\n```\n\nYou could define a scheduled job to run that function once per day with:\n\n```toml\n[tool.scheduled.clean-files]\nevery = \"day\"\nentrypoint = \"app.jobs:clean_files\"\n```"
},
"inwards": {
"$ref": "partial-inwards.json",
"title": "Architecture Linter",
"description": "Architecture linter for Python: layers, bounded contexts and package shapes.\nhttps://sircypkowskyy.github.io/inwards/guides/configuration/"
},
"mypy": {
"$ref": "partial-mypy.json",
"title": "Static Type Checker",
Expand Down
84 changes: 84 additions & 0 deletions src/test/pyproject/inwards.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#:schema ../../schemas/json/pyproject.json
[project]
name = "shop"
version = "0.1.0"

[tool.inwards]
root = "src"
required-version = "0.3.0"
ignore = ["migrations", "/shop.scripts"]
generated = ["*_pb2", "_version"]
namespace-packages = ["acme.platform"]
cycles = ["modules", "contexts"]
escalate-after = 3
run-log = true
stop-gate = "project"
agent-suppressions = "deny"
layers = [
{ name = "domain", modules = [
"shop.*.domain",
] },
[
{ name = "billing", modules = [
"shop.billing",
] },
{ name = "shipping", modules = [
"shop.shipping",
] },
],
{ name = "api", modules = [
"shop.api",
], deny-libraries = [
"sqlalchemy",
] },
{ name = "app", modules = [
"shop.*",
], template = "fastapi-domain" },
]

[[tool.inwards.shape]]
packages = ["shop.*"]
require = ["__init__", "service.py"]
forbid = ["utils/"]
extra = "warning"
hints = ["Put shared helpers in shop.common."]

[[tool.inwards.names]]
pattern = "test_*"
only-in = ["tests.**"]

[[tool.inwards.contexts]]
name = "orders"
modules = ["shop.orders"]
public = ["shop.orders.api"]
depends-on = ["users"]

[[tool.inwards.contexts]]
name = "users"
modules = ["shop.users"]

[tool.inwards.templates.fastapi-domain]
roles = ["models | schemas", "service", "router"]
public = ["router", "schemas"]
require = ["__init__", "router"]

[tool.inwards.rules]
extend-select = ["INW010", "FAPI001", "FAPI002", "FAPI003"]
ignore = ["INW009"]
severity = { INW006 = "warning" }

[tool.inwards.rules.pure-domain]
modules = ["shop.*.domain"]

[tool.inwards.rules.endpoint-metadata]
require-summary = false
require-status-code = ["post", "delete"]
require-tags = true

[tool.inwards.rules.undocumented-error-response]
codes = "4xx-5xx"
max-depth = 3

[tool.inwards.rules.router-wiring]
entrypoints = ["shop.main:app"]
unresolved-includes = "silent"
Loading