Skip to content

Commit 0b82eb5

Browse files
farhanclaude
andcommitted
Modernize repo: 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 Part of openedx/public-engineering#506 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 180db98 commit 0b82eb5

27 files changed

Lines changed: 2971 additions & 1615 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: [quality, docs, 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: 7 additions & 23 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
5237
pylint xapi_db_load *.py
5338
pycodestyle xapi_db_load *.py
5439
pydocstyle xapi_db_load *.py
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 --recursive xapi_db_load *.py
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: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
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+
"Sphinx",
86+
"sphinx-book-theme",
87+
"twine",
88+
]
89+
90+
# From requirements/ci.in
91+
ci = [
92+
"tox",
93+
"tox-uv",
94+
]
95+
96+
# From requirements/dev.in (without pip-tools since that's replaced by uv)
97+
dev = [
98+
{include-group = "quality"},
99+
{include-group = "ci"},
100+
"diff-cover",
101+
]
102+
103+
# base group (mirrors base.in — used via include-group from test)
104+
base = [
105+
"chdb",
106+
"click",
107+
"clickhouse-connect[async]",
108+
"pyarrow",
109+
"pyyaml",
110+
"requests",
111+
"smart_open[s3]",
112+
"urwid",
113+
"uvloop",
114+
]
115+
116+
[tool.edx_lint]
117+
uv_constraints = []
118+
119+
[tool.uv]
120+
package = true
121+
122+
# DO NOT EDIT constraint-dependencies DIRECTLY.
123+
# This list is managed by `edx_lint write_uv_constraints`
124+
# and will be overwritten the next time `make upgrade` is run.
125+
# - GLOBAL constraints: edit edx_lint/files/common_constraints.txt
126+
# - REPO-SPECIFIC constraints: edit [tool.edx_lint].uv_constraints in this file
127+
constraint-dependencies = [
128+
"Django<6.0",
129+
"elasticsearch<7.14.0",
130+
]
131+
[tool.coverage.run]
132+
branch = true
133+
data_file = ".coverage"
134+
source = ["xapi_db_load"]
135+
omit = [
136+
"tests",
137+
]
138+
139+
[tool.coverage.report]
140+
show_missing = true
141+
142+
[tool.pytest.ini_options]
143+
addopts = "--cov xapi_db_load --cov-report term-missing --cov-report xml --log-level=INFO"
144+
norecursedirs = [".* docs requirements site-packages"]
145+
146+
[tool.isort]
147+
include_trailing_comma = true
148+
indent = " "
149+
line_length = 120
150+
multi_line_output = 3
151+
skip = ["migrations"]
152+
153+
[tool.mypy]
154+
python_version = "3.12"
155+
ignore_missing_imports = true
156+
check_untyped_defs = false
157+
warn_unused_ignores = true
158+
exclude = ["^docs/", "^build/", "^dist/"]
159+
160+
[[tool.mypy.overrides]]
161+
module = "xapi_db_load.tests.*"
162+
ignore_errors = true

requirements/base.in

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

0 commit comments

Comments
 (0)