Skip to content

feat: modernize repo to use uv, pyproject.toml, and semantic-release#280

Open
farhan wants to merge 1 commit into
openedx:masterfrom
farhan:farhan/modernize-repo
Open

feat: modernize repo to use uv, pyproject.toml, and semantic-release#280
farhan wants to merge 1 commit into
openedx:masterfrom
farhan:farhan/modernize-repo

Conversation

@farhan

@farhan farhan commented Jul 7, 2026

Copy link
Copy Markdown

Important

PR implemented with the assistance of Claude Code, human-reviewed and improved before pushing to code review.

Summary

Modernize forum to uv + pyproject.toml (PEP 621/735) + python-semantic-release.

Part of openedx/public-engineering#506.

  • Replace setup.py/setup.cfg with pyproject.toml (PEP 621 static metadata)
  • Switch from pip-compile to uv with PEP 735 dependency groups; commit uv.lock
  • Replace pylint/isort/pycodestyle/mypy config with ruff (check + format); mypy config moved into pyproject.toml; coverage config moved into pyproject.toml
  • Update tox.ini to use tox-uv with uv-venv-lock-runner
  • Update CI to use astral-sh/setup-uv; SHA-pin all actions; add workflow_call trigger
  • Add python-semantic-release + release.yml; replace old pypi-publish.yml

Removed

Deleted files: setup.py, setup.cfg, requirements/, .coveragerc, pylintrc, pylintrc_tweaks, CHANGELOG.rst, mypy.ini

Removed Makefile targets:

Target Reason
clean_tox Tox environments managed by tox-uv; manual tox cache cleaning no longer needed
compile-requirements pip-compile workflow replaced by uv + uv.lock
piptools pip-tools no longer used
test-all Superseded by tox / CI matrix
test-quality Rolled into lint target
test-lint Rolled into lint target
test-codestyle Rolled into lint target
test-isort Rolled into lint target
test-mypy Rolled into mypy target
test-format Rolled into format target

Not included

e2e tests excluded from CI matrix: The e2e tox environment requires Docker and is not suitable for the standard GitHub Actions runner. It has been removed from the CI matrix (.github/workflows/ci.yml) but the env is still defined in tox.ini and can be run locally via make test-e2e or tox -e e2e.

Versioning

[Dynamic] setuptools-scm with dynamic = ["version"] — master had a PyPI publish workflow (pypi-publish.yml); python-semantic-release controls the version string at release time via git tags.

Testing Notes

This PR has not been manually tested against the repo's own features. Testing relied on CI checks and local agent tooling (make requirements, make lint, make test, python -m build). Repo-owner is encouraged to run the repo's feature tests before merging.

