Skip to content

Commit 3d4f002

Browse files
farhanclaude
andcommitted
feat: modernize to uv + pyproject.toml (PEP 621/735)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 180db98 commit 3d4f002

43 files changed

Lines changed: 3036 additions & 1745 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.coveragerc

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

.github/workflows/ci.yml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,41 @@ on:
44
push:
55
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:
18+
- py312
19+
- quality
20+
- mypy
21+
- docs
2422

2523
steps:
2624
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
27-
- name: setup python
28-
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
25+
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
2928
with:
30-
python-version: ${{ matrix.python-version }}
29+
enable-cache: true
30+
python-version: "${{ matrix.python-version }}"
3131

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

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

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

.readthedocs.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ version: 2
99
sphinx:
1010
configuration: docs/conf.py
1111

12+
build:
13+
os: "ubuntu-lts-latest"
14+
tools:
15+
python: "3.12"
16+
1217
python:
13-
version: 3.12
1418
install:
15-
- requirements: requirements/doc.txt
19+
- method: pip
20+
path: .
21+
extra_requirements:
22+
- docs

MANIFEST.in

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
include CHANGELOG.rst
22
include LICENSE.txt
33
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
4+
recursive-include xapi_db_load *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.csv

Makefile

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.PHONY: clean compile_translations coverage diff_cover docs dummy_translations \
22
extract_translations fake_translations help \
3-
quality requirements selfcheck test test-all upgrade validate
3+
mypy quality requirements selfcheck test test-all upgrade validate
44

55
.DEFAULT_GOAL := help
66

@@ -26,52 +26,38 @@ coverage: clean ## generate and view HTML coverage report
2626
$(BROWSER)htmlcov/index.html
2727

2828
docs: ## generate Sphinx HTML documentation, including API docs
29-
tox -e docs
29+
uv run 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 --ignore=tests 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+
python -m build
5843
twine check dist/*
5944
make selfcheck
6045

46+
mypy: ## run mypy type checking
47+
uv run tox -e mypy
6148

6249
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.*
50+
uv sync --group dev
51+
uv tool install tox --with tox-uv
6652

6753
test: clean ## run tests in the current virtualenv
6854
pytest
6955

7056
diff_cover: test ## find diff lines that need test coverage
7157
diff-cover coverage.xml
7258

73-
test-all: quality ## run tests on every supported Python/Django combination
74-
tox
59+
test-all: quality ## run tests on every supported Python combination
60+
uv run tox
7561

7662
validate: quality test ## run tests and quality checks
7763

docs/conf.py

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,16 @@
1212
serve to show the default.
1313
"""
1414
import os
15-
import re
1615
import sys
17-
from datetime import datetime, UTC
16+
from datetime import UTC, datetime
17+
from importlib.metadata import version as get_version
1818
from subprocess import check_call
1919

2020

21-
def get_version(*file_paths):
22-
"""
23-
Extract the version string from the file.
24-
25-
Input:
26-
- file_paths: relative path fragments to file with
27-
version string
28-
"""
29-
filename = os.path.join(os.path.dirname(__file__), *file_paths)
30-
version_file = open(filename, encoding="utf8").read()
31-
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
32-
if version_match:
33-
return version_match.group(1)
34-
raise RuntimeError("Unable to find version string.")
35-
36-
3721
REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
3822
sys.path.append(REPO_ROOT)
3923

40-
VERSION = get_version("../xapi_db_load", "__init__.py")
24+
VERSION = get_version("xapi-db-load")
4125

4226

4327
# If extensions (or modules to document with autodoc) are in another directory,

docs/xapi_db_load.backends.rst

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,6 @@
11
xapi\_db\_load.backends package
22
===============================
33

4-
Submodules
5-
----------
6-
7-
xapi\_db\_load.backends.citus\_lake module
8-
------------------------------------------
9-
10-
.. automodule:: xapi_db_load.backends.citus_lake
11-
:members:
12-
:undoc-members:
13-
:show-inheritance:
14-
15-
xapi\_db\_load.backends.clickhouse\_lake module
16-
-----------------------------------------------
17-
18-
.. automodule:: xapi_db_load.backends.clickhouse_lake
19-
:members:
20-
:undoc-members:
21-
:show-inheritance:
22-
23-
xapi\_db\_load.backends.mongo\_lake module
24-
------------------------------------------
25-
26-
.. automodule:: xapi_db_load.backends.mongo_lake
27-
:members:
28-
:undoc-members:
29-
:show-inheritance:
30-
31-
xapi\_db\_load.backends.ralph\_lrs module
32-
-----------------------------------------
33-
34-
.. automodule:: xapi_db_load.backends.ralph_lrs
35-
:members:
36-
:undoc-members:
37-
:show-inheritance:
38-
394
Module contents
405
---------------
416

docs/xapi_db_load.rst

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ Subpackages
88
:maxdepth: 4
99

1010
xapi_db_load.backends
11+
xapi_db_load.fixtures
12+
xapi_db_load.tests
13+
xapi_db_load.ui
1114
xapi_db_load.xapi
1215

1316
Submodules
@@ -21,14 +24,6 @@ xapi\_db\_load.course\_configs module
2124
:undoc-members:
2225
:show-inheritance:
2326

24-
xapi\_db\_load.generate\_load module
25-
------------------------------------
26-
27-
.. automodule:: xapi_db_load.generate_load
28-
:members:
29-
:undoc-members:
30-
:show-inheritance:
31-
3227
xapi\_db\_load.main module
3328
--------------------------
3429

openedx.yaml

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

pylintrc

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
# SERIOUSLY.
6565
#
6666
# ------------------------------
67-
# Generated by edx-lint version: 5.3.0
67+
# Generated by edx-lint version: 6.1.0
6868
# ------------------------------
6969
[MASTER]
7070
ignore = migrations
@@ -259,6 +259,7 @@ enable =
259259
useless-suppression,
260260
disable =
261261
bad-indentation,
262+
broad-exception-raised,
262263
consider-using-f-string,
263264
duplicate-code,
264265
file-ignored,
@@ -288,6 +289,26 @@ disable =
288289
logging-fstring-interpolation,
289290
consider-using-with,
290291
bad-option-value,
292+
abstract-method,
293+
arguments-differ,
294+
missing-class-docstring,
295+
attribute-defined-outside-init,
296+
unused-argument,
297+
unused-variable,
298+
line-too-long,
299+
broad-exception-caught,
300+
super-with-arguments,
301+
too-many-positional-arguments,
302+
redefined-builtin,
303+
use-implicit-booleaness-not-len,
304+
consider-using-sys-exit,
305+
consider-using-generator,
306+
use-a-generator,
307+
chained-comparison,
308+
consider-using-in,
309+
import-outside-toplevel,
310+
use-list-literal,
311+
consider-using-enumerate,
291312

292313
[REPORTS]
293314
output-format = text
@@ -382,6 +403,6 @@ ext-import-graph =
382403
int-import-graph =
383404

384405
[EXCEPTIONS]
385-
overgeneral-exceptions = Exception
406+
overgeneral-exceptions = builtins.Exception
386407

387-
# 48c3d6307c06374a19e66f30d8c6cdcbd3421ae3
408+
# 4973a70539efa69f38de8a39d9d0181f6a74e953

0 commit comments

Comments
 (0)