Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9a6b160
feat: consolidate package metadata into pyproject.toml
Jul 9, 2026
8e905de
feat: switch dependency management from pip-compile to uv
Jul 9, 2026
c7d2388
feat: add semantic-release for automated PyPI publishing
Jul 9, 2026
c6a2aca
fix: correct release tag format, exclude tests from wheel, drop stale…
Jul 10, 2026
543b2b8
fix: prevent uv sync from implicitly pulling in the dev group
Jul 10, 2026
5d13930
fix: publish to PyPI via OIDC instead of token
Jul 15, 2026
5a89d56
fix: pin pypa/gh-action-pypi-publish to a commit SHA
Jul 15, 2026
0689524
fix: set major_on_zero=false and allow_zero_version=true for consistency
Jul 16, 2026
3e3ac11
refactor: adopt src-layout, matching openedx/sample-plugin
Jul 17, 2026
61d1897
fix: use uv-venv-lock-runner for the main and pii_check tox envs
Jul 17, 2026
99bb817
fix: address review feedback (uv setup, coverage, readme, changelog)
Jul 21, 2026
b312a34
fix: remove unpinned tox install from make requirements
Jul 28, 2026
059e5eb
fix: give django42/django52 tox envs genuinely independent locked res…
Jul 28, 2026
9368fae
Merge remote-tracking branch 'origin/main' into irfanuddinahmad/uv-mi…
Jul 28, 2026
e194a89
fix: regenerate uv.lock to fix ordering left by the main merge
Jul 28, 2026
c692ce5
fix: upgrade locked uv package to match CI's system uv version
Jul 28, 2026
50df933
fix: pii_check env has no django42/django52 factor in its name
Jul 28, 2026
33c58a2
fix: restore CHANGELOG.rst and re-enable semantic-release changelog g…
Jul 30, 2026
c2df9e5
chore: remove stale version-bump/changelog checklist items from PR te…
Jul 30, 2026
5826605
docs: remove stale manual tag/PyPI-verification steps from PR template
Jul 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .coveragerc

This file was deleted.

5 changes: 0 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@ Add some.
**Merge checklist:**
- [ ] All reviewers approved
- [ ] CI build is green
- [ ] Version bumped
- [ ] Changelog record added
- [ ] Documentation updated (not only docstrings)
- [ ] Commits are squashed

**Post merge:**
- [ ] Create a tag
- [ ] Check new version is pushed to PyPI after tag-triggered build is
finished.
- [ ] Delete working branch (if not needed anymore)
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
pull_request:
branches:
- '**'
# So the release workflow can run CI before cutting a release.
workflow_call:


jobs:
Expand All @@ -21,25 +23,24 @@ jobs:

steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: setup python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0

- name: Install uv
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

astral-sh/setup-uv is missing two parameters:

- name: Install uv
  uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
  with:
    enable-cache: true
    python-version: "${{ matrix.python-version }}"

Without enable-cache: true the uv package cache is not persisted across runs. Without python-version, Python is not managed by setup-uv, which leaves the setup python step above still load-bearing rather than redundant.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Confirmed already correct — setup-uv has both enable-cache: true and python-version set.

with:
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Install pip
run: pip install -r requirements/pip.txt

- name: Install Dependencies
run: pip install -r requirements/ci.txt
run: uv sync --group ci

- name: Run Tests
env:
TOXENV: ${{ matrix.toxenv }}
run: tox
run: uv run tox

- name: Run coverage
if: matrix.python-version == '3.12' && matrix.toxenv == 'django52'
uses: codecov/codecov-action@v7
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/pypi-publish.yml

This file was deleted.

86 changes: 86 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Semantic Release

on:
push:
branches: [main]

jobs:
run_ci:
uses: ./.github/workflows/ci.yml

release:
needs: run_ci
runs-on: ubuntu-latest
if: github.ref_name == 'main'
concurrency:
group: ${{ github.workflow }}-release-${{ github.ref_name }}
cancel-in-progress: false

permissions:
contents: write

steps:
# Note: We checkout the repository at the branch that triggered the workflow.
# Python Semantic Release will automatically convert shallow clones to full clones
# if needed to ensure proper history evaluation. However, we forcefully reset the
# branch to the workflow sha because it is possible that the branch was updated
# while the workflow was running, which prevents accidentally releasing un-evaluated
# changes.
- name: Setup | Checkout Repository on Release Branch
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.ref_name }}

- name: Setup | Force release branch to be at workflow sha
run: |
git reset --hard ${{ github.sha }}

