pytmodules 0.1.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 (42) hide show
  1. pytmodules-0.1.0/.gitignore +61 -0
  2. pytmodules-0.1.0/CHANGELOG.md +50 -0
  3. pytmodules-0.1.0/CONTRIBUTING.md +124 -0
  4. pytmodules-0.1.0/LICENSE +21 -0
  5. pytmodules-0.1.0/PKG-INFO +1087 -0
  6. pytmodules-0.1.0/README.md +1041 -0
  7. pytmodules-0.1.0/SECURITY.md +36 -0
  8. pytmodules-0.1.0/docs/django_example.py +146 -0
  9. pytmodules-0.1.0/pymodules/__init__.py +55 -0
  10. pytmodules-0.1.0/pymodules/commands/__init__.py +1 -0
  11. pytmodules-0.1.0/pymodules/commands/cli.py +513 -0
  12. pytmodules-0.1.0/pymodules/detector.py +293 -0
  13. pytmodules-0.1.0/pymodules/exceptions.py +28 -0
  14. pytmodules-0.1.0/pymodules/generator.py +834 -0
  15. pytmodules-0.1.0/pymodules/integrations/__init__.py +1 -0
  16. pytmodules-0.1.0/pymodules/integrations/django.py +315 -0
  17. pytmodules-0.1.0/pymodules/integrations/fastapi.py +68 -0
  18. pytmodules-0.1.0/pymodules/integrations/flask.py +71 -0
  19. pytmodules-0.1.0/pymodules/management/__init__.py +0 -0
  20. pytmodules-0.1.0/pymodules/management/_base.py +27 -0
  21. pytmodules-0.1.0/pymodules/management/commands/__init__.py +0 -0
  22. pytmodules-0.1.0/pymodules/management/commands/module_delete.py +46 -0
  23. pytmodules-0.1.0/pymodules/management/commands/module_disable.py +27 -0
  24. pytmodules-0.1.0/pymodules/management/commands/module_enable.py +27 -0
  25. pytmodules-0.1.0/pymodules/management/commands/module_list.py +51 -0
  26. pytmodules-0.1.0/pymodules/management/commands/module_make.py +99 -0
  27. pytmodules-0.1.0/pymodules/management/commands/module_make_api_urls.py +174 -0
  28. pytmodules-0.1.0/pymodules/management/commands/module_make_migration.py +52 -0
  29. pytmodules-0.1.0/pymodules/management/commands/module_make_model.py +167 -0
  30. pytmodules-0.1.0/pymodules/management/commands/module_make_model_migration.py +80 -0
  31. pytmodules-0.1.0/pymodules/management/commands/module_make_serializer.py +125 -0
  32. pytmodules-0.1.0/pymodules/management/commands/module_make_viewset.py +153 -0
  33. pytmodules-0.1.0/pymodules/management/commands/module_migrate.py +63 -0
  34. pytmodules-0.1.0/pymodules/management/commands/module_publish.py +68 -0
  35. pytmodules-0.1.0/pymodules/management/commands/module_show.py +38 -0
  36. pytmodules-0.1.0/pymodules/module.py +125 -0
  37. pytmodules-0.1.0/pymodules/provider.py +93 -0
  38. pytmodules-0.1.0/pymodules/registry.py +261 -0
  39. pytmodules-0.1.0/pyproject.toml +78 -0
  40. pytmodules-0.1.0/tests/__init__.py +0 -0
  41. pytmodules-0.1.0/tests/test_detector.py +110 -0
  42. pytmodules-0.1.0/tests/test_pymodules.py +427 -0
