Skip to content
Open
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
10 changes: 8 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
version: 2
updates:
# Adding new check for github-actions
# Adding new check for github-actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
interval: "weekly"
reviewers:
- "feanil"

# Python dependencies (pyproject.toml)
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
28 changes: 15 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,28 @@ on:

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version:
- '3.12'
- "3.12"

steps:
- uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- 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
with:
enable-cache: true

- name: Install Dependencies
run: make dev-install
- name: Install Dependencies
run: uv sync --all-extras --dev

- name: Run Tests
run: make test
- name: Run Tests
run: uv run pytest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
auth.yaml
venv
.venv
*.pyc
*~

Expand Down
33 changes: 13 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help clean test dev-install install upgrade lint
.PHONY: help clean test dev-install install upgrade lint sync sync-constraints

help: ## display this help message
@echo "Please use \`make <target>' where <target> is one of"
Expand All @@ -12,30 +12,23 @@ clean: ## remove transient artifacts
find . -name '*~' -exec rm -f {} +

test: ## run the tests
pytest
uv run pytest

dev-install: ## install everything to develop here
pip install -e .[dev]
dev-install: ## install everything to develop here (legacy command, use 'sync' instead)
uv sync --all-extras --dev

install: ## install everything to run the tools
pip install -r requirements/base.txt
pip install -e .
uv sync

COMMON_CONSTRAINTS_TXT=requirements/common_constraints.txt
.PHONY: $(COMMON_CONSTRAINTS_TXT)
$(COMMON_CONSTRAINTS_TXT):
wget -O "$(@)" https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt || touch "$(@)"
sync: ## sync dependencies from uv.lock file
uv sync --all-extras --dev

sync-constraints: ## download and sync common_constraints.txt to pyproject.toml
uv run python sync_constraints.py

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip install -qr requirements/pip-tools.txt
pip-compile --upgrade --allow-unsafe --rebuild -o requirements/pip.txt requirements/pip.in
pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -qr requirements/pip.txt
pip install -qr requirements/pip-tools.txt
pip-compile --upgrade -o requirements/base.txt requirements/base.in
pip-compile --upgrade -o requirements/development.txt requirements/development.in
for fextra in edx_repo_tools/*/extra.in; do pip-compile --upgrade -o $${fextra%.in}.txt $$fextra; done
upgrade: sync-constraints ## update the uv.lock file with the latest packages (syncs constraints first)
uv lock --upgrade

lint: ## run pylint
pylint *.py edx_repo_tools tests
uv run pylint *.py edx_repo_tools tests
86 changes: 74 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,44 +29,106 @@ the token that appears. Paste it into your ~/.netrc in the "password" entry.
Working in the repo
===================

This project uses `uv <https://docs.astral.sh/uv/>`_ for dependency management.
See details at `UV_QUICK_REFERENCE <UV_QUICK_REFERENCE.md>`_

To work on these tools:

1. Use a virtualenv.
1. Install uv if you haven't already::

curl -LsSf https://astral.sh/uv/install.sh | sh

2. Install dependencies::

make dev-install
make sync

Or directly with uv::

uv sync --all-extras --dev

3. Run tests::

make test

4. Older tools were Python files run from the root of the repo. Now we are
being more disciplined and putting code into importable modules with entry
points in setup.py.
points in pyproject.toml.

5. Simple tools can go into an existing subdirectory of edx_repo_tools. Follow
the structure of existing tools you find here. More complex tools, or ones
that need unusual third-party requirements, should go into a new
subdirectory of edx_repo_tools.

6. Add a new `entry_point` in setup.py for your command:
6. Add a new entry point in pyproject.toml under ``[project.scripts]`` for your command:

.. code::

entry_points={
'console_scripts': [
...
'new_tool = edx_repo_tools.new_tool_dir.new_tool:main',
...
[project.scripts]
new_tool = "edx_repo_tools.new_tool_dir.new_tool:main"

7. If your tool needs additional third-party requirements, add them to the
``[project.optional-dependencies]`` section in pyproject.toml with a name
matching your tool. For example::

[project.optional-dependencies]
new_tool = [
"some-package",
"another-package",
]

Users can then install your tool with::

uv sync --extra new_tool

Updating Dependencies
=====================

To update all dependencies to their latest compatible versions::

make upgrade

This command will:
1. Sync common constraints from edx-lint repository
2. Update the ``uv.lock`` file with the latest versions

7. If your tool is in its own directory, you can create an `extra.in` file
there with third-party requirements intended just for your tool. This will
automatically create an installable "extra" for your requirements.
Or you can run the steps manually::

make sync-constraints # Sync organization-wide constraints
uv lock --upgrade # Update lock file

Managing Constraints
====================

This repository uses organization-wide constraints from the edx-lint repository
to ensure consistency across all Open edX projects. These constraints (like
``Django<6.0``) are automatically downloaded and applied.

To manually sync constraints::

make sync-constraints

Or directly::

uv run python sync_constraints.py

**Important**: Do not manually edit the ``[tool.uv.constraint-dependencies]``
section in pyproject.toml. Use the ``sync_constraints.py`` script to update
constraints, which preserves local constraints while updating common ones.

Active Tools
============

check_requirements_failures
----------------------------

Check repositories in a GitHub organization for the status of their automated
Python requirements upgrade workflows. This tool tracks the failure rate of
the last 10 workflow runs, when requirements PRs were last merged, and release
information. This helps identify repositories where the upgrade workflow may be
failing or stalled.

See the `check_requirements_failures README <edx_repo_tools/check_requirements_failures/README.rst>`_ in its subfolder.

repo_checks
-----------

Expand Down
Loading
Loading