- name: Action | Semantic Version Release
id: release
uses: python-semantic-release/python-semantic-release@350c48fcb3ffcdfd2e0a235206bc2ecea6b69df0 # v10.5.3
with:
github_token: ${{ secrets.OPENEDX_SEMANTIC_RELEASE_GITHUB_TOKEN }}
git_committer_name: "github-actions"
git_committer_email: "actions@users.noreply.github.com"

- name: Publish | Upload to GitHub Release Assets
uses: python-semantic-release/publish-action@310a9983a0ae878b29f3aac778d7c77c1db27378 # v10.5.3
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.OPENEDX_SEMANTIC_RELEASE_GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}

- name: Upload | Distribution Artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: steps.release.outputs.released == 'true'
with:
name: distribution-artifacts
path: dist
if-no-files-found: error

outputs:
released: ${{ steps.release.outputs.released || 'false' }}
version: ${{ steps.release.outputs.version }}

publish_to_pypi:
# 1. Separate out the publish step from the github release step to run each step at
# the least amount of token privilege
# 2. Also, publishing can fail, and its better to have a separate job if you need to retry
# and it won't require reversing the release.
runs-on: ubuntu-latest
needs: release
if: github.ref_name == 'main' && needs.release.outputs.released == 'true'

permissions:
contents: read
id-token: write

steps:
- name: Setup | Download Build Artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: distribution-artifacts
path: dist

- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ pip-log.txt
coverage.xml
htmlcov/

# Virtual environments
venv/
.venv/

.vscode/

# The Silver Searcher
Expand Down
12 changes: 8 additions & 4 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ version: 2
sphinx:
configuration: docs/conf.py

python:
version: 3.8
install:
- requirements: requirements/doc.txt
build:
os: ubuntu-24.04
tools:
python: "3.12"
jobs:
install:
- pip install uv
- uv sync --group doc
7 changes: 2 additions & 5 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. changelog-insertion-marker

Change Log
##########

Expand All @@ -15,11 +17,6 @@ Unreleased
**********
* Nothing unreleased

[2.0.0]
********
* chore: Upgrade Python requirements


[1.8.0]
********
* chore: Upgrade Python requirements
Expand Down
5 changes: 1 addition & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
include CHANGELOG.rst
include LICENSE.txt
include README.rst
include requirements/base.in
include requirements/constraints.txt
recursive-include openedx_ledger *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg
recursive-include src/openedx_ledger *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg
62 changes: 22 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: clean compile_translations coverage diff_cover docs dummy_translations \
.PHONY: clean compile-requirements compile_translations coverage diff_cover docs dummy_translations \
extract_translations fake_translations help pii_check pull_translations push_translations \
quality requirements selfcheck test test-all upgrade validate install_transifex_client

Expand Down Expand Up @@ -26,42 +26,24 @@ coverage: clean ## generate and view HTML coverage report
$(BROWSER)htmlcov/index.html

docs: ## generate Sphinx HTML documentation, including API docs
tox -e docs
uv run tox -e docs
$(BROWSER)docs/_build/html/index.html

# Define PIP_COMPILE_OPTS=-v to get more information during make upgrade.
PIP_COMPILE = pip-compile --upgrade $(PIP_COMPILE_OPTS)

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip install -qr requirements/pip-tools.txt
# Make sure to compile files after any other files they include!
$(PIP_COMPILE) --allow-unsafe -o requirements/pip.txt requirements/pip.in
$(PIP_COMPILE) -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -qr requirements/pip.txt
pip install -qr requirements/pip-tools.txt
$(PIP_COMPILE) -o requirements/base.txt requirements/base.in
$(PIP_COMPILE) -o requirements/test.txt requirements/test.in
$(PIP_COMPILE) -o requirements/doc.txt requirements/doc.in
$(PIP_COMPILE) -o requirements/quality.txt requirements/quality.in
$(PIP_COMPILE) -o requirements/ci.txt requirements/ci.in
$(PIP_COMPILE) -o requirements/dev.txt requirements/dev.in
# Let tox control the Django version for tests
sed '/^[dD]jango==/d' requirements/test.txt > requirements/test.tmp
mv requirements/test.tmp requirements/test.txt
compile-requirements: ## generate the uv.lock file without upgrading packages
uv lock

upgrade: ## upgrade all packages in uv.lock and sync constraints from edx-lint
uv run --with edx-lint edx_lint write_uv_constraints pyproject.toml
uv lock --upgrade

quality: ## check coding style with pycodestyle and pylint
tox -e quality
uv run tox -e quality

pii_check: ## check for PII annotations on all Django models
tox -e pii_check

piptools: ## install pinned version of pip-compile and pip-sync
pip install -r requirements/pip.txt
pip install -r requirements/pip-tools.txt
uv run tox -e pii_check

