Skip to content

Conversation

@fsbraun
Copy link
Member

@fsbraun fsbraun commented Nov 21, 2025

Summary by Sourcery

Raise the supported Python and Django versions, adjust tooling accordingly, and add a fallback for optional metadata integration.

New Features:

  • Provide an optional ModelMeta stub so the app can run without django-meta installed.

Enhancements:

  • Update package metadata to require Python 3.10+ and declare support for Django 6.0 and newer Python releases.
  • Refresh pre-commit tooling configuration to target Python 3.10+ and use a newer pyproject-fmt version.

Build:

  • Align packaging metadata and classifiers with the updated Python and Django support matrix.

CI:

  • Revise the GitHub Actions test matrix to drop Python 3.9, add Python 3.13–3.14, and include a Django 6.0 / Django CMS 5.0 requirements set while adjusting exclusions.

Tests:

  • Introduce a new Django 6.0 / Django CMS 5.0 test requirements file for CI coverage.

Chores:

  • Bump the library version from 0.7.4 to 0.7.5 and update the changelog for the release.

Added changelog entry for version 0.7.5 with a fix for the Stories config form.
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 21, 2025

Reviewer's Guide

Updates project support matrix and tooling for newer Python and Django versions while dropping Python 3.9, and adds a defensive stub for optional django-meta integration.

Updated class diagram for optional ModelMeta stub

classDiagram
class ModelMeta {
    +as_meta()
    +build_absolute_uri(url)
}

class DjangoAppsRegistry

DjangoAppsRegistry <.. ModelMeta : conditionally_imports_or_defines
Loading

File-Level Changes

Change Details Files
Make django-meta integration optional via a local ModelMeta stub when the package is not installed.
  • Check if the 'meta' app is installed via django.apps.apps.is_installed before importing ModelMeta
  • Define a local ModelMeta stub class with as_meta and build_absolute_uri methods returning safe defaults when django-meta is absent
djangocms_stories/models.py
Update CI test matrix to cover new Python/Django combinations and introduce a requirements set for Django 6.0 with CMS 5.0.
  • Adjust GitHub Actions test matrix to run against Python 3.10–3.14, add dj60_cms50 requirements file to the matrix, and update exclude rules accordingly
  • Add a new tests/requirements/dj60_cms50.txt file and keep existing Django/CMS requirement sets aligned with supported combinations
.github/workflows/tests.yml
tests/requirements/dj42_cms50.txt
tests/requirements/dj52_cms50.txt
tests/requirements/dj60_cms50.txt
Align packaging metadata and tooling with the new minimum Python version and supported versions.
  • Raise requires-python to >=3.10 and update PyPI classifiers to drop Python 3.9, add Python 3.14, and declare Django 6.0 support
  • Update pyupgrade configuration to target Python 3.10+ code style
  • Bump pyproject-fmt pre-commit hook version to v2.11.1
pyproject.toml
.pre-commit-config.yaml
Bump project version and update changelog for the new release aligned with the updated support matrix.
  • Increment package version from 0.7.4 to 0.7.5
  • Add or adjust changelog entries corresponding to the new release
djangocms_stories/__init__.py
CHANGELOG.rst

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • The conditional import of ModelMeta using apps.is_installed() happens at import time and depends on the Django app registry being ready; consider switching to a simple try/except ImportError-based import to avoid potential issues during early imports or non-standard initialization contexts.
  • For the ModelMeta stub, you may want to mirror the real class interface more closely (e.g., method signatures, return types) or clearly separate it (e.g., via a mixin or helper) so that any code using ModelMeta behaves consistently whether or not django-meta is installed.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The conditional import of ModelMeta using apps.is_installed() happens at import time and depends on the Django app registry being ready; consider switching to a simple try/except ImportError-based import to avoid potential issues during early imports or non-standard initialization contexts.
- For the ModelMeta stub, you may want to mirror the real class interface more closely (e.g., method signatures, return types) or clearly separate it (e.g., via a mixin or helper) so that any code using ModelMeta behaves consistently whether or not django-meta is installed.

## Individual Comments

### Comment 1
<location> `CHANGELOG.rst:8` </location>
<code_context>
+0.7.5 (2025-11-21)
+------------------
+
+* fix: Stories config form instead of current values always presented inital values
+* fix: Allow to run without django-meta installed
+
</code_context>

<issue_to_address>
**suggestion (typo):** Fix the typo in "inital" and consider reordering the sentence for clarity.

Suggested wording: "Stories config form always presented initial values instead of current values," which makes the intent clearer.

```suggestion
* fix: Stories config form always presented initial values instead of current values
```
</issue_to_address>

### Comment 2
<location> `CHANGELOG.rst:9` </location>
<code_context>
+------------------
+
+* fix: Stories config form instead of current values always presented inital values
+* fix: Allow to run without django-meta installed
+
 0.7.4 (2025-09-17)
</code_context>

<issue_to_address>
**suggestion (typo):** Tighten the grammar in "Allow to run" for better readability.

The phrase "Allow to run" is grammatically awkward. Consider rephrasing to something like "Allow running without django-meta installed" or "Allow the package/app to run without django-meta installed."

```suggestion
* fix: Allow running without django-meta installed
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

------------------

* fix: Stories config form instead of current values always presented initial values
* fix: Stories config form instead of current values always presented inital values
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (typo): Fix the typo in "inital" and consider reordering the sentence for clarity.

Suggested wording: "Stories config form always presented initial values instead of current values," which makes the intent clearer.

Suggested change
* fix: Stories config form instead of current values always presented inital values
* fix: Stories config form always presented initial values instead of current values


* fix: Stories config form instead of current values always presented initial values
* fix: Stories config form instead of current values always presented inital values
* fix: Allow to run without django-meta installed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (typo): Tighten the grammar in "Allow to run" for better readability.

The phrase "Allow to run" is grammatically awkward. Consider rephrasing to something like "Allow running without django-meta installed" or "Allow the package/app to run without django-meta installed."

Suggested change
* fix: Allow to run without django-meta installed
* fix: Allow running without django-meta installed

@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 14.28571% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.77%. Comparing base (58c4e40) to head (537ce3f).

Files with missing lines Patch % Lines
djangocms_stories/models.py 14.28% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #60      +/-   ##
==========================================
- Coverage   90.02%   89.77%   -0.26%     
==========================================
  Files          23       23              
  Lines        2116     2122       +6     
  Branches      239      240       +1     
==========================================
  Hits         1905     1905              
- Misses        128      133       +5     
- Partials       83       84       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants