You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit efa4be9
Browse filesBrowse the repository at this point in the historyBrowse files
## Description
Release `v0.1.0-beta.8` aggregating database write/search performance
optimizations, background execution isolation, soft delete lifecycle
capabilities, complete interactive CLI revitalization, test suite
modernization, and updated packaging/documentation metadata.
### Summary of Changes:
- **Database Performance & Optimization**:
- Optimized bulk repository methods (`create_multi`, `update_multi`,
`delete_multi`) in `WriteRepositoryMixin` using native SQLAlchemy 2.0
`RETURNING` clauses and direct DBAPI `executemany` execution,
eliminating N+1 select queries and ORM hydration overhead.
- **Background Execution & Dependency Injection**:
- Introduced `background_scope` async context manager for isolated IoC
containers, dedicated `AsyncSession` instances, and context cloning.
- Implemented `@background_task` decorator supporting sync (thread pool
offloading) and async functions with automatic parameter auto-wiring.
- Exported background utilities publicly via `zcore.kernel`.
- **Advanced Search & Filtering**:
- Added new search operators: `startswith`, `endswith`, `contains`
(case-insensitive substring & collection matching), and `between` (range
filtering with type coercion).
- Introduced configurable `__max_search_depth__` on SQLAlchemy models to
dynamically enforce inclusion relation path limits.
- **Soft Delete Lifecycle**:
- Added `SoftDeleteMixin` providing `deleted_at` timestamp tracking,
`is_deleted` property, `soft_delete()` and `restore()` methods.
- Integrated `scope_query()` checks across `BaseRepository.exist()` and
query execution.
- **Interactive CLI & Scaffolding Workflow**:
- Revamped `zc` CLI with an interactive Questionary/Rich dashboard,
workspace detection, and automated `.venv` creation via `uv`/`pip`.
- Added multi-database configuration support (`SQLite`, `PostgreSQL`,
`MySQL`).
- Added granular domain scaffolding modes (`Full Boilerplate`, `Clean /
Blank`, `Custom`).
- Fixed scaffolded repository and service templates to align with
single-generic class signatures (`BaseRepository[Model]`,
`BaseService[Model]`).
- **Test Suite Modernization**:
- Upgraded test suite type annotations to PEP 585/604 built-in generics
and `collections.abc` types.
- Reorganized imports, improved ClassVar test-class typings, and cleaned
up context managers.
- **Metadata, Packaging & Documentation**:
- Added maintainer metadata and Python 3.13 classifier support.
- Added dedicated dependency groups for `postgres`, `mysql`, and `dev`.
- Comprehensive documentation overhaul across `README.md`,
`CONTRIBUTING.md`, `SECURITY.md`, and `CODE_OF_CONDUCT.md`.
## Type of change
- [x] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [x] Refactoring (architectural or code cleanup with no functional
changes)
- [x] Documentation update
## How Has This Been Tested?
- [x] Unit/Integration tests (`hatch test`)
- Full test suite passed with 100% success rate across all domains
(`test_db_lifecycle`, `test_repository`, `test_search`,
`test_soft_delete`, `test_di`, `test_cli`, `test_web`, `test_security`,
etc.).
- [x] Static type check passing (`mypy src/`)
## Checklist:
- [x] My code follows the style guidelines and architectural rules of
this project
- [x] I have performed a self-review of my own code
- [x] My changes pass strict static type analysis (`mypy src/` generates
no warnings)
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have updated the documentation in `zcore-docs` if applicable
- [x] My changes generate no new runtime warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+33-19Lines changed: 33 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,19 +61,30 @@ pip install -e ".[all,dev]"
61
61
We aim for high test coverage on core architectural units. ZCore uses `pytest` and `pytest-asyncio` for asynchronous test suites.
62
62
63
63
### Test Architecture
64
-
ZCore's codebase is highly modular. To ensure that components like the Kernel, Plugins, Dependency Injection (DI), Unit of Work (UOW), Router, and Middleware interact correctly, we organize our tests as follows:
64
+
ZCore's tests are organized modularly across architectural domains:
65
65
66
66
```text
67
67
tests/
68
-
├── unit/ # Tests for isolated, single architectural units with mocks
69
-
│ ├── test_repository.py
70
-
│ └── test_zchema.py
71
-
├── integration/ # Tests verifying interactions between modules
72
-
│ ├── test_kernel_startup.py
73
-
│ ├── test_plugin_loading.py
74
-
│ └── test_request_scope.py
75
-
└── e2e/ # Full end-to-end request/response flows using TestClient
76
-
└── test_crud_flow.py
68
+
├── test_cache.py
69
+
├── test_cli.py
70
+
├── test_context.py
71
+
├── test_db_lifecycle.py
72
+
├── test_di.py
73
+
├── test_events.py
74
+
├── test_exceptions.py
75
+
├── test_kernel.py
76
+
├── test_logging.py
77
+
├── test_pagination.py
78
+
├── test_repository.py
79
+
├── test_search.py
80
+
├── test_security.py
81
+
├── test_service.py
82
+
├── test_soft_delete.py
83
+
├── test_storage.py
84
+
├── test_streams.py
85
+
├── test_testing_subsystem.py
86
+
├── test_utils.py
87
+
└── test_web.py
77
88
```
78
89
79
90
### Running Tests Locally
@@ -84,11 +95,11 @@ pytest
84
95
85
96
If you prefer to run tests inside Hatch-isolated environments:
86
97
```bash
87
-
hatch run test
98
+
hatch test
88
99
```
89
100
90
101
### Writing Tests
91
-
-**Asynchronous Tests:** Ensure your async tests are decorated with `@pytest.mark.asyncio`.
102
+
-**Asynchronous Tests:** Ensure your async tests are decorated with `@pytest.mark.anyio` or `@pytest.mark.asyncio`.
92
103
-**Isolation:** Tests should not leave behind lingering SQLite databases, active sessions, or running background threads.
93
104
-**Mocks:** When writing tests that require external services like Redis, implement mock fallbacks where appropriate to ensure the test suite can run fully offline.
94
105
@@ -107,8 +118,8 @@ mypy src/
107
118
### 2. Linting & Formatting
108
119
Ensure your code is clean, PEP-8 compliant, and structured consistently. We recommend using `ruff` for formatting and linting:
109
120
```bash
110
-
ruff check src/
111
-
ruff format src/
121
+
ruff check .
122
+
ruff format --check .
112
123
```
113
124
114
125
---
@@ -124,14 +135,17 @@ ZCore uses the **Conventional Commits** specification to automate our changelog
124
135
Common types include:
125
136
-`feat`: A new feature (corresponds to a minor version bump).
126
137
-`fix`: A bug fix (corresponds to a patch version bump).
138
+
-`perf`: A code change that improves performance.
127
139
-`docs`: Documentation updates.
140
+
-`style`: Changes that do not affect the meaning of the code (white-space, formatting, etc.).
128
141
-`refactor`: Code changes that neither fix a bug nor add a feature.
129
142
-`test`: Adding or correcting tests.
143
+
-`build`: Changes that affect the build system or external dependencies.
130
144
-`ci`: Changes to our CI/CD workflows or scripts.
131
145
132
146
*Examples:*
133
-
-`feat(di): add redis plugin support`
134
-
-`fix(uow): resolve transaction rollback issue on async commit`
147
+
-`feat(di): add background_scope and background_task decorator`
148
+
-`perf(db): optimize create_multi using insert returning clause`
135
149
-`docs(zchema): update guide for dynamic schema pruning`
136
150
137
151
---
@@ -148,12 +162,12 @@ flowchart LR
148
162
D --> E[Submit PR]
149
163
```
150
164
151
-
1.**Branch Naming:** Use descriptive branch names (e.g., `feature/add-s3-provider` or `bugfix/fix-uow-flush`).
165
+
1.**Branch Naming:** Use descriptive branch names (e.g., `feat/add-s3-provider` or `fix/uow-flush-isolation`).
152
166
2.**Atomic Commits:** Keep your commits focused on single logical changes and adhere to the conventional commits schema.
153
167
3.**Documentation:** If you are adding a new feature or modifying an existing protocol, you **must** update the corresponding documentation page under the `docs/` folder.
154
168
155
169
### 🛡️ CI/CD & Branch Protection
156
-
Our repository has strict branch protection rules configured on `master` and `develop`.
170
+
Our repository has strict branch protection rules configured on `main` and `develop`.
157
171
-**Mandatory CI Checks:** Your Pull Request cannot be merged unless all status checks (Linting with Ruff, Type-checking with Mypy, and Test Suites with Pytest) pass successfully in our GitHub Actions pipeline.
158
172
-**No Direct Pushes:** All code changes must go through a Pull Request. Direct pushes to protected branches are blocked.
159
173
@@ -164,4 +178,4 @@ Our repository has strict branch protection rules configured on `master` and `de
164
178
By contributing to ZCore, you agree that your contributions will be licensed under the project's **Apache License 2.0**.
165
179
166
180
-**No CLA Required:** We do not currently require a signed Contributor License Agreement (CLA) for individual contributions.
167
-
-**Certificate of Origin:** By submitting a Pull Request, you assert that you have the right to submit this code and that it conforms to an open-source contribution under the Apache 2.0 terms.
181
+
-**Certificate of Origin:** By submitting a Pull Request, you assert that you have the right to submit this code and that it conforms to an open-source contribution under the Apache 2.0 terms.
Stop writing boilerplate. The `zc` CLI generates consistent, production-ready domain modules and environment templates with a single command.
222
+
The `zc` CLI gives you a rich, interactive Terminal User Interface (TUI) powered by Questionary and Rich. It features:
223
+
224
+
***Workspace & Context Awareness:** Detects whether you are inside an active project, in a root workspace containing multiple services, or starting fresh.
225
+
***Automated `uv` / `.venv` Setup:** Initializes isolated virtual environments and installs dependencies automatically using `uv` (recommended) or standard `pip`.
226
+
***Multi-Engine Driver Bootstrapping:** Configures SQLite (`aiosqlite`), PostgreSQL (`asyncpg`), or MySQL (`aiomysql`) in `.env` and `requirements.txt` out-of-the-box.
227
+
***Granular Architectural Scaffolding:** Generates modular domain apps in 3 modes (*Full Boilerplate*, *Clean/Blank*, or *Custom Layer Selection* across Models, Schemas, Repositories, Services, Routers, Plugins, and Pytest suites).
228
+
229
+
```text
230
+
$ zc
231
+
232
+
⚡ ZCore Framework v0.1.0-Beta • Modern Modular Monolith
233
+
FastAPI • SQLAlchemy 2.0 • Pydantic V2
234
+
235
+
? What framework task would you like to perform? 📦 init — Scaffold a new full ZCore project
236
+
┌ Initialize New ZCore Project
237
+
│
238
+
? Project directory name: core_api
239
+
? Select primary database driver: PostgreSQL (asyncpg) — Production Ready
240
+
? Initialize virtual environment (.venv) and install dependencies? Yes (uv)
@@ -245,7 +275,7 @@ Contributions are welcome! Please read our guidelines before submitting a PR.
245
275
246
276
-**Issues:** Bug reports and feature requests via [GitHub Issues](https://github.com/Baseryn/zcore/issues)
247
277
-**PRs:** Open a pull request with a clear description of the change
248
-
-**Local Setup:**`pip install -e ".[all]"` and run `hatch test` to verify
278
+
-**Local Setup:**`pip install -e ".[all,dev]"` and run `hatch test` to verify
249
279
250
280
---
251
281
@@ -257,5 +287,5 @@ See [LICENSE](https://github.com/Baseryn/zcore/blob/master/LICENSE) for details.
257
287
---
258
288
259
289
<palign="center">
260
-
<sub>Built with ☕ and architectural rigor by <ahref="https://github.com/alialfostovar">Ali Alf Ostovar</a>.</sub>
290
+
<sub>Built with ☕ and architectural rigor by <ahref="https://github.com/alialfostovar">Ali Alf Ostovar</a> / <ahref="https://github.com/Baseryn">Baseryn</a>.</sub>
Copy file name to clipboardExpand all lines: SECURITY.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Security Policy
2
2
3
-
We take the security of ZCore, and the applications built on top of it, extremely seriously. Security is a core pillar of ZCore's design philosophy, integrated deeply into its architecture [security/jwt.py, security/hashing.py] rather than treated as an afterthought.
3
+
We take the security of ZCore, and the applications built on top of it, extremely seriously. Security is a core pillar of ZCore's design philosophy, integrated deeply into its architecture (`zcore/security/security.py`, `zcore/web/projection.py`) rather than treated as an afterthought.
4
4
5
5
If you believe you have found a security vulnerability in ZCore, please read this document to learn how to report it responsibly.
6
6
@@ -87,9 +87,9 @@ The following are generally **not considered** security vulnerabilities in ZCore
87
87
88
88
## Hardened Defaults in ZCore
89
89
90
-
ZCore is built with strict, "secure-by-default" configurations[security/jwt.py, storage/local.py]:
91
-
-**Production Secret Guard:** The framework will raise a fatal traceback and refuse to start in a production environment if the default fallback `SECRET_KEY` is detected [security/jwt.py].
92
-
-**Argon2id default configuration:** We enforce high-entropy password hashing out-of-the-box [security/hashing.py].
93
-
-**Path Traversal Protection:** The local storage provider strictly verifies resolved filesystem paths before running write or unlink operations [storage/local.py].
90
+
ZCore is built with strict, "secure-by-default" configurations:
91
+
-**Production Secret Guard:** The framework will raise a fatal traceback and refuse to start in a production environment if the default fallback `SECRET_KEY` is detected (`zcore/security/security.py`).
92
+
-**Argon2id default configuration:** We enforce high-entropy password hashing out-of-the-box (`zcore/security/security.py`).
93
+
-**Path Traversal Protection:** The local storage provider strictly verifies resolved filesystem paths before running write or unlink operations (`zcore/storage/local.py`).
94
94
95
95
*Note: ZCore only fails-fast (crashes) on fatal security configurations. Missing optional configuration elements (e.g., optional caching backends) will only raise non-fatal warnings.*
0 commit comments