-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(core): Migrate to namespace packages and enhance backend storage #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Bump version to 1.0.0.dev12 - Enrich version control details with Python support, branch management, and CHANGELOG - Add corresponding continuous integration workflows - Include local multi-virtual environment directory names in ignore rules
This commit refactors the project to use a pure PEP 420 implicit namespace package structure, replacing the legacy pkgutil-based approach. Key changes include: - Switched the build system in pyproject.toml from hatchling to setuptools to properly support PEP 420 namespaces. - Removed __init__.py from namespace directories (src/rhosocial/ and src/rhosocial/activerecord/) to enable namespace package discovery. - Moved the core ActiveRecord class from the __init__.py file to a new dedicated module: src/rhosocial/activerecord/model.py. - Deleted the legacy setup.py file as all build configuration is now in pyproject.toml. This migration improves maintainability, aligns with modern Python packaging standards, and resolves module resolution issues in IDEs and static analysis tools.
Updated the continuous integration workflow (test.yml) to install the hosocial-activerecord-testsuite package directly from the elease/v1.0.0.dev2 branch via pip+https. This ensures that the CI pipeline uses the correct version of the testsuite after the ActiveRecord definition relocation. refactor: Update test providers for testsuite compatibility This commit refactors the test providers to align with the updated testsuite. These changes are necessary for the tests to run correctly with the new testsuite structure.
…mpositional Mixin design for async support
This commit introduces a significant architectural refactoring of the entire database backend system within the project. The primary goals are to introduce asynchronous backend support, ensure a consistent interface with synchronous backends, maximize the reuse of common logic, and significantly enhance modularity and extensibility.
This refactoring primarily focuses on the internal structure of the backend abstraction layer, with its public interface remaining unchanged to ensure compatibility with existing backend implementations (e.g., SQLite).
Key changes and improvements include:
**Introduction of Compositional Mixin Design for Asynchronous Backend Support**:
- To introduce an asynchronous backend while ensuring the same interface as the synchronous backend and maximizing the reuse of common logic, I/O-agnostic parts have been divided into several Mixin classes.
- **Specifically, these Mixin classes include**:
-
-
-
-
-
-
-
-
- I/O-related parts have been separated into (synchronous) and (asynchronous) abstract base classes. Each implements its I/O abstract methods and composes the aforementioned Mixin classes.
- This design replaces the traditional single inheritance model, eliminating significant code duplication between synchronous and asynchronous database operations and improving maintainability.
This comprehensive overhaul represents a foundational improvement to the backend, paving the way for easier integration of new database backends, more robust feature support, and enhanced long-term maintainability, all while preserving the API stability of higher-level ActiveRecord models.
- Resolved hanging pytest process by awaiting a coroutine in `_apply_pragmas` and replacing all synchronous file I/O with `aiofiles` in test fixtures. - Refactored all tests in `tests/rhosocial/activerecord_test/feature/backend/sqlite_async/` to use `pytest_asyncio` fixtures for robust connection management. - Corrected `test_parameter_conversion` by providing a valid JSON string instead of a dict, aligning the test with framework expectations. - Added `aiofiles` and `aiosqlite` to `pyproject.toml`, `requirements-dev.txt`, and `requirements-dev-3.8.txt` to support the async test suite. - Commented out redundant `pytest_plugins` declaration in the async conftest.
…p ci] This commit introduces several documentation updates and minor code style adjustments: - **Documentation Updates:** - Corrected the import path for in . - Standardized clause examples across various files in and to consistently use string placeholder expressions (e.g., ) instead of keyword arguments (e.g., or ). - Removed the outdated description and added a clear note to use placeholder expressions for clauses in . - **Code Style & Maintenance:** - Removed debug statements from . - Added a prominent warning to to explicitly state that this async backend implementation is for validation purposes only and should not be used in production. These changes aim to improve documentation clarity, enforce consistent coding practices, and remove unnecessary debug outputs. Manual review is requested for these changes.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #18 +/- ##
==========================================
- Coverage 74.50% 72.71% -1.80%
==========================================
Files 50 50
Lines 5640 6021 +381
Branches 932 969 +37
==========================================
+ Hits 4202 4378 +176
- Misses 1111 1313 +202
- Partials 327 330 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


This PR prepares the
release/v1.0.0.dev12branch ofpython-activerecordfor its official release.It includes several significant updates:
sqlite_asynctest suite for improved reliability.whereclause usage and code style, and adjusted CI testsuite installation to use a specific branch.A changelog fragment for this release (
v1.0.0.dev12) has been prepared and will be included in the final CHANGELOG.md upon release.This release is dependent on
rhosocial-activerecord-testsuite==1.0.0.dev2being released first.