Code reviewer notes:

  • Pay close attention to the pyproject.toml dependency groups — verify that all runtime and optional dependencies from the old requirements/*.in files are faithfully carried over, and that no transitive constraint from requirements/constraints.txt was silently dropped.

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the repository’s Python packaging, dependency management, and automation by migrating to pyproject.toml + uv and updating CI/release workflows accordingly. It also applies broad formatting/typing cleanups consistent with the new Ruff-based toolchain.

Changes:

  • Migrates packaging metadata and tool configuration into pyproject.toml (PEP 621) and replaces requirements/*.in|*.txt with uv.lock + dependency groups.
  • Updates tox.ini, Makefile, and GitHub Actions workflows to run via uv (and adds semantic-release driven publishing).
  • Applies widespread Ruff-formatting and typing updates across application code and tests.

Reviewed changes

Copilot reviewed 95 out of 96 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tox.ini Switch tox to tox-uv/uv runner and define envs for tests/quality/docs/e2e.
pyproject.toml New central project metadata, dependency groups, and tool configs (ruff/pytest/coverage/semantic-release).
Makefile Replaces pip-tools workflows with uv-based sync/lock/quality/docs/test targets.
.github/workflows/ci.yml CI updated to install uv, sync ci group, and run tox envs.
.github/workflows/release.yml Adds semantic-release workflow chaining CI, creating GitHub releases, and publishing to PyPI via OIDC.
.github/workflows/pypi-publish.yml Removes legacy PyPI publish workflow.
CHANGELOG.rst Replaced changelog contents with semantic-release/GitHub Releases pointer.
.coveragerc Removes legacy coverage config (moved to pyproject.toml).
setup.py Removes legacy setuptools packaging file.
setup.cfg Removes legacy tool config (e.g., isort/wheel).
pylintrc Removes legacy pylint config.
pylintrc_tweaks Removes legacy pylint tweaks.
requirements/base.in Removed (replaced by pyproject.toml deps).
requirements/base.txt Removed (replaced by uv.lock).
requirements/test.in Removed (replaced by dependency groups).
requirements/test.txt Removed (replaced by uv.lock).
requirements/quality.in Removed (replaced by dependency groups).
requirements/doc.in Removed (replaced by dependency groups).
requirements/ci.in Removed (replaced by dependency groups).
requirements/dev.in Removed (replaced by dependency groups).
requirements/constraints.txt Removed (constraints approach replaced by uv constraints handling).
requirements/pip.in Removed (no longer pinning pip tooling via requirements).
requirements/pip.txt Removed.
requirements/pip-tools.in Removed.
requirements/pip-tools.txt Removed.
requirements/private.readme Removed (legacy private requirements workflow).
forum/apps.py AppConfig modified (startup behavior impacted).
forum/utils.py Typing import cleanup and minor formatting.
forum/settings/common.py Minor formatting in settings initialization.
forum/views/votes.py Formatting-only changes.
forum/views/users.py Formatting-only changes.
forum/views/pins.py Formatting-only changes.
forum/views/flags.py Formatting-only changes.
forum/views/comments.py Import order adjustment.
forum/serializers/users.py Formatting-only changes.
forum/serializers/thread.py Type-hint modernization + formatting.
forum/serializers/contents.py Formatting-only changes.
forum/search/base.py Type-hint modernization + formatting.
forum/search/init.py Formatting-only changes.
forum/search/es.py Type-hint modernization + formatting.
forum/search/meilisearch.py Type-hint modernization + formatting.
forum/search/typesense.py Type-hint modernization + formatting; minor logic reshaping for readability.
forum/pagination.py Formatting-only changes.
forum/mongo.py Type-hint modernization + formatting.
forum/migration_helpers.py Import ordering + formatting-only changes.
forum/management/commands/rebuild_forum_indices.py Formatting-only changes.
forum/management/commands/forum_migrate_course_from_mongodb_to_mysql.py Import consolidation + formatting-only changes.
forum/management/commands/forum_delete_course_from_mongodb.py Formatting-only changes.
forum/management/commands/delete_unused_forum_indices.py Formatting-only changes.
forum/api/votes.py Type-hint modernization + formatting-only changes.
forum/api/users.py Type-hint modernization + formatting-only changes (but includes a functional bug in error message).
forum/api/threads.py Type-hint modernization + formatting-only changes.
forum/api/subscriptions.py Type-hint modernization + formatting-only changes.
forum/api/search.py Type-hint modernization + formatting-only changes.
forum/api/pins.py Type-hint modernization + formatting-only changes.
forum/api/flags.py Type-hint modernization + formatting-only changes.
forum/api/comments.py Type-hint modernization + formatting-only changes.
forum/handlers.py Import order and formatting-only changes.
forum/admin.py Import reordering/formatting-only changes.
forum/backends/backend.py Type-hint modernization + formatting-only changes.
forum/backends/mysql/init.py Import ordering/formatting-only changes.
forum/migrations/0001_initial.py Formatting-only changes in generated migration.
forum/migrations/0002_alter_readstate_course_id_and_more.py Import ordering/formatting-only changes in generated migration.
forum/migrations/0003_alter_commentthread_title.py Formatting-only changes.
forum/migrations/0004_add_author_username_fields.py Formatting-only changes.
forum/migrations/0005_alter_commentthread_pinned.py Formatting-only changes.
docs/conf.py Formatting and minor config adjustments.
docs/references/v2_python_native_apis_responses.rst Normalizes example JSON literals (true/false/null) in docs.
tests/conftest.py Import/type-hint modernization and ordering.
test_utils/client.py Formatting-only changes.
test_utils/mock_es_backend.py Formatting-only changes.
tests/test_settings.py Formatting-only changes.
tests/test_typesense.py Import ordering + formatting-only changes.
tests/test_meilisearch.py Import ordering + formatting-only changes.
tests/test_backends/test_mysql/test_api.py Formatting-only changes.
tests/test_management/test_commands/test_migration_commands.py Import ordering + formatting-only changes.
tests/test_views/test_votes.py Formatting-only changes.
tests/test_views/test_users.py Formatting-only changes.
tests/test_views/test_threads.py Type-hint modernization + formatting-only changes.
tests/test_views/test_subscriptions.py Formatting-only changes.
tests/test_views/test_search.py Type-hint modernization + formatting-only changes.
tests/test_views/test_pins.py Formatting-only changes.
tests/test_views/test_flags.py Minor idiomatic set literal + formatting-only changes.
tests/test_views/test_comments.py Formatting-only changes.
tests/test_views/test_commentables.py Import ordering + formatting-only changes.
tests/e2e/test_users.py Type-hint modernization + formatting-only changes.
tests/e2e/test_search_meilisearch.py Import ordering + formatting-only changes.
tests/e2e/test_search_es.py Type-hint modernization + formatting-only changes.
Comments suppressed due to low confidence (1)

forum/apps.py:36

  • ForumConfig.ready() no longer imports forum.signals, so the module-level Signal() objects and their .connect(...) calls may never run during app startup. This can break signal-based behavior unless some other code imports forum.signals early enough.
    def ready(self) -> None:
        """
        Import Signals.
        """


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tox.ini Outdated
Comment thread forum/api/users.py
Comment thread pyproject.toml Outdated
@farhan farhan force-pushed the farhan/modernize-repo branch from 9a103b8 to 5693a27 Compare July 10, 2026 10:15
@farhan farhan moved this to 🏗 In progress in Aximprovements Team Jul 13, 2026
@farhan farhan requested a review from Copilot July 13, 2026 07:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 101 out of 102 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

forum/apps.py:36

  • ForumConfig.ready() no longer imports forum.signals. Since forum/signals.py is the only place that imports forum.handlers and connects the custom signals, this change prevents the handlers/signals from being registered at app startup, which can break search-index updates and any code relying on these signals.
    def ready(self) -> None:
        """
        Import Signals.
        """

Comment thread Makefile Outdated
Comment thread Makefile Outdated
@farhan farhan force-pushed the farhan/modernize-repo branch from c027a19 to 3f2f04a Compare July 13, 2026 08:52
- Migrate package metadata from setup.py/setup.cfg to pyproject.toml (PEP 621/735)
- Switch dependency management from pip-tools to uv with dependency groups
- Replace pylint/pycodestyle/pydocstyle/isort/black with ruff
- Move coverage config from .coveragerc into pyproject.toml
- Rewrite tox.ini to use uv-venv-lock-runner with dependency_groups
- Update Makefile for uv-based workflow
- Replace old CI workflow with uv-based matrix using astral-sh/setup-uv
- Add python-semantic-release workflow for automated versioning and PyPI publishing
- Generate uv.lock lockfile
- Delete requirements/, setup.py, setup.cfg, CHANGELOG.rst, .coveragerc, pylintrc*

Ref: openedx/public-engineering#506

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@farhan farhan force-pushed the farhan/modernize-repo branch from f8c5eba to 809850a Compare July 13, 2026 10:33
@farhan farhan marked this pull request as ready for review July 13, 2026 11:15
@farhan farhan moved this from 🏗 In progress to 👀 In review in Aximprovements Team Jul 13, 2026
@farhan farhan self-assigned this Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

2 participants