Skip to content
Closed
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
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
push:
branches: [main]
pull_request:
# Allow this workflow to be called from other workflows
workflow_call:

jobs:
run_tests:
name: ${{ matrix.toxenv }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
toxenv: [py312, quality, docs]

steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

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

- name: Install CI dependencies
run: uv sync --group ci

- name: Run tox
run: uv run tox -e ${{ matrix.toxenv }}

- name: Upload coverage to Codecov
if: matrix.toxenv == 'py312'
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true
6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

85 changes: 31 additions & 54 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,58 +1,35 @@
.PHONY: clean help quality requirements selfcheck upgrade
.PHONY: help clean upgrade quality requirements test docs selfcheck

.DEFAULT_GOAL := help

help: ## display this help message
@echo "Please use \`make <target>' where <target> is one of"
@awk -F ':.*?## ' '/^[a-zA-Z]/ && NF==2 {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort

clean: ## remove generated byte code, coverage reports, and build artifacts
find . -name '__pycache__' -exec rm -rf {} +
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
coverage erase
rm -fr build/
rm -fr dist/
rm -fr *.egg-info

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

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 "$(@)"

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 -r requirements/pip-tools.txt
# Make sure to compile files after any other files they include!
$(PIP_COMPILE) --allow-unsafe -o requirements/pip.txt requirements/pip.in
$(PIP_COMPILE) -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -r 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

quality: ## check coding style with pycodestyle and pylint
pylint repo_tools_data_schema *.py
pycodestyle repo_tools_data_schema *.py
isort --check-only --diff repo_tools_data_schema *.py
make selfcheck

requirements: ## install development environment requirements
pip install -r requirements/pip-tools.txt
pip-sync requirements/dev.txt requirements/private.*
pip install -e .

test: ## run the few tests we have
pytest

selfcheck: ## check that the Makefile is well-formed
help: ## Show this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

clean: ## Clean build artifacts
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf .pytest_cache/
rm -rf htmlcov/
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete

upgrade: ## Upgrade python dependencies
uv run --with edx-lint edx_lint write_uv_constraints pyproject.toml
uv lock --upgrade

quality: ## Run linting checks
uv run tox -e quality

requirements: ## Sync dev dependencies
uv sync --group dev
uv tool install tox --with tox-uv

test: ## Run tests
uv run tox -e "py312"

docs: ## Build documentation
uv run tox -e docs

selfcheck: ## check that the Makefile is well-formed
@echo "The Makefile is well-formed."
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Codecov configuration for openedx-webhooks-data-schema
# https://docs.codecov.com/docs/codecov-yaml
14 changes: 14 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Minimal makefile for Sphinx documentation

SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
30 changes: 30 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""
Sphinx configuration for openedx-webhooks-data-schema documentation.
"""

import os
import sys
from datetime import datetime

# Add the src/ directory to the path for autodoc
sys.path.insert(0, os.path.abspath("../src"))

# -- Project information -----------------------------------------------------

project = "openedx-webhooks-data-schema"
copyright = f"{datetime.now().year}, Axim Collaborative, Inc."
author = "Axim Collaborative, Inc."

# -- General configuration ---------------------------------------------------

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
]

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# -- Options for HTML output -------------------------------------------------

html_theme = "sphinx_book_theme"
16 changes: 16 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
openedx-webhooks-data-schema
============================

Schema definitions for Open edX webhook repository tool data.

.. toctree::
:maxdepth: 2
:caption: Contents:


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
127 changes: 127 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "repo-tools-data-schema"
version = "2.0"
description = "Schema for repo-tools-data"
readme = "README.rst"
requires-python = ">=3.12"
license = "Apache-2.0"
license-files = ["LICENSE.txt"]
authors = [
{name = "edX", email = "oscm@edx.org"},
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
]
keywords = [
"Python",
"edx",
]
dependencies = [
"PyYAML",
"schema",
]

[project.urls]
Repository = "https://github.com/openedx/repo-tools-data-schema"

[tool.setuptools.packages.find]
where = ["src"]
exclude = ["tests*", "*.tests", "*.tests.*", "docs*"]

[tool.setuptools.package-data]
"*" = ["*.txt", "*.rst"]

[dependency-groups]
# Base test packages
test-base = [
"coverage",
"pytest-cov",
"pytest>=7.0",
]
# Default test group
test = [
{include-group = "test-base"},
]
quality = [
{include-group = "test"},
"edx-lint",
"isort",
"pycodestyle",
]
doc = [
{include-group = "test"},
"doc8",
"readme-renderer",
"Sphinx",
"sphinx-book-theme",
]
ci = [
"tox",
"tox-uv",
]
dev = [
{include-group = "quality"},
{include-group = "ci"},
{include-group = "doc"},
"diff-cover",
]

# Pytest configuration
# https://docs.pytest.org/en/stable/reference/customize.html
[tool.pytest.ini_options]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
testpaths = ["tests"]
addopts = "-v --tb=short"

# Coverage configuration
# https://coverage.readthedocs.io/en/latest/config.html
[tool.coverage.run]
branch = true
source_pkgs = ["repo_tools_data_schema"]
omit = [
"*/tests/*",
"*/__pycache__/*",
]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]
show_missing = true

[tool.coverage.html]
directory = "htmlcov"

# edx-lint uv constraints configuration
# Add any repo-specific version overrides here; run `edx_lint write_uv_constraints` to apply.
[tool.edx_lint]
uv_constraints = []

# uv configuration
# https://docs.astral.sh/uv/reference/settings/
# 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
[tool.uv]
package = true
constraint-dependencies = [
"Django<6.0",
"elasticsearch<7.14.0",
]
5 changes: 0 additions & 5 deletions requirements/base.in

This file was deleted.

10 changes: 0 additions & 10 deletions requirements/base.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements/ci.in

This file was deleted.

34 changes: 0 additions & 34 deletions requirements/ci.txt

This file was deleted.

Loading