Skip to content

Commit 14e3d2a

Browse files
farhanclaude
andcommitted
feat: migrate to uv, pyproject.toml, and PEP 735 dependency groups
- 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 - Update tox.ini to use tox-uv>=1 and uv-venv-lock-runner - Update CI to use astral-sh/setup-uv; SHA-pin all actions - Migrate .coveragerc config into pyproject.toml - Update Makefile: upgrade → uv lock --upgrade; requirements → uv sync - Remove requirements/ directory and stale config files - Retain pylint/isort/pycodestyle/pydocstyle/mypy as quality linters - Add doc8 to doc dependency group; remove stale *.py glob from quality target Part of openedx/public-engineering#506 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 180db98 commit 14e3d2a

27 files changed

Lines changed: 3004 additions & 1618 deletions

.coveragerc

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,41 @@
1-
name: Run all tests & checks
1+
name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
workflow_call:
88

99
jobs:
1010
run_tests:
11-
name: tests
11+
name: ${{ matrix.toxenv }}
1212
runs-on: ubuntu-latest
1313
strategy:
14+
fail-fast: false
1415
matrix:
15-
python-version: [ '3.12' ]
16-
permissions:
17-
# Gives the action the necessary permissions for publishing new
18-
# comments in pull requests.
19-
pull-requests: write
20-
# Gives the action the necessary permissions for pushing data to the
21-
# python-coverage-comment-action branch, and for editing existing
22-
# comments (to avoid publishing multiple comments in the same PR)
23-
contents: write
16+
python-version: ["3.12"]
17+
toxenv: [py312]
2418

2519
steps:
26-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
27-
- name: setup python
28-
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
20+
- name: Checkout repository
21+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
22+
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
2925
with:
30-
python-version: ${{ matrix.python-version }}
26+
enable-cache: true
27+
python-version: "${{ matrix.python-version }}"
3128

32-
- name: Install pip
33-
run: pip install -r requirements/pip.txt
29+
- name: Install CI dependencies
30+
run: uv sync --group ci
3431

35-
- name: Install Dependencies
36-
run: pip install -r requirements/ci.txt
32+
- name: Run tox
33+
run: uv run tox -e ${{ matrix.toxenv }}
3734

38-
- name: Run Tests
39-
run: tox
35+
- name: Upload coverage to Codecov
36+
if: matrix.toxenv == 'py312'
37+
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2
38+
with:
39+
token: ${{ secrets.CODECOV_TOKEN }}
40+
flags: unittests
41+
fail_ci_if_error: true

MANIFEST.in

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
include CHANGELOG.rst
2-
include LICENSE.txt
3-
include README.rst
4-
include requirements/base.in
5-
include requirements/constraints.txt
6-
recursive-include xapi-db-load *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.csv
1+
# Exclude development, test, and documentation folders
2+
prune .github
3+
prune docs
4+
prune tests
5+
6+
# Exclude root level configuration and build files
7+
exclude Makefile
8+
exclude conftest.py
9+
exclude .gitignore
10+
exclude tox.ini

Makefile

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,40 +29,24 @@ docs: ## generate Sphinx HTML documentation, including API docs
2929
tox -e docs
3030
$(BROWSER)docs/_build/html/index.html
3131

32-
# Define PIP_COMPILE_OPTS=-v to get more information during make upgrade.
33-
PIP_COMPILE = pip-compile --upgrade $(PIP_COMPILE_OPTS)
34-
35-
upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
36-
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
37-
pip install -r requirements/pip-tools.txt
38-
pip install -qr requirements/pip.txt
39-
# Make sure to compile files after any other files they include!
40-
$(PIP_COMPILE) --allow-unsafe --rebuild -o requirements/pip.txt requirements/pip.in
41-
$(PIP_COMPILE) -o requirements/pip-tools.txt requirements/pip-tools.in
42-
pip install -qr requirements/pip.txt
43-
pip install -r requirements/pip-tools.txt
44-
$(PIP_COMPILE) -o requirements/base.txt requirements/base.in
45-
$(PIP_COMPILE) -o requirements/test.txt requirements/test.in
46-
$(PIP_COMPILE) -o requirements/doc.txt requirements/doc.in
47-
$(PIP_COMPILE) -o requirements/quality.txt requirements/quality.in
48-
$(PIP_COMPILE) -o requirements/ci.txt requirements/ci.in
49-
$(PIP_COMPILE) -o requirements/dev.txt requirements/dev.in
32+
upgrade: ## update the uv.lock file with the latest packages satisfying pyproject.toml
33+
uv run --with edx-lint edx_lint write_uv_constraints pyproject.toml
34+
uv lock --upgrade
5035

