From 175af819b20c4ff8f198b95e9cdee026899b9a07 Mon Sep 17 00:00:00 2001 From: Kyle D McCormick Date: Tue, 16 Jun 2026 11:08:58 -0400 Subject: [PATCH] build!: Declare Python dependencies in pyproject.toml Before this change, openedx-platform deps had to be installed in two steps (using `pip` or `uv pip`): # first, install dependencies. one of the following: pip install -r requirements/edx/base.txt pip install -r requirements/edx/development.txt pip install -r requirements/edx/testing.txt pip install -r requirements/edx/doc.txt # then, compile metadata for entrypoints: pip install -e . Now, with the dependencies listed in pyproject.toml, it's only one step: # one of the following: pip install -e '.' pip install -e '.[development]' pip install -e '.[testing]' pip install -e '.[doc]' BREAKING CHANGE: Running `pip install -e .` or other similar commands will now install all of openedx-platform's base dependencies. This command used to run very quickly, but now it will take longer, you may want to adjust the command's position in your build scripts. Otherwise, this change is backwards-compatible; it is still fine to run both `pip install -r ` and `pip install -e .`, just redundant. This brings the project more in line with Python standards and will make it easier to install and run the platform outside of an environment manager like Tutor. Note that this commit does NOT do anything to install build dependencies (assets.txt) in a more standard way; that could be a future work. Bumps version to 0.14 --- .github/workflows/static-assets-check.yml | 2 +- Makefile | 15 ++++----------- README.rst | 4 ++-- docs/references/static-assets.rst | 2 +- pyproject.toml | 12 ++++++++++-- scripts/watch_sass.sh | 2 +- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.github/workflows/static-assets-check.yml b/.github/workflows/static-assets-check.yml index 41159e3526c5..ce6255c6de02 100644 --- a/.github/workflows/static-assets-check.yml +++ b/.github/workflows/static-assets-check.yml @@ -99,7 +99,7 @@ jobs: - name: Install Full Python Deps for Collection run: | - pip install -r requirements/edx/base.txt -e . + pip install -e . - name: Check Assets Collection env: diff --git a/Makefile b/Makefile index 98931cb608d2..1471e80700dd 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ .PHONY: base-requirements check-types clean \ compile-requirements detect_changed_source_translations dev-requirements \ docs extract_translations \ - guides help lint-imports local-requirements migrate migrate-lms migrate-cms \ + guides help lint-imports migrate migrate-lms migrate-cms \ pre-requirements pull pull_xblock_translations pull_translations push_translations \ requirements shell swagger \ technical-docs test-requirements ubuntu-requirements upgrade-package upgrade @@ -67,23 +67,16 @@ detect_changed_source_translations: ## check if translation files are up-to-date pre-requirements: ## install Python requirements for running pip-tools pip install -r requirements/pip-tools.txt -local-requirements: -# edx-platform installs some Python projects from within the edx-platform repo itself. - pip install -e . - dev-requirements: pre-requirements @# The "$(wildcard..)" is to include private.txt if it exists, and make no mention @# of it if it does not. Shell wildcarding can't do that with default options. - pip-sync requirements/edx/development.txt $(wildcard requirements/edx/private.txt) - make local-requirements + pip install -e '.[development]' $(wildcard requirements/edx/private.txt) base-requirements: pre-requirements - pip-sync requirements/edx/base.txt - make local-requirements + pip install -e '.' test-requirements: pre-requirements - pip-sync --pip-args="--exists-action=w" requirements/edx/testing.txt - make local-requirements + pip install -e '.[testing]' requirements: dev-requirements ## install development environment requirements diff --git a/README.rst b/README.rst index 1e404c53dd49..9016dac59c71 100644 --- a/README.rst +++ b/README.rst @@ -103,8 +103,8 @@ Language Packages: * Backend application: - - ``pip install -r requirements/edx/base.txt`` (production) - - ``pip install -r requirements/edx/development.txt`` (development) + - ``pip install -e '.'`` (production) + - ``pip install -e '.[dev]'`` (development) Some Python packages have system dependencies. For example, installing these packages on Debian or Ubuntu will require first running ``sudo apt install python3-dev default-libmysqlclient-dev build-essential pkg-config`` to satisfy the requirements of the ``mysqlclient`` Python package. diff --git a/docs/references/static-assets.rst b/docs/references/static-assets.rst index 9a3e3c25b663..faf05ec1180e 100644 --- a/docs/references/static-assets.rst +++ b/docs/references/static-assets.rst @@ -139,7 +139,7 @@ skip this section. First, ensure you have a Python enironment with all edx-platform dependencies installed:: - pip install -r requirements/edx/base.txt -e . + pip install -e . Next, download localized versions of edx-platform assets. Under the hood, this command uses the `Open edX Atlas`_ tool, which manages aggregated translations diff --git a/pyproject.toml b/pyproject.toml index 44488938ec95..ca892f8f17f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,13 +4,21 @@ build-backend = "setuptools.build_meta" [project] name = "openedx-platform" -version = "0.13" +version = "0.14" requires-python = ">=3.12" -dependencies = ["setuptools"] +dynamic = ["dependencies", "optional-dependencies"] [tool.setuptools] packages = ["cms", "common", "lms", "openedx", "xmodule"] +[tool.setuptools.dynamic] +dependencies = { file = ["requirements/edx/base.txt"] } + +[tool.setuptools.dynamic.optional-dependencies] +development = { file = ["requirements/edx/development.txt"] } +testing = { file = ["requirements/edx/testing.txt"] } +dos = { file = ["requirements/edx/doc.txt"] } + [tool.setuptools.package-data] xmodule = ["js/module/*"] diff --git a/scripts/watch_sass.sh b/scripts/watch_sass.sh index 58bc3259767d..567ea8a3faf4 100755 --- a/scripts/watch_sass.sh +++ b/scripts/watch_sass.sh @@ -70,7 +70,7 @@ fi if ! type watchmedo 1>/dev/null 2>&1 ; then error "command not found: watchmedo" log "The \`watchdog\` Python package is probably not installed. You can install it with:" - log " pip install -r requirements/edx/development.txt" + log " pip install -e '.[dev]'" exit 1 fi