@@ -0,0 +1,61 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Distribution / packaging
7
+ .Python
8
+ build/
9
+ dist/
10
+ downloads/
11
+ .eggs/
12
+ *.egg-info/
13
+ *.egg
14
+ MANIFEST
15
+ pip-wheel-metadata/
16
+
17
+ # Unit test / coverage reports
18
+ .pytest_cache/
19
+ .coverage
20
+ .coverage.*
21
+ coverage.xml
22
+ htmlcov/
23
+ .hypothesis/
24
+ .tox/
25
+ .nox/
26
+
27
+ # Type checkers / linters caches
28
+ .mypy_cache/
29
+ .pyre/
30
+ .pytype/
31
+ .ruff_cache/
32
+
33
+ # Virtual environments
34
+ .venv/
35
+ venv/
36
+ env/
37
+ ENV/
38
+ .pymodenv/
39
+ .python-version
40
+
41
+ # IDE / editor
42
+ .vscode/
43
+ .idea/
44
+ *.swp
45
+ *.swo
46
+ *~
47
+
48
+ # OS files
49
+ .DS_Store
50
+
51
+ # Local docs builds
52
+ docs/_build/
53
+
54
+ # Jupyter
55
+ .ipynb_checkpoints/
56
+
57
+ # Logs
58
+ *.log
59
+
60
+ # Misc local/temp artifacts
61
+ tmp/
@@ -0,0 +1,50 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ---
9
+
10
+ ## [Unreleased]
11
+
12
+ ---
13
+
14
+ ## [0.1.0] - 2026-03-19
15
+
16
+ ### Added
17
+
18
+ - Framework-agnostic `ModuleRegistry`, `Module`, and `ServiceProvider` core
19
+ - Auto-detection of Django, FastAPI, Flask from your project environment
20
+ - Auto-selection of the `django-api` scaffold preset when Django REST Framework is detected
21
+ - `pymodules` CLI: `init`, `make`, `list`, `enable`, `disable`, `show`, `delete`, `publish`, `detect`, `presets`
22
+ - Django `manage.py` integration commands:
23
+ - `module_make` — scaffold a new module
24
+ - `module_list` — list all modules and their status
25
+ - `module_enable` / `module_disable` — toggle modules at runtime
26
+ - `module_show` — inspect a module's manifest
27
+ - `module_delete` — remove a module from disk
28
+ - `module_publish` — publish module assets to the host app
29
+ - `module_make_model` — create a lightweight, non-bloated model file
30
+ - `module_make_serializer` — create Django REST Framework serializers for a model
31
+ - `module_make_viewset` — create Django REST Framework viewsets for a model
32
+ - `module_make_api_urls` — create or extend router-based API URL wiring for a module
33
+ - `module_make_model_migration` — create a migration targeting a specific model
34
+ - `module_make_migration` — run `makemigrations` scoped to one module
35
+ - `module_migrate` — run `migrate` scoped to one module (or all)
36
+ - Eight scaffold presets: `plain`, `default`, `django`, `django-api`, `fastapi`, `fastapi-crud`, `flask`, `flask-api`
37
+ - Per-project configuration via `pymodules.toml`
38
+ - `module.json` manifest with versioning, enable/disable, provider registration, and dependency declarations
39
+ - Service Provider pattern with two-phase `register` → `boot` lifecycle
40
+ - Module dependency declarations (`requires`) with topological boot ordering
41
+ - Circular and missing dependency detection with actionable error messages
42
+ - Module-level settings merged into Django `settings` via `collect_settings()`
43
+ - Module-level URL routing for Django, Flask, and FastAPI
44
+ - Module-level Django API routing via `api/urls.py` discovery and mounting
45
+ - Module-level Django migrations with `MIGRATION_MODULES` auto-configuration
46
+ - Asset publishing system
47
+ - Python 3.10, 3.11, 3.12, 3.13 support
48
+
49
+ [Unreleased]: https://github.com/tomcroot/pymodules/compare/v0.1.0...HEAD
50
+ [0.1.0]: https://github.com/tomcroot/pymodules/releases/tag/v0.1.0
@@ -0,0 +1,124 @@
1
+ # Contributing to pymodules
2
+
3
+ Thank you for your interest in contributing! This document covers how to set up your development environment, run tests, and submit changes.
4
+
5
+ ---
6
+
7
+ ## Before You Start
8
+
9
+ Please **open an issue first** to discuss what you would like to change. This avoids wasted effort if the direction doesn't align with the project's goals.
10
+
11
+ ---
12
+
13
+ ## Development Setup
14
+
15
+ **Requirements:** Python 3.10+, Git
16
+
17
+ ```bash
18
+ # 1. Fork and clone
19
+ git clone https://github.com/tomcroot/pymodules
20
+ cd pymodules
21
+
22
+ # 2. Create a virtual environment
23
+ python -m venv .venv
24
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
25
+
26
+ # 3. Install in editable mode with all dev dependencies
27
+ pip install -e ".[dev]"
28
+
29
+ # 4. Verify everything works
30
+ pytest
31
+ ```
32
+
33
+ ---
34
+
35
+ ## Running Tests
36
+
37
+ ```bash
38
+ # All tests
39
+ pytest
40
+
41
+ # With coverage
42
+ pytest --cov=pymodules --cov-report=term-missing
43
+
44
+ # Single test file
45
+ pytest tests/test_pymodules.py -v
46
+ ```
47
+
48
+ The test suite must pass on all supported Python versions (3.10–3.13) before a PR is merged. CI runs automatically on every push and pull request.
49
+
50
+ ---
51
+
52
+ ## Branch Naming
53
+
54
+ | Type | Pattern | Example |
55
+ |------|---------|---------|
56
+ | Feature | `feat/<short-description>` | `feat/module-groups` |
57
+ | Bug fix | `fix/<short-description>` | `fix/django-routes-import` |
58
+ | Documentation | `docs/<short-description>` | `docs/fastapi-guide` |
59
+ | Chore / tooling | `chore/<short-description>` | `chore/update-ci` |
60
+
61
+ ---
62
+
63
+ ## Commit Messages
64
+
65
+ Follow [Conventional Commits](https://www.conventionalcommits.org/):
66
+
67
+ ```
68
+ feat: add module_make_view command
69
+ fix: correct provider boot order when dependency missing
70
+ docs: update Django integration example
71
+ chore: bump pytest to 8.0
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Pull Request Requirements
77
+
78
+ - [ ] Tests pass (`pytest`)
79
+ - [ ] New behaviour is covered by tests
80
+ - [ ] `CHANGELOG.md` updated under `[Unreleased]`
81
+ - [ ] No `yourname` / placeholder text in any file
82
+ - [ ] PR description explains what changed and why
83
+
84
+ ---
85
+
86
+ ## Project Structure
87
+
88
+ ```
89
+ pymodules/
90
+ ├── __init__.py — public API
91
+ ├── module.py — Module model
92
+ ├── registry.py — ModuleRegistry (boot orchestration)
93
+ ├── generator.py — scaffold presets
94
+ ├── provider.py — ServiceProvider base
95
+ ├── detector.py — framework auto-detection
96
+ ├── exceptions.py — custom exception hierarchy
97
+ ├── commands/ — pymodules CLI (Click)
98
+ ├── integrations/ — Django / Flask / FastAPI adapters
99
+ └── management/ — Django manage.py commands
100
+ └── commands/
101
+ ├── module_make_model.py
102
+ ├── module_make_model_migration.py
103
+ ├── module_make_migration.py
104
+ └── module_migrate.py
105
+ tests/
106
+ └── test_pymodules.py
107
+ ```
108
+
109
+ ---
110
+
111
+ ## Reporting Bugs
112
+
113
+ Open a GitHub issue and include:
114
+
115
+ - Python version (`python --version`)
116
+ - pymodules version
117
+ - Minimal reproduction case
118
+ - Full traceback
119
+
120
+ ---
121
+
122
+ ## License
123
+
124
+ By contributing you agree that your contributions will be licensed under the [MIT License](LICENSE).
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tomcroot
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.