5136
quality: ## check coding style with pycodestyle and pylint
52-
pylint xapi_db_load *.py
53-
pycodestyle xapi_db_load *.py
54-
pydocstyle xapi_db_load *.py
37+
pylint xapi_db_load
38+
pycodestyle xapi_db_load
39+
pydocstyle xapi_db_load
5540
mypy xapi_db_load
56-
isort --check-only --diff --recursive xapi_db_load *.py test_settings.py
57-
python setup.py bdist_wheel
41+
isort --check-only --diff xapi_db_load
42+
uv run python -m build
5843
twine check dist/*
5944
make selfcheck
6045

6146

6247
requirements: ## install development environment requirements
63-
pip install -r requirements/pip.txt
64-
pip install -r requirements/pip-tools.txt
65-
pip-sync requirements/dev.txt requirements/private.*
48+
uv sync --group dev
49+
uv tool install tox --with tox-uv
6650

6751
test: clean ## run tests in the current virtualenv
6852
pytest

pyproject.toml

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "xapi-db-load"
7+
version = "3.1.0"
8+
description = "Loads testing xAPI events into databases and LRSs"
9+
readme = "README.rst"
10+
requires-python = ">=3.12"
11+
license = "AGPL-3.0"
12+
license-files = ["LICENSE.txt"]
13+
authors = [
14+
{name = "Open edX Project", email = "oscm@openedx.org"},
15+
]
16+
classifiers = [
17+
"Development Status :: 3 - Alpha",
18+
"Intended Audience :: Developers",
19+
"Operating System :: OS Independent",
20+
"Programming Language :: Python",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3.12",
23+
]
24+
keywords = ["Python", "edx"]
25+
dependencies = [
26+
"chdb",
27+
"click",
28+
"clickhouse-connect[async]",
29+
"pyarrow",
30+
"pyyaml",
31+
"requests",
32+
"smart_open[s3]",
33+
"urwid",
34+
"uvloop",
35+
]
36+
37+
[project.scripts]
38+
xapi-db-load = "xapi_db_load.main:cli"
39+
40+
[project.urls]
41+
Repository = "https://github.com/openedx/xapi-db-load"
42+
"Issue tracker" = "https://github.com/openedx/xapi-db-load/issues"
43+
44+
[tool.setuptools]
45+
include-package-data = true
46+
47+
[tool.setuptools.packages.find]
48+
exclude = ["tests*", "*.tests", "*.tests.*"]
49+
50+
[tool.setuptools.package-data]
51+
"*" = [
52+
"conf/**/*",
53+
"public/**/*",
54+
"static/**/*",
55+
"templates/**/*",
56+
"translations/**/*",
57+
]
58+
59+
[dependency-groups]
60+
# Each group mirrors its requirements/*.in file exactly.
61+
# "-r other.in" in the .in file → {include-group = "other"} here.
62+
63+
# From requirements/test.in
64+
test = [
65+
{include-group = "base"},
66+
"pytest-asyncio",
67+
"pytest-cov",
68+
]
69+
70+
# From requirements/quality.in
71+
quality = [
72+
{include-group = "test"},
73+
"edx-lint",
74+
"isort",
75+
"mypy",
76+
"pycodestyle",
77+
"pydocstyle",
78+
"twine",
79+
]
80+
81+
# From requirements/doc.in
82+
doc = [
83+
{include-group = "test"},
84+
"build",
85+
"doc8",
86+
"Sphinx",
87+
"sphinx-book-theme",
88+
"twine",
89+
]
90+
91+
# From requirements/ci.in
92+
ci = [
93+
"tox",
94+
"tox-uv",
95+
]
96+
97+
# From requirements/dev.in (without pip-tools since that's replaced by uv)
98+
dev = [
99+
{include-group = "quality"},
100+
{include-group = "ci"},
101+
"diff-cover",
102+
]
103+
104+
# base group (mirrors base.in — used via include-group from test)
105+
base = [
106+
"chdb",
107+
"click",
108+
"clickhouse-connect[async]",
109+
"pyarrow",
110+
"pyyaml",
111+
"requests",
112+
"smart_open[s3]",
113+
"urwid",
114+
"uvloop",
115+
]
116+
117+
[tool.edx_lint]
118+
uv_constraints = []
119+
120+
[tool.uv]
121+
package = true
122+
123+
# DO NOT EDIT constraint-dependencies DIRECTLY.
124+
# This list is managed by `edx_lint write_uv_constraints`
125+
# and will be overwritten the next time `make upgrade` is run.
126+
# - GLOBAL constraints: edit edx_lint/files/common_constraints.txt
127+
# - REPO-SPECIFIC constraints: edit [tool.edx_lint].uv_constraints in this file
128+
constraint-dependencies = [
129+
"Django<6.0",
130+
"elasticsearch<7.14.0",
131+
]
132+
[tool.coverage.run]
133+
branch = true
134+
data_file = ".coverage"
135+
source = ["xapi_db_load"]
136+
omit = [
137+
"tests",
138+
]
139+
140+
[tool.coverage.report]
141+
show_missing = true
142+
143+
[tool.pytest.ini_options]
144+
addopts = "--cov xapi_db_load --cov-report term-missing --cov-report xml --log-level=INFO"
145+
norecursedirs = [".* docs requirements site-packages"]
146+
147+
[tool.isort]
148+
include_trailing_comma = true
149+
indent = " "
150+
line_length = 120
151+
multi_line_output = 3
152+
skip = ["migrations"]
153+
154+
[tool.mypy]
155+
python_version = "3.12"
156+
ignore_missing_imports = true
157+
check_untyped_defs = false
158+
warn_unused_ignores = true
159+
exclude = ["^docs/", "^build/", "^dist/"]
160+
161+
[[tool.mypy.overrides]]
162+
module = "xapi_db_load.tests.*"
163+
ignore_errors = true

requirements/base.in

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)