axion-framework 0.1.0a1__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 (67) hide show
  1. axion_framework-0.1.0a1/.github/workflows/cd.yml +68 -0
  2. axion_framework-0.1.0a1/.github/workflows/ci.yml +41 -0
  3. axion_framework-0.1.0a1/.gitignore +153 -0
  4. axion_framework-0.1.0a1/.python-version +1 -0
  5. axion_framework-0.1.0a1/LICENSE +21 -0
  6. axion_framework-0.1.0a1/Makefile +149 -0
  7. axion_framework-0.1.0a1/PKG-INFO +337 -0
  8. axion_framework-0.1.0a1/README.md +304 -0
  9. axion_framework-0.1.0a1/axion/__init__.py +16 -0
  10. axion_framework-0.1.0a1/axion/__init__.pyi +5 -0
  11. axion_framework-0.1.0a1/axion/cli.py +243 -0
  12. axion_framework-0.1.0a1/axion/config/__init__.py +54 -0
  13. axion_framework-0.1.0a1/axion/config/settings.py +139 -0
  14. axion_framework-0.1.0a1/axion/core/__init__.py +6 -0
  15. axion_framework-0.1.0a1/axion/core/__init__.pyi +4 -0
  16. axion_framework-0.1.0a1/axion/core/app.py +509 -0
  17. axion_framework-0.1.0a1/axion/core/app.pyi +40 -0
  18. axion_framework-0.1.0a1/axion/core/router.py +156 -0
  19. axion_framework-0.1.0a1/axion/core/router.pyi +52 -0
  20. axion_framework-0.1.0a1/axion/core/server.py +107 -0
  21. axion_framework-0.1.0a1/axion/db/__init__.py +25 -0
  22. axion_framework-0.1.0a1/axion/db/__init__.pyi +9 -0
  23. axion_framework-0.1.0a1/axion/db/base.py +22 -0
  24. axion_framework-0.1.0a1/axion/db/base.pyi +6 -0
  25. axion_framework-0.1.0a1/axion/db/database.py +107 -0
  26. axion_framework-0.1.0a1/axion/db/database.pyi +21 -0
  27. axion_framework-0.1.0a1/axion/db/middleware.py +36 -0
  28. axion_framework-0.1.0a1/axion/db/middleware.pyi +10 -0
  29. axion_framework-0.1.0a1/axion/http/__init__.py +6 -0
  30. axion_framework-0.1.0a1/axion/http/__init__.pyi +4 -0
  31. axion_framework-0.1.0a1/axion/http/connection.py +235 -0
  32. axion_framework-0.1.0a1/axion/http/parser.py +118 -0
  33. axion_framework-0.1.0a1/axion/http/request.py +45 -0
  34. axion_framework-0.1.0a1/axion/http/request.pyi +43 -0
  35. axion_framework-0.1.0a1/axion/http/response.py +173 -0
  36. axion_framework-0.1.0a1/axion/http/response.pyi +36 -0
  37. axion_framework-0.1.0a1/axion/middleware/__init__.py +125 -0
  38. axion_framework-0.1.0a1/axion/middleware/__init__.pyi +35 -0
  39. axion_framework-0.1.0a1/axion/middleware/cors.py +49 -0
  40. axion_framework-0.1.0a1/axion/middleware/cors.pyi +10 -0
  41. axion_framework-0.1.0a1/axion/middleware/csrf.py +66 -0
  42. axion_framework-0.1.0a1/axion/middleware/csrf.pyi +15 -0
  43. axion_framework-0.1.0a1/axion/serializer.py +159 -0
  44. axion_framework-0.1.0a1/axion/serializer.pyi +25 -0
  45. axion_framework-0.1.0a1/axion/types/__init__.py +5 -0
  46. axion_framework-0.1.0a1/axion/types/__init__.pyi +5 -0
  47. axion_framework-0.1.0a1/axion/types/request_method.py +7 -0
  48. axion_framework-0.1.0a1/axion/utils/__init__.py +5 -0
  49. axion_framework-0.1.0a1/axion/utils/extract_route_pattern.py +53 -0
  50. axion_framework-0.1.0a1/axion/views/errors/404.html +123 -0
  51. axion_framework-0.1.0a1/axion/views/errors/405.html +123 -0
  52. axion_framework-0.1.0a1/axion/views/errors/500.html +127 -0
  53. axion_framework-0.1.0a1/conftest.py +1 -0
  54. axion_framework-0.1.0a1/docs/README.md +72 -0
  55. axion_framework-0.1.0a1/docs/cli.md +81 -0
  56. axion_framework-0.1.0a1/docs/configuration.md +122 -0
  57. axion_framework-0.1.0a1/docs/cqrs.md +136 -0
  58. axion_framework-0.1.0a1/docs/database.md +174 -0
  59. axion_framework-0.1.0a1/docs/getting-started.md +142 -0
  60. axion_framework-0.1.0a1/docs/middleware.md +168 -0
  61. axion_framework-0.1.0a1/docs/request-response.md +141 -0
  62. axion_framework-0.1.0a1/docs/routing.md +171 -0
  63. axion_framework-0.1.0a1/docs/security.md +140 -0
  64. axion_framework-0.1.0a1/docs/serializers.md +128 -0
  65. axion_framework-0.1.0a1/docs/templates-static.md +90 -0
  66. axion_framework-0.1.0a1/pyproject.toml +218 -0
  67. axion_framework-0.1.0a1/stubtest.allowlist +9 -0
