archetype-py 0.2.2__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. archetype_py-0.3.0/.github/ISSUE_TEMPLATE/bug_report.md +63 -0
  2. archetype_py-0.3.0/.github/ISSUE_TEMPLATE/feature_request.md +40 -0
  3. {archetype_py-0.2.2 → archetype_py-0.3.0}/.github/workflows/archetype.yml +18 -3
  4. {archetype_py-0.2.2 → archetype_py-0.3.0}/.github/workflows/ci.yml +10 -1
  5. {archetype_py-0.2.2 → archetype_py-0.3.0}/.github/workflows/publish.yml +12 -2
  6. {archetype_py-0.2.2 → archetype_py-0.3.0}/.gitignore +2 -0
  7. {archetype_py-0.2.2 → archetype_py-0.3.0}/CHANGELOG.md +34 -0
  8. archetype_py-0.3.0/CODE_OF_CONDUCT.md +128 -0
  9. archetype_py-0.3.0/PKG-INFO +101 -0
  10. archetype_py-0.3.0/PYPI.md +77 -0
  11. archetype_py-0.3.0/README.md +533 -0
  12. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/__init__.py +1 -2
  13. archetype_py-0.3.0/archetype/analysis/cache.py +107 -0
  14. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/analysis/git_utils.py +40 -1
  15. archetype_py-0.3.0/archetype/analysis/imports.py +250 -0
  16. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/analysis/models.py +2 -0
  17. archetype_py-0.3.0/archetype/analysis/path_filters.py +92 -0
  18. archetype_py-0.3.0/archetype/baseline.py +186 -0
  19. archetype_py-0.3.0/archetype/check.py +540 -0
  20. archetype_py-0.3.0/archetype/config.py +145 -0
  21. archetype_py-0.3.0/archetype/dsl/query.py +230 -0
  22. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/init.py +56 -1
  23. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/plugin/pytest_plugin.py +2 -0
  24. archetype_py-0.3.0/archetype/reporter.py +375 -0
  25. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/rule.py +73 -61
  26. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/rules/boundaries.py +10 -2
  27. archetype_py-0.3.0/assets/Pytest.png +0 -0
  28. archetype_py-0.3.0/assets/Rule_Execution_Flow.png +0 -0
  29. archetype_py-0.3.0/assets/Violation_Lifecycle.png +0 -0
  30. archetype_py-0.3.0/assets/architecture.png +0 -0
  31. archetype_py-0.3.0/assets/ci_integration.png +0 -0
  32. {archetype_py-0.2.2 → archetype_py-0.3.0}/pyproject.toml +2 -2
  33. archetype_py-0.3.0/tests/fixtures/monorepo_project/libs/shared/src/acme/shared/utils.py +5 -0
  34. archetype_py-0.3.0/tests/fixtures/monorepo_project/services/billing/src/acme/billing/api.py +7 -0
  35. archetype_py-0.3.0/tests/fixtures/namespace_project/company/payments/api.py +7 -0
  36. archetype_py-0.3.0/tests/fixtures/namespace_project/company/shared/utils.py +5 -0
  37. archetype_py-0.3.0/tests/fixtures/simple_project/.gitignore +1 -0
  38. archetype_py-0.3.0/tests/test_cli.py +1410 -0
  39. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/test_decorator_since.py +10 -2
  40. archetype_py-0.3.0/tests/test_dsl.py +154 -0
  41. archetype_py-0.3.0/tests/test_graph.py +324 -0
  42. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/test_init.py +204 -0
  43. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/test_plugin.py +28 -0
  44. archetype_py-0.3.0/tests/test_public_api.py +12 -0
  45. archetype_py-0.3.0/tests/test_reporter.py +243 -0
  46. archetype_py-0.2.2/PKG-INFO +0 -226
  47. archetype_py-0.2.2/README.md +0 -202
  48. archetype_py-0.2.2/archetype/analysis/imports.py +0 -97
  49. archetype_py-0.2.2/archetype/check.py +0 -142
  50. archetype_py-0.2.2/archetype/dsl/query.py +0 -122
  51. archetype_py-0.2.2/archetype/reporter.py +0 -155
  52. archetype_py-0.2.2/tests/test_cli.py +0 -373
  53. archetype_py-0.2.2/tests/test_dsl.py +0 -84
  54. archetype_py-0.2.2/tests/test_graph.py +0 -35
  55. {archetype_py-0.2.2 → archetype_py-0.3.0}/.github/pull_request_template.md +0 -0
  56. {archetype_py-0.2.2 → archetype_py-0.3.0}/BENCHMARKS.md +0 -0
  57. {archetype_py-0.2.2 → archetype_py-0.3.0}/CONTRIBUTING.md +0 -0
  58. {archetype_py-0.2.2 → archetype_py-0.3.0}/LICENSE +0 -0
  59. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/analysis/__init__.py +0 -0
  60. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/analysis/ast_utils.py +0 -0
  61. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/analysis/init.py +0 -0
  62. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/analysis/pattern.py +0 -0
  63. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/dsl/__init__.py +0 -0
  64. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/dsl/init.py +0 -0
  65. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/plugin/__init__.py +0 -0
  66. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/plugin/init.py +0 -0
  67. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/rules/__init__.py +0 -0
  68. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/rules/cycles.py +0 -0
  69. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/rules/layers.py +0 -0
  70. {archetype_py-0.2.2 → archetype_py-0.3.0}/archetype/rules/naming.py +0 -0
  71. {archetype_py-0.2.2 → archetype_py-0.3.0}/architecture.py +0 -0
  72. {archetype_py-0.2.2 → archetype_py-0.3.0}/assets/logo.png +0 -0
  73. {archetype_py-0.2.2 → archetype_py-0.3.0}/benchmarks/README.md +0 -0
  74. {archetype_py-0.2.2 → archetype_py-0.3.0}/benchmarks/fixtures.py +0 -0
  75. {archetype_py-0.2.2 → archetype_py-0.3.0}/benchmarks/init.py +0 -0
  76. {archetype_py-0.2.2 → archetype_py-0.3.0}/benchmarks/run_benchmarks.py +0 -0
  77. {archetype_py-0.2.2 → archetype_py-0.3.0}/benchmarks/test_performance_regression.py +0 -0
  78. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/fixtures/simple_project/simple_project/api.py +0 -0
  79. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/fixtures/simple_project/simple_project/db.py +0 -0
  80. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/fixtures/simple_project/simple_project/internal/init.py +0 -0
  81. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/fixtures/simple_project/simple_project/internal/tokens.py +0 -0
  82. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/fixtures/simple_project/simple_project/main.py +0 -0
  83. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/fixtures/simple_project/simple_project/services.py +0 -0
  84. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/test_grouping.py +0 -0
  85. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/test_pattern.py +0 -0
  86. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/test_rule.py +0 -0
  87. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/test_rules_boundaries.py +0 -0
  88. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/test_rules_cycles.py +0 -0
  89. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/test_rules_layers.py +0 -0
  90. {archetype_py-0.2.2 → archetype_py-0.3.0}/tests/test_rules_naming.py +0 -0
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report a problem or unexpected behavior in archetype-py
4
+ title: "[Bug]: "
5
+ labels: bug
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Description
10
+
11
+ Describe the issue clearly and concisely.
12
+
13
+ ---
14
+
15
+ ## Expected Behavior
16
+
17
+ What did you expect to happen?
18
+
19
+ ---
20
+
21
+ ## Actual Behavior
22
+
23
+ What actually happened?
24
+
25
+ ---
26
+
27
+ ## Reproduction
28
+
29
+ Steps to reproduce:
30
+
31
+ 1. Create rule:
32
+ 2. Run command:
33
+ 3. Observe output:
34
+
35
+ ---
36
+
37
+ ## Example Rule / Config
38
+
39
+ ```python
40
+ # Paste architecture.py snippet here
41
+ ```
42
+
43
+ ---
44
+
45
+ ## CLI Output
46
+
47
+ ```text
48
+ Paste error output here
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Environment
54
+
55
+ - archetype-py version:
56
+ - Python version:
57
+ - OS:
58
+
59
+ ---
60
+
61
+ ## Additional Context
62
+
63
+ Add any other context, screenshots, or examples here.
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea or improvement for archetype-py
4
+ title: "[Feature]: "
5
+ labels: enhancement
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Problem
10
+
11
+ Describe the problem or limitation you're facing.
12
+
13
+ Example:
14
+ "I want to enforce boundaries between domains automatically."
15
+
16
+ ---
17
+
18
+ ## Proposed Solution
19
+
20
+ Describe the behavior or feature you'd like to see.
21
+
22
+ ---
23
+
24
+ ## Example API
25
+
26
+ ```python
27
+ # Optional example usage
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Alternatives Considered
33
+
34
+ Describe any alternatives or workarounds you've tried.
35
+
36
+ ---
37
+
38
+ ## Additional Context
39
+
40
+ Add screenshots, architecture examples, or related tools if relevant.
@@ -4,8 +4,13 @@ on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
+ tags:
8
+ - "v*"
7
9
  pull_request:
