Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ jobs:
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
toxenv: [quality, docs, pii_check, django52]
toxenv: [quality, docs, pii_check, django52, django60]
steps:
- uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install pip
run: pip install -r requirements/pip.txt
- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Install Dependencies
run: pip install -r requirements/ci.txt
- name: Install CI dependencies
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'
Expand Down
34 changes: 8 additions & 26 deletions backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,39 +32,21 @@ docs: ## generate Sphinx HTML documentation, including API docs
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 $(PIP_COMPILE_OPTS)

compile-requirements: export CUSTOM_COMPILE_COMMAND=make upgrade
compile-requirements: piptools ## compile the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip-compile -v ${PIP_COMPILE_OPTS} --allow-unsafe --rebuild -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -qr requirements/pip-tools.txt
$(PIP_COMPILE) -c requirements/constraints.txt -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

upgrade: piptools ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
$(MAKE) compile-requirements PIP_COMPILE_OPTS="--upgrade"
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

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-tools.txt

requirements: clean_tox piptools ## install development environment requirements
pip-sync -q requirements/dev.txt requirements/private.*
# So that the plugin entrypoints are installed and loaded correctly.
pip install -e .
requirements: clean_tox ## install development environment requirements
uv sync --group dev

test: clean ## run tests in the current virtualenv
pytest
Expand Down
2 changes: 2 additions & 0 deletions backend/docs/how-tos/index.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
How-tos
#######

* `How To Manage a uv Dependency Version Matrix <https://docs.openedx.org/en/latest/developers/how-tos/manage-uv-dependency-matrix.html>`_
86 changes: 83 additions & 3 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "openedx-sample-plugin"
description = "A sample backend plugin for the Open edX Platform"
requires-python = ">=3.11"
requires-python = ">=3.12"
license="Apache-2.0"
authors = [
{name = "Open edX Project", email = "oscm@openedx.org"},
Expand All @@ -24,7 +24,17 @@ keywords = [
"edx",
]

dynamic = ["readme", "dependencies", "version"]
dynamic = ["readme", "version"]

dependencies = [
"Django",
"djangorestframework",
"django-filter",
"edx-opaque-keys",
"openedx-events",
"openedx-filters",
"openedx-atlas",
]

[project.entry-points."lms.djangoapp"]
sample_plugin = "sample_plugin.apps:SamplePluginConfig"
Expand All @@ -36,9 +46,53 @@ sample_plugin = "sample_plugin.apps:SamplePluginConfig"
Homepage = "https://openedx.org/openedx/sample-plugin"
Repository = "https://openedx.org/openedx/sample-plugin"

[dependency-groups]
test-base = [
"pytest-cov",
"pytest-django",
"code-annotations",
"edx-django-utils",
"django-extensions",
]
# Current default Django version used by quality, docs, and the default test
# matrix entry. When adding or retiring a Django version from the matrix, see
# docs/how-tos/adding-a-matrix-dependency.rst for the full process.
test = [
{include-group = "test-base"},
"Django>=5.0,<6.0",
]
django60 = [
{include-group = "test-base"},
"Django>=6.0,<7.0",
]
quality = [
{include-group = "test"},
"edx-lint",
"isort",
"pycodestyle",
"pydocstyle",
]
doc = [
{include-group = "test"},
"doc8",
"sphinx-book-theme",
"twine",
"build",
"Sphinx",
]
ci = [
"tox",
"tox-uv",
]
dev = [
{include-group = "quality"},
{include-group = "ci"},
"diff-cover",
"edx-i18n-tools",
]

[tool.setuptools.dynamic]
readme = {file = ["README.md"], content-type = "text/markdown" }
dependencies = {file = "requirements/base.in"}

[tool.setuptools.packages.find]
include = ["sample_plugin*"]
Expand All @@ -62,3 +116,29 @@ minor_tags = ["feat", "docs"]
root = ".."
version_scheme = 'only-version'
local_scheme = 'no-local-version'

[tool.uv]
# Each entry lists groups with mutually exclusive version requirements so uv can
# produce a single uv.lock that contains a separate resolution for each. Add a
# new pair here whenever you add a legacy-version group to [dependency-groups].
# See docs/how-tos/adding-a-matrix-dependency.rst for the full process.
conflicts = [
[{group = "test"}, {group = "django60"}],
]
# DO NOT EDIT constraint-dependencies DIRECTLY.
# This list is managed by `edx_lint write_uv_constraints`
# and will be overwritten the next time `make upgrade` is run.
# - GLOBAL constraints: edit edx_lint/files/common_constraints.txt
# - REPO-SPECIFIC constraints: edit [tool.edx_lint].uv_constraints in this file
constraint-dependencies = [
"Django<7.0",
"elasticsearch<7.14.0",
]

[tool.edx_lint]
# Repo-specific uv constraints merged with edx-lint's global constraints.
# Local entries override global ones for the same package.
# Run `make upgrade` to regenerate [tool.uv].constraint-dependencies.
uv_constraints = [
"Django<7.0", # this repo tests against Django 6.x; overrides the global Django<6.0 constraint
]
9 changes: 0 additions & 9 deletions backend/requirements/base.in

This file was deleted.

74 changes: 0 additions & 74 deletions backend/requirements/base.txt

This file was deleted.

5 changes: 0 additions & 5 deletions backend/requirements/ci.in

This file was deleted.

34 changes: 0 additions & 34 deletions backend/requirements/ci.txt

This file was deleted.

12 changes: 0 additions & 12 deletions backend/requirements/constraints.txt

This file was deleted.

9 changes: 0 additions & 9 deletions backend/requirements/dev.in

This file was deleted.

Loading
Loading