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
6 changes: 0 additions & 6 deletions .coveragerc

This file was deleted.

48 changes: 25 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
name: Run all tests & checks
name: CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
workflow_call:

jobs:
run_tests:
name: tests
name: ${{ matrix.toxenv }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: [ '3.12' ]
permissions:
# Gives the action the necessary permissions for publishing new
# comments in pull requests.
pull-requests: write
# Gives the action the necessary permissions for pushing data to the
# python-coverage-comment-action branch, and for editing existing
# comments (to avoid publishing multiple comments in the same PR)
contents: write
python-version: ["3.12"]
toxenv: [py]

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: setup python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install uv
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
python-version: "${{ matrix.python-version }}"

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

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

- name: Run Tests
run: tox
- name: Upload coverage to Codecov
if: matrix.toxenv == 'py' && matrix.python-version == '3.12'
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true
4 changes: 1 addition & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
include CHANGELOG.rst
include LICENSE.txt
include README.rst
include requirements/base.in
include requirements/constraints.txt
recursive-include xapi-db-load *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.csv
recursive-include xapi_db_load *.html *.png *.gif *.js *.css *.jpg *.jpeg *.svg *.csv
36 changes: 10 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,40 +29,24 @@ docs: ## generate Sphinx HTML documentation, including API docs
tox -e docs
$(BROWSER)docs/_build/html/index.html

# Define PIP_COMPILE_OPTS=-v to get more information during make upgrade.
PIP_COMPILE = pip-compile --upgrade $(PIP_COMPILE_OPTS)

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip install -r requirements/pip-tools.txt
pip install -qr requirements/pip.txt
# Make sure to compile files after any other files they include!
$(PIP_COMPILE) --allow-unsafe --rebuild -o requirements/pip.txt requirements/pip.in
$(PIP_COMPILE) -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -qr requirements/pip.txt
pip install -r requirements/pip-tools.txt
$(PIP_COMPILE) -o requirements/base.txt requirements/base.in
$(PIP_COMPILE) -o requirements/test.txt requirements/test.in
$(PIP_COMPILE) -o requirements/doc.txt requirements/doc.in
$(PIP_COMPILE) -o requirements/quality.txt requirements/quality.in
$(PIP_COMPILE) -o requirements/ci.txt requirements/ci.in
$(PIP_COMPILE) -o requirements/dev.txt requirements/dev.in
upgrade: ## update the uv.lock file with the latest packages satisfying pyproject.toml
uv run --with edx-lint edx_lint write_uv_constraints pyproject.toml
uv lock --upgrade

quality: ## check coding style with pycodestyle and pylint
pylint xapi_db_load *.py
pycodestyle xapi_db_load *.py
pydocstyle xapi_db_load *.py
pylint xapi_db_load
pycodestyle xapi_db_load
pydocstyle xapi_db_load
mypy xapi_db_load
isort --check-only --diff --recursive xapi_db_load *.py test_settings.py
python setup.py bdist_wheel
isort --check-only --diff xapi_db_load
uv run python -m build
twine check dist/*
make selfcheck


requirements: ## install development environment requirements
pip install -r requirements/pip.txt
pip install -r requirements/pip-tools.txt
pip-sync requirements/dev.txt requirements/private.*
uv sync --group dev
uv tool install tox --with tox-uv

test: clean ## run tests in the current virtualenv
pytest
Expand Down
12 changes: 0 additions & 12 deletions codecov.yml

This file was deleted.

27 changes: 5 additions & 22 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,15 @@
serve to show the default.
"""
import os
import re
import sys
from datetime import datetime, UTC
from importlib.metadata import PackageNotFoundError, version
from subprocess import check_call


def get_version(*file_paths):
"""
Extract the version string from the file.

Input:
- file_paths: relative path fragments to file with
version string
"""
filename = os.path.join(os.path.dirname(__file__), *file_paths)
version_file = open(filename, encoding="utf8").read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")


REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(REPO_ROOT)

VERSION = get_version("../xapi_db_load", "__init__.py")
try:
VERSION = version("xapi-db-load")
except PackageNotFoundError:
VERSION = "unknown"


# If extensions (or modules to document with autodoc) are in another directory,
Expand Down
141 changes: 141 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "xapi-db-load"
version = "3.1.0"
description = "Loads testing xAPI events into databases and LRSs"
requires-python = ">=3.12"
license = "AGPL-3.0"
license-files = ["LICENSE.txt"]
authors = [
{name = "Open edX Project", email = "oscm@openedx.org"},
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
]
keywords = ["Python", "edx"]
readme = "README.rst"

dependencies = [
"chdb",
"click",
"clickhouse-connect[async]",
"pyarrow",
"pyyaml",
"requests",
"smart_open[s3]",
"urwid",
"uvloop",
]

[project.scripts]
xapi-db-load = "xapi_db_load.main:cli"

[project.urls]
Repository = "https://github.com/openedx/xapi-db-load"
"Issue tracker" = "https://github.com/openedx/xapi-db-load/issues"

[tool.setuptools.packages.find]
exclude = ["docs*"]

[dependency-groups]
# Each group mirrors its requirements/*.in file exactly.
# "-r other.in" in the .in file → {include-group = "other"} here.

# From requirements/test.in
test = [
"pytest-asyncio",
"pytest-cov",
]

# From requirements/quality.in
quality = [
{include-group = "test"},
"edx-lint",
"isort",
"mypy",
"pycodestyle",
"pydocstyle",
"twine",
]

# From requirements/doc.in
doc = [
{include-group = "test"},
"build",
"doc8",
"Sphinx",
"sphinx-book-theme",
]

# From requirements/ci.in
ci = [
"tox",
"tox-uv",
]

# From requirements/dev.in (without pip-tools since that's replaced by uv)
dev = [
{include-group = "quality"},
{include-group = "ci"},
"diff-cover",
]

[tool.uv]
package = true

# DO NOT EDIT constraint-dependencies DIRECTLY.
# This list is managed by `edx_lint write_uv_constraints`
# and will be overwritten the next time `make upgrade` is run.
# - GLOBAL constraints: edit edx_lint/files/common_constraints.txt
# - REPO-SPECIFIC constraints: edit [tool.edx_lint].uv_constraints in this file
constraint-dependencies = [
"Django<6.0",
"elasticsearch<7.14.0",
]

[tool.edx_lint]
# Repo-specific uv constraints merged with edx-lint's global constraints.
# Local entries override global ones for the same package.
# Run `make upgrade` to regenerate [tool.uv].constraint-dependencies.
uv_constraints = []

[tool.coverage.run]
branch = true
source_pkgs = ["xapi_db_load"]
omit = [
"*/tests/*",
]

[tool.coverage.report]
show_missing = true

[tool.pytest.ini_options]
addopts = "--cov xapi_db_load --cov-report term-missing --cov-report xml --log-level=INFO"
norecursedirs = [".* docs requirements site-packages"]

[tool.isort]
include_trailing_comma = true
indent = " "
line_length = 120
multi_line_output = 3
skip = ["migrations"]

[tool.mypy]
python_version = "3.12"
ignore_missing_imports = true
check_untyped_defs = false
warn_unused_ignores = true
exclude = ["^docs/", "^build/", "^dist/"]

[[tool.mypy.overrides]]
module = "xapi_db_load.tests.*"
ignore_errors = true
12 changes: 0 additions & 12 deletions requirements/base.in

This file was deleted.

Loading