Skip to content

Conversation

@vistart
Copy link
Contributor

@vistart vistart commented Nov 7, 2025

This PR prepares the release/v1.0.0.dev12 branch of python-activerecord for its official release.

It includes several significant updates:

  • Namespace Package Migration: Migrated the core project to PEP 420 Namespace Packages, improving modularity and extensibility.
  • Backend Storage Refactoring: Refactored the backend storage abstraction layer with a compositional Mixin design, enhancing async support and overall flexibility.
  • Test Stability: Resolved hanging asynchronous tests and refactored the sqlite_async test suite for improved reliability.
  • Documentation & CI Updates: Updated documentation for where clause 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.dev2 being released first.

- 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
Copy link

codecov bot commented Nov 7, 2025

Codecov Report

❌ Patch coverage is 49.39759% with 294 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.71%. Comparing base (d156ddd) to head (3b59baa).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
src/rhosocial/activerecord/backend/base.py 60.75% 150 Missing and 5 partials ⚠️
src/rhosocial/activerecord/backend/transaction.py 17.75% 139 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
python-3.14 72.71% <49.39%> (-1.80%) ⬇️
unittests 72.71% <49.39%> (-1.80%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...social/activerecord/backend/impl/sqlite/backend.py 82.46% <100.00%> (ø)
.../rhosocial/activerecord/backend/type_converters.py 86.41% <ø> (ø)
src/rhosocial/activerecord/backend/typing.py 100.00% <100.00%> (ø)
src/rhosocial/activerecord/model.py 100.00% <100.00%> (ø)
src/rhosocial/activerecord/backend/transaction.py 56.33% <17.75%> (-30.10%) ⬇️
src/rhosocial/activerecord/backend/base.py 66.73% <60.75%> (+0.48%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 7, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
7.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@vistart vistart merged commit 65a14f5 into main Nov 7, 2025
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant