Skip to content

Conversation

@fsbraun
Copy link
Member

@fsbraun fsbraun commented Jul 17, 2025

Summary by Sourcery

Adopt PEP 621 by moving setup configuration into pyproject.toml, streamline setup.py, and refine package inclusion rules

Enhancements:

  • Migrate all packaging metadata (name, version, dependencies, classifiers, URLs) from setup.py into the pyproject.toml [project] table
  • Define explicit packages and package-data in pyproject.toml to include static assets and exclude docs, tests, and bundle files

Build:

  • Configure PEP 517 build-system with setuptools and setuptools-scm in pyproject.toml

Chores:

  • Simplify setup.py to a bare setup() invocation by removing embedded configuration

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jul 17, 2025

Reviewer's Guide

This PR refactors packaging configuration by migrating all metadata, dependencies, and extras from setup.py into pyproject.toml (using PEP 621/PEP 517), simplifies setup.py to a bare setup() call, and enhances wheel packaging by specifying package-data and exclude patterns.

Flow diagram for wheel packaging data inclusion/exclusion

flowchart TD
    A[pyproject.toml]
    B[tool.setuptools.package-data]
    C[Include: static, templates, locale, LICENSE, README.rst]
    D[Exclude: **/bundles/]
    E[Wheel package]
    A --> B
    B --> C
    B --> D
    C --> E
    D --> E
Loading

File-Level Changes

Change Details Files
Simplify setup.py by removing all package metadata and reducing to a bare setup() invocation
  • Removed import of find_packages and version attribute
  • Deleted REQUIREMENTS, EXTRA_REQUIREMENTS, CLASSIFIERS, and PROJECT_URLS definitions
  • Stripped setup() call of all keyword arguments, leaving only setup()
setup.py
Introduce build-system and project metadata sections in pyproject.toml
  • Added [build-system] with setuptools.build_meta and build requirements
  • Defined [project] table with name, description, license, authors, Python requirement, and classifiers
  • Enabled dynamic version resolution via setuptools-scm
pyproject.toml
Migrate install_requires and extras_require into pyproject.toml dependency sections
  • Mapped install_requires to project.dependencies
  • Converted extras_require into optional-dependencies blocks for cms-3, cms-4, djangocms-icon, and static-ace
pyproject.toml
Configure setuptools tool settings and wheel packaging rules
  • Specified packages under [tool.setuptools]
  • Configured dynamic version attr in [tool.setuptools.dynamic]
  • Defined package-data patterns and exclude rules to omit docs and test artifacts from the wheel
pyproject.toml

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 @fsbraun - I've reviewed your changes - here's some feedback:

  • The [tool.setuptools.package-data] section references djangocms_stories but your package is djangocms_frontend, so update it to correctly include your project’s data files.
  • You wanted to exclude docs and tests from the wheel, but your exclude only covers bundles—add patterns for docs/ and tests/ to fully omit them.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The [tool.setuptools.package-data] section references `djangocms_stories` but your package is `djangocms_frontend`, so update it to correctly include your project’s data files.
- You wanted to exclude docs and tests from the wheel, but your `exclude` only covers bundles—add patterns for docs/ and tests/ to fully omit them.

## Individual Comments

### Comment 1
<location> `pyproject.toml:74` </location>
<code_context>
+[tool.setuptools.dynamic]
+version = { attr = "djangocms_frontend.__version__" }
+
+[tool.setuptools.package-data]
+djangocms_stories = [ "static/**/*", "templates/**/*", "locale/**/*", "LICENSE", "README.rst" ]
+exclude = [ "**/bundles/" ]
+
 [tool.black]
</code_context>

<issue_to_address>
Package data section references 'djangocms_stories', which may be a typo.

The package data is set for 'djangocms_stories', but the project appears to be 'djangocms_frontend'. Please verify this isn't a copy-paste mistake to avoid missing data in your package.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
[tool.setuptools.package-data]
djangocms_stories = [ "static/**/*", "templates/**/*", "locale/**/*", "LICENSE", "README.rst" ]
exclude = [ "**/bundles/" ]
=======
[tool.setuptools.package-data]
djangocms_frontend = [ "static/**/*", "templates/**/*", "locale/**/*", "LICENSE", "README.rst" ]
exclude = [ "**/bundles/" ]
>>>>>>> REPLACE

</suggested_fix>

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.

@codecov
Copy link

codecov bot commented Jul 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.89%. Comparing base (aab21cf) to head (e80182e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #290   +/-   ##
=======================================
  Coverage   88.89%   88.89%           
=======================================
  Files         124      124           
  Lines        3385     3385           
  Branches      288      288           
=======================================
  Hits         3009     3009           
  Misses        259      259           
  Partials      117      117           

☔ 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.

@fsbraun fsbraun merged commit 144443b into master Jul 17, 2025
23 checks passed
@fsbraun fsbraun deleted the chore/build branch July 17, 2025 18:17
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