8
10
 
11
+ permissions:
12
+ contents: read
13
+
9
14
  jobs:
10
15
  archetype:
11
16
  runs-on: ubuntu-latest
@@ -13,7 +18,11 @@ jobs:
13
18
  steps:
14
19
  # Pull down your repository code so CI can inspect it.
15
20
  - name: Checkout repository
16
- uses: actions/checkout@v4
21
+ uses: actions/checkout@v5
22
+ with:
23
+ token: ${{ github.token }}
24
+ ref: ${{ github.ref }}
25
+ fetch-depth: 0
17
26
 
18
27
  # Install Python 3.11 so the Archetype CLI can run.
19
28
  - name: Set up Python
@@ -28,9 +37,15 @@ jobs:
28
37
  pip install archetype-py
29
38
 
30
39
  # Run architecture rules defined in architecture.py.
31
- # This step exits non-zero on violations, which fails the workflow.
40
+ # If the installed Archetype supports GitHub annotations, emit inline
41
+ # PR annotations. Otherwise, fall back to standard checks.
32
42
  - name: Run architecture checks
33
- run: archetype check .
43
+ run: |
44
+ if archetype check --help | grep -q -- '--github-annotations'; then
45
+ archetype check . --github-annotations
46
+ else
47
+ archetype check .
48
+ fi
34
49
 
35
50
  # If your team already runs pytest in CI, you can skip this workflow file.
36
51
  # Archetype's pytest plugin runs architecture.py rules automatically during pytest.
@@ -4,8 +4,13 @@ on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
+ tags:
8
+ - "v*"
7
9
  pull_request:
8
10
 
11
+ permissions:
12
+ contents: read
13
+
9
14
  jobs:
10
15
  test:
11
16
  runs-on: ubuntu-latest
@@ -16,7 +21,11 @@ jobs:
16
21
 
17
22
  steps:
18
23
  - name: Checkout repository
19
- uses: actions/checkout@v4
24
+ uses: actions/checkout@v5
25
+ with:
26
+ token: ${{ github.token }}
27
+ ref: ${{ github.ref }}
28
+ fetch-depth: 0
20
29
 
21
30
  - name: Set up Python
22
31
  uses: actions/setup-python@v5
@@ -8,11 +8,17 @@ on:
8
8
  jobs:
9
9
  test:
10
10
  runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: read
11
13
 
12
14
  steps:
13
15
  # Checkout repository contents for test execution.
14
16
  - name: Checkout repository
15
- uses: actions/checkout@v4
17
+ uses: actions/checkout@v5
18
+ with:
19
+ token: ${{ github.token }}
20
+ ref: ${{ github.ref }}
21
+ fetch-depth: 0
16
22
 
17
23
  # Install Python runtime used for tests and packaging checks.
18
24
  - name: Set up Python
@@ -40,7 +46,11 @@ jobs:
40
46
  steps:
41
47
  # Checkout repository contents so the package can be built.
42
48
  - name: Checkout repository
43
- uses: actions/checkout@v4
49
+ uses: actions/checkout@v5
50
+ with:
51
+ token: ${{ github.token }}
52
+ ref: ${{ github.ref }}
53
+ fetch-depth: 0
44
54
 
45
55
  # Set up Python for building distribution artifacts.
46
56
  - name: Set up Python
@@ -32,8 +32,10 @@ htmlcov/
32
32
 
33
33
  # OS files
34
34
  .DS_Store
35
+ **/.DS_Store
35
36
 
36
37
  # Hatch
37
38
  .hatch/
38
39
  LAUNCH.md
39
40
  ROADMAP.md
41
+ .archetype_cache
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0 - 2026-05-26
4
+
5
+ ### Added
6
+ - Git pre-commit hook integration via `archetype install-hook`.
7
+ - GitHub PR inline annotations support with `--github-annotations`.
8
+ - Baseline mode for legacy repositories via `--write-baseline` and `--baseline`.
9
+ - Project config defaults through `archetype.toml`.
10
+ - Exclude paths support via CLI (`--exclude`) and config.
11
+ - Versioned JSON contract with explicit `schema_version`.
12
+ - Namespace package and monorepo layout support improvements.
13
+ - Changed-files mode with `--changed-from <git-ref>`.
14
+
15
+ ### Changed
16
+ - CI/release workflows expanded to cover new check and packaging behaviors.
17
+
3
18
  ## 0.1.0 - 2026-05-09
4
19
 
5
20
  ### Added
@@ -43,3 +58,22 @@
43
58
  - Summary line now includes warned and skipped counts
44
59
  - Reporter output organized by group when rules use group context manager
45
60
  - pytest plugin node IDs include group name when present
61
+
62
+
63
+ ## 0.2.3 — 2026-05-16
64
+
65
+ ### Added
66
+ - archetype init command for scaffolding
67
+ - --quiet flag to show only failures and warnings
68
+ - --format json flag for machine-readable output
69
+ - --no-cache flag to force fresh graph rebuild
70
+ - --group flag to run specific rule groups only
71
+ - must_not_depend_on for transitive dependency checking
72
+ - Import graph caching for faster repeat runs
73
+ - File path and line number in violation messages
74
+
75
+ ### Fixed
76
+ - src layout detection in archetype init
77
+ - Verbose violation messages now concise and scannable
78
+ - --quiet flag correctly filters JSON output
79
+ - Naming convention violation message format cleaned up
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ .
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
@@ -0,0 +1,101 @@
1
+ Metadata-Version: 2.4
2
+ Name: archetype-py
3
+ Version: 0.3.0
4
+ Summary: Enforce architectural rules as code. Catch structural violations before they merge.
5
+ Project-URL: Homepage, https://github.com/MossabArektout/archetype-py
6
+ Project-URL: Documentation, https://github.com/MossabArektout/archetype-py
7
+ Author-email: Mossab Arektout <mossabarektout2000@gmail.com>
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Software Development :: Quality Assurance
15
+ Requires-Python: >=3.11
16
+ Requires-Dist: click
17
+ Requires-Dist: networkx
18
+ Requires-Dist: rich
19
+ Provides-Extra: benchmarks
20
+ Provides-Extra: dev
21
+ Requires-Dist: hatch; extra == 'dev'
22
+ Requires-Dist: pytest; extra == 'dev'
23
+ Description-Content-Type: text/markdown
24
+
25
+ # archetype-py
26
+
27
+ Enforce architectural rules as code. Catch structural violations before they merge.
28
+
29
+ [GitHub Repository](https://github.com/MossabArektout/archetype-py)
30
+ [Documentation](https://github.com/MossabArektout/archetype-py#readme)
31
+
32
+ ## Why archetype-py
33
+
34
+ Most tooling checks formatting, typing, and tests, but not architecture drift.
35
+ `archetype-py` lets you codify structural boundaries and enforce them in local runs, CI, and pytest.
36
+
37
+ ## When to use / When not to use
38
+
39
+ Use archetype-py when:
40
+ - You want architecture rules to run automatically in CI and pytest.
41
+ - You need to prevent forbidden imports, layer violations, or import cycles.
42
+ - You are adopting architecture checks incrementally in a legacy codebase (baseline mode).
43
+
44
+ Do not use archetype-py when:
45
+ - You only need style/type checks (linters and type checkers are enough).
46
+ - Your project is a very small script with no meaningful module boundaries.
47
+ - You are looking for runtime policy enforcement instead of static import-graph checks.
48
+
49
+ ## Install
50
+
51
+ ```bash
52
+ pip install archetype-py
53
+ ```
54
+
55
+ ## Quick Start
56
+
57
+ ```bash
58
+ archetype init .
59
+ archetype check .
60
+ ```
61
+
62
+ Create an `architecture.py` file and define your rules:
63
+
64
+ ```python
65
+ from archetype import rule
66
+ from archetype.rules import layers
67
+
68
+ @rule("layers are ordered")
69
+ def layer_order() -> None:
70
+ layers(["myapp.api", "myapp.services", "myapp.db"]).are_ordered()
71
+ ```
72
+
73
+ ## Core Features
74
+
75
+ - Architecture rules for forbidden imports, allowlisted imports, and protected boundaries
76
+ - Transitive dependency checks with `must_not_depend_on`
77
+ - Layer order enforcement with `layers(...).are_ordered()`
78
+ - Import cycle detection with `no_cycles(...)`
79
+ - Rule decorators: `@rule`, `@warn`, `@skip`, `@since`
80
+ - Rule grouping via `group("...")` and targeted execution with `--group`
81
+ - `archetype init` scaffolding for starter `architecture.py`
82
+ - JSON and text reporting (`--format json|text`) with stable JSON contract versioning
83
+ - Quiet output mode (`--quiet`) for CI-friendly logs
84
+ - Import graph caching for faster repeated runs (`--cache`, `--no-cache`)
85
+ - Parallel execution control with `--workers`
86
+ - Baseline adoption for legacy codebases (`--write-baseline`, `--baseline`)
87
+ - Changed-files scope mode (`--changed-from <git-ref>`)
88
+ - GitHub Actions inline PR annotations (`--github-annotations`)
89
+ - Path exclusions via CLI (`--exclude`) and config
90
+ - Project config defaults through `archetype.toml`
91
+ - Git pre-commit hook installer (`archetype install-hook`)
92
+ - Project layout support for flat, `src/`, namespace packages (PEP 420), and monorepos
93
+ - CLI command and pytest plugin support for local and CI enforcement
94
+
95
+ ## CI Example
96
+
97
+ ```yaml
98
+ - run: archetype check .
99
+ ```
100
+
101
+ For full guides, examples, and release notes, use the GitHub README and changelog.
@@ -0,0 +1,77 @@
1
+ # archetype-py
2
+
3
+ Enforce architectural rules as code. Catch structural violations before they merge.
4
+
5
+ [GitHub Repository](https://github.com/MossabArektout/archetype-py)
6
+ [Documentation](https://github.com/MossabArektout/archetype-py#readme)
7
+
8
+ ## Why archetype-py
9
+
10
+ Most tooling checks formatting, typing, and tests, but not architecture drift.
11
+ `archetype-py` lets you codify structural boundaries and enforce them in local runs, CI, and pytest.
12
+
13
+ ## When to use / When not to use
14
+
15
+ Use archetype-py when:
16
+ - You want architecture rules to run automatically in CI and pytest.
17
+ - You need to prevent forbidden imports, layer violations, or import cycles.
18
+ - You are adopting architecture checks incrementally in a legacy codebase (baseline mode).
19
+
20
+ Do not use archetype-py when:
21
+ - You only need style/type checks (linters and type checkers are enough).
22
+ - Your project is a very small script with no meaningful module boundaries.
23
+ - You are looking for runtime policy enforcement instead of static import-graph checks.
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ pip install archetype-py
29
+ ```
30
+
31
+ ## Quick Start
32
+
33
+ ```bash
34
+ archetype init .
35
+ archetype check .
36
+ ```
37
+
38
+ Create an `architecture.py` file and define your rules:
39
+
40
+ ```python
41
+ from archetype import rule
42
+ from archetype.rules import layers
43
+
44
+ @rule("layers are ordered")
45
+ def layer_order() -> None:
46
+ layers(["myapp.api", "myapp.services", "myapp.db"]).are_ordered()
47
+ ```
48
+
49
+ ## Core Features
50
+
51
+ - Architecture rules for forbidden imports, allowlisted imports, and protected boundaries
52
+ - Transitive dependency checks with `must_not_depend_on`
53
+ - Layer order enforcement with `layers(...).are_ordered()`
54
+ - Import cycle detection with `no_cycles(...)`
55
+ - Rule decorators: `@rule`, `@warn`, `@skip`, `@since`
56
+ - Rule grouping via `group("...")` and targeted execution with `--group`
57
+ - `archetype init` scaffolding for starter `architecture.py`
58
+ - JSON and text reporting (`--format json|text`) with stable JSON contract versioning
59
+ - Quiet output mode (`--quiet`) for CI-friendly logs
60
+ - Import graph caching for faster repeated runs (`--cache`, `--no-cache`)
61
+ - Parallel execution control with `--workers`
62
+ - Baseline adoption for legacy codebases (`--write-baseline`, `--baseline`)
63
+ - Changed-files scope mode (`--changed-from <git-ref>`)
64
+ - GitHub Actions inline PR annotations (`--github-annotations`)
65
+ - Path exclusions via CLI (`--exclude`) and config
66
+ - Project config defaults through `archetype.toml`
67
+ - Git pre-commit hook installer (`archetype install-hook`)
68
+ - Project layout support for flat, `src/`, namespace packages (PEP 420), and monorepos
69
+ - CLI command and pytest plugin support for local and CI enforcement
70
+
71
+ ## CI Example
72
+
73
+ ```yaml
74
+ - run: archetype check .
75
+ ```
76
+
77
+ For full guides, examples, and release notes, use the GitHub README and changelog.