requirements: piptools ## install development environment requirements
pip-sync -q requirements/dev.txt requirements/private.*
requirements: ## install development environment requirements
uv sync --group dev

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The requirements target is missing uv tool install tox --with tox-uv. Without it, tox won't be available as a tool-level command on a fresh checkout:

requirements: ## install development environment requirements
	uv sync --group dev
	uv tool install tox --with tox-uv

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

On reflection, reverting this — it installs an unpinned tox outside uv.lock, which is inconsistent with every other tox invocation in this repo (test-all/quality/pii_check Makefile targets, ci.yml), all of which use uv run tox via the ci/dev dependency-groups that already declare tox/tox-uv. Removed the added line to keep this consistent with the rest of the repo's pattern.


test: clean ## run tests in the current virtualenv
DJANGO_SETTINGS_MODULE=test_settings pytest
Expand All @@ -70,22 +52,22 @@ diff_cover: test ## find diff lines that need test coverage
diff-cover coverage.xml

test-all: quality pii_check ## run tests on every supported Python/Django combination
tox
tox -e docs
uv run tox
uv run tox -e docs

validate: quality pii_check test ## run tests and quality checks

selfcheck: ## check that the Makefile is well-formed
@echo "The Makefile is well-formed."

isort:
isort tests openedx_ledger manage.py setup.py test_settings.py
isort tests src/openedx_ledger manage.py test_settings.py

style:
pycodestyle openedx_ledger tests manage.py setup.py
pycodestyle src/openedx_ledger tests manage.py

lint:
pylint openedx_ledger tests manage.py setup.py
pylint src/openedx_ledger tests manage.py

## Docker in this repo is only supported for running tests locally
## as an alternative to virtualenv natively
Expand All @@ -96,14 +78,14 @@ test-shell: ## Run a shell, as root, on the specified service container

extract_translations: ## extract strings to be translated, outputting .mo files
rm -rf docs/_build
cd openedx_ledger && ../manage.py makemessages -l en -v1 -d django
cd openedx_ledger && ../manage.py makemessages -l en -v1 -d djangojs
cd src/openedx_ledger && ../../manage.py makemessages -l en -v1 -d django
cd src/openedx_ledger && ../../manage.py makemessages -l en -v1 -d djangojs

compile_translations: ## compile translation files, outputting .po files for each supported language
cd openedx_ledger && ../manage.py compilemessages
cd src/openedx_ledger && ../../manage.py compilemessages

detect_changed_source_translations:
cd openedx_ledger && i18n_tool changed
cd src/openedx_ledger && i18n_tool changed

pull_translations: ## pull translations from Transifex
tx pull -a -f -t --mode reviewed
Expand All @@ -112,7 +94,7 @@ push_translations: ## push source translation files (.po) from Transifex
tx push -s

dummy_translations: ## generate dummy translation (.po) files
cd openedx_ledger && i18n_tool dummy
cd src/openedx_ledger && i18n_tool dummy

build_dummy_translations: extract_translations dummy_translations compile_translations ## generate and compile dummy translation files

Expand Down
1 change: 0 additions & 1 deletion docs/changelog.rst

This file was deleted.

21 changes: 4 additions & 17 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,17 @@
serve to show the default.
"""
import os
import re
import sys
from datetime import datetime
from importlib.metadata import version as get_version
from subprocess import check_call

from django import setup as django_setup


def get_version(*file_paths):
"""
Extract the version string from the file at the given relative path fragments.
"""
filename = os.path.join(os.path.dirname(__file__), *file_paths)
version_file = open(filename, encoding="utf8").read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError('Unable to find version string.')


REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(REPO_ROOT)

VERSION = get_version('../openedx_ledger', '__init__.py')
VERSION = get_version('openedx-ledger')

# Configure Django for autodoc usage
os.environ['DJANGO_SETTINGS_MODULE'] = 'test_settings'
Expand Down Expand Up @@ -524,8 +511,8 @@ def on_init(app): # pylint: disable=unused-argument
# If we are, assemble the path manually
bin_path = os.path.abspath(os.path.join(sys.prefix, 'bin'))
apidoc_path = os.path.join(bin_path, apidoc_path)
check_call([apidoc_path, '-o', docs_path, os.path.join(root_path, 'openedx_ledger'),
os.path.join(root_path, 'openedx_ledger/migrations')])
check_call([apidoc_path, '-o', docs_path, os.path.join(root_path, 'src', 'openedx_ledger'),
os.path.join(root_path, 'src', 'openedx_ledger', 'migrations')])


def setup(app):
Expand Down
Loading