@@ -0,0 +1,68 @@
1
+ name: CD
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+
7
+ concurrency:
8
+ group: publish-${{ github.ref }}
9
+ cancel-in-progress: false
10
+
11
+ permissions:
12
+ contents: read
13
+ id-token: write
14
+
15
+ jobs:
16
+ publish:
17
+ name: Publish to PyPI (on version bump)
18
+ if: github.repository == 'sachin-acharya-projects/axion'
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Check out repository
22
+ uses: actions/checkout@v4
23
+
24
+ - name: Set up Python 3.12
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.12"
28
+
29
+ - name: Install build tooling
30
+ run: python -m pip install --upgrade hatchling packaging
31
+
32
+ - name: Compare current version against PyPI
33
+ id: version-gate
34
+ run: |
35
+ python - <<'EOF'
36
+ import json
37
+ import os
38
+ import tomllib
39
+ import urllib.request
40
+
41
+ from packaging.version import Version
42
+
43
+ with open("pyproject.toml", "rb") as f:
44
+ current = Version(tomllib.load(f)["project"]["version"])
45
+
46
+ latest = None
47
+ try:
48
+ with urllib.request.urlopen("https://pypi.org/pypi/axion-framework/json", timeout=30) as resp:
49
+ latest = Version(json.load(resp)["info"]["version"])
50
+ except Exception:
51
+ pass
52
+
53
+ publish = latest is None or current > latest
54
+ print(f"current={current} latest={latest} publish={publish}")
55
+ with open(os.environ["GITHUB_OUTPUT"], "a") as f:
56
+ f.write(f"publish={'true' if publish else 'false'}\n")
57
+ EOF
58
+
59
+ - name: Build distribution
60
+ if: steps.version-gate.outputs.publish == 'true'
61
+ run: python -m hatchling build
62
+
63
+ - name: Publish to PyPI (trusted publishing)
64
+ if: steps.version-gate.outputs.publish == 'true'
65
+ uses: pypa/gh-action-pypi-publish@release/v1
66
+ with:
67
+ packages-dir: dist/
68
+ attestations: true
@@ -0,0 +1,41 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+
7
+ concurrency:
8
+ group: ci-${{ github.ref }}
9
+ cancel-in-progress: true
10
+
11
+ jobs:
12
+ quality:
13
+ name: Quality Gates
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - name: Check out repository
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Set up Python 3.12
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: "3.12"
23
+ cache: pip
24
+
25
+ - name: Install dependencies
26
+ run: python -m pip install -e ".[dev]"
27
+
28
+ - name: Lint with ruff
29
+ run: ruff check .
30
+
31
+ - name: Type check with mypy
32
+ run: mypy .
33
+
34
+ - name: Verify stubs with mypy.stubtest
35
+ run: python -m mypy.stubtest axion --allowlist stubtest.allowlist
36
+
37
+ - name: Run test suite
38
+ run: python -m pytest
39
+
40
+ - name: Smoke test package build
41
+ run: python -m hatchling build
@@ -0,0 +1,153 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so may as well filter them.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ .ruff_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the Python version is
88
+ # usually managed by the tool (like poetry) and not by the user.
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or even
95
+ # crash on other platforms.
96
+ # Pipfile.lock
97
+
98
+ # poetry
99
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
100
+ # poetry.lock
101
+
102
+ # pdm
103
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
104
+ # pdm.lock
105
+
106
+ # PEP 582; used by e.g. github.com/pdm-project/pdm
107
+ __pypackages__/
108
+
109
+ # Celery stuff
110
+ celerybeat-schedule
111
+ celerybeat.pid
112
+
113
+ # SageMath parsed files
114
+ *.sage.py
115
+
116
+ # Environments
117
+ .env
118
+ .venv
119
+ env/
120
+ venv/
121
+ ENV/
122
+ env.bak/
123
+ venv.bak/
124
+
125
+ # Spyder project settings
126
+ .spyderproject
127
+ .spyproject
128
+
129
+ # Rope project settings
130
+ .ropeproject
131
+
132
+ # mkdocs documentation
133
+ /site
134
+
135
+ # mypy
136
+ .mypy_cache/
137
+ .dmypy.json
138
+ dmypy.json
139
+
140
+ # Pyre type checker
141
+ .pyre/
142
+
143
+ # pytype static analyzer
144
+ .pytype/
145
+
146
+ # Cython debug symbols
147
+ cython_debug/
148
+
149
+ # PyCharm
150
+ .idea/
151
+
152
+ # VS Code
153
+ .vscode/
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sachin Acharya
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.
@@ -0,0 +1,149 @@
1
+ # Project variables
2
+ PROJECT_NAME := axion
3
+
4
+ # Python environment variables
5
+ PYTHON := python3
6
+ VENV := .venv
7
+ BIN := $(VENV)/bin
8
+
9
+ # Bins
10
+ PIP := $(BIN)/pip
11
+ RUFF := $(BIN)/ruff
12
+ MYPY := $(BIN)/mypy
13
+ TWINE := $(BIN)/twine
14
+ HATCH := $(BIN)/hatch
15
+
16
+ # Terminal output
17
+ GREEN := \033[32m
18
+ YELLOW := \033[33m
19
+ BLUE := \033[34m
20
+ WHITE := \033[37m
21
+ CYAN := \033[36m
22
+ BOLD := \033[1m
23
+ RESET := \033[0m
24
+
25
+ INFO := $(BLUE)➤ $(RESET)$(CYAN)
26
+ SUCCESS := $(GREEN)$(BOLD)➤ $(RESET)$(GREEN)
27
+ WARN := $(YELLOW)➤ $(RESET)$(WHITE)
28
+
29
+ # Shell Configuration
30
+ SHELL := /bin/bash
31
+ .SHELLFLAGS := -eu -o pipefail -c
32
+ .ONESHELL:
33
+
34
+ # Help
35
+ .PHONY: help
36
+
37
+ help: ## Show this help message
38
+ @printf "$(BOLD)$(CYAN)'$(PROJECT_NAME)' Development Toolkit$(RESET)\n"
39
+ @echo ""
40
+ @echo "A streamlined Makefile for managing development,"
41
+ @echo "quality checks, builds, and package publishing."
42
+ @echo ""
43
+
44
+ @printf "$(BOLD)Usage$(RESET)\n"
45
+ @printf " ${YELLOW}make${RESET} ${GREEN}<target>${RESET}\n"
46
+ @echo ""
47
+
48
+ @printf "$(BOLD)Common Commands$(RESET)\n"
49
+ @printf " ${YELLOW}make install${RESET} Install development dependencies\n"
50
+ @printf " ${YELLOW}make lint${RESET} Run static analysis\n"
51
+ @printf " ${YELLOW}make format${RESET} Format source code\n"
52
+ @printf " ${YELLOW}make check${RESET} Run all quality checks\n"
53
+ @printf " ${YELLOW}make build${RESET} Build distributable package\n"
54
+ @echo ""
55
+
56
+ @printf "$(BOLD)Available Targets$(RESET)\n"
57
+
58
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
59
+ awk 'BEGIN {FS = ":.*?## "}; { \
60
+ printf " ${CYAN}%-20s${RESET} ${WHITE}%s${RESET}\n", $$1, $$2 \
61
+ }'
62
+
63
+ @echo ""
64
+ @printf "$(GREEN)Tip:${RESET} Use ${YELLOW}make <target>${RESET} to execute a task.\n"
65
+ @echo ""
66
+
67
+ # Virtual Environment
68
+ .PHONY: venv env
69
+ venv: ## Create Python virtual environment
70
+ @printf "${INFO}Creating virtual environment...${RESET}\n"
71
+
72
+ @if [ -d "$(VENV)" ]; then \
73
+ printf "${WARN}Virtual environment already exists at '$(VENV)'.${RESET}\n"; \
74
+ else \
75
+ $(PYTHON) -m venv $(VENV); \
76
+ printf "${SUCCESS}Virtual environment created.${RESET}\n"; \
77
+ fi
78
+
79
+ env: venv ## Alias for venv
80
+
81
+ # Installation
82
+ .PHONY: install
83
+ install: venv ## Install development dependencies
84
+ @printf "${INFO}Installing development dependencies...${RESET}\n"
85
+ $(PIP) install --upgrade pip
86
+ $(PIP) install -e ".[dev]"
87
+ @printf "${SUCCESS}Installation complete.${RESET}\n"
88
+
89
+ # Linting & Formatting
90
+ .PHONY: lint
91
+ lint: ## Run ruff linting
92
+ @printf "${INFO}Running ruff linting...${RESET}\n"
93
+ $(RUFF) check .
94
+ @printf "${SUCCESS}Linting complete.${RESET}\n"
95
+
96
+ .PHONY: format
97
+ format: ## Run ruff formatting
98
+ @printf "${INFO}Running ruff formatting...${RESET}\n"
99
+ $(RUFF) format .
100
+ $(RUFF) check --fix --unsafe-fixes .
101
+ @printf "${SUCCESS}Formatting complete.${RESET}\n"
102
+
103
+
104
+ .PHONY: typecheck
105
+ typecheck: ## Run mypy type checking
106
+ @printf "${INFO}Running mypy type checking...${RESET}\n"
107
+ $(MYPY) .
108
+ @printf "${SUCCESS}Type checking complete.${RESET}\n"
109
+
110
+ .PHONY: stubtest
111
+ stubtest: ## Verify .pyi stubs against the runtime implementation
112
+ @printf "${INFO}Running mypy.stubtest...${RESET}\n"
113
+ $(BIN)/python -m mypy.stubtest axion --allowlist stubtest.allowlist
114
+ @printf "${SUCCESS}Stubtest complete.${RESET}\n"
115
+
116
+ .PHONY: test
117
+ test: ## Run the test suite
118
+ @printf "${INFO}Running tests...${RESET}\n"
119
+ $(BIN)/python -m pytest
120
+ @printf "${SUCCESS}Tests complete.${RESET}\n"
121
+
122
+ # Build & Publish
123
+ .PHONY: build
124
+ build: ## Build project
125
+ @printf "${INFO}Building project...${RESET}\n"
126
+ rm -rf dist/
127
+ $(HATCH) build
128
+ @printf "${SUCCESS}Build complete.${RESET}\n"
129
+
130
+ .PHONY: publish
131
+ publish: build ## Build and publish to PyPI
132
+ @printf "${INFO}Publishing to PyPI...${RESET}\n"
133
+ $(TWINE) upload dist/*
134
+ @printf "${SUCCESS}Publish complete.${RESET}\n"
135
+
136
+ # Cleanup
137
+ .PHONY: clean
138
+ clean: ## Clean build and cache files
139
+ @printf "${INFO}Cleaning build and cache files...${RESET}\n"
140
+ rm -rf build/
141
+ rm -rf dist/
142
+ rm -rf *.egg-info
143
+ find . -type d -name "__pycache__" -exec rm -rf {} +
144
+ find . -type d -name ".ruff_cache" -exec rm -rf {} +
145
+ find . -type d -name ".mypy_cache" -exec rm -rf {} +
146
+ @printf "${SUCCESS}Cleanup complete.${RESET}\n"
147
+
148
+ # Default
149
+ .DEFAULT_GOAL := help