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

This file was deleted.

22 changes: 12 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,36 @@ on:
pull_request:
branches:
- '**'
workflow_call:

jobs:
run_tests:
name: Tests
name: ${{ matrix.toxenv }}
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
python-version: ['3.12']
toxenv: [django42, django52, quality]

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: setup python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
fetch-depth: 0
- name: Setup uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Install pip
run: pip install -r requirements/pip.txt

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

- name: Run Tests
env:
TOXENV: ${{ matrix.toxenv }}
run: tox
run: uv run tox

- name: Run Coverage
if: matrix.python-version == '3.12' && matrix.toxenv == 'django42'
Expand All @@ -41,4 +44,3 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true

33 changes: 0 additions & 33 deletions .github/workflows/pypi-release.yml

This file was deleted.

72 changes: 72 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Semantic Release

on:
push:
branches:
- master

jobs:
run_tests:
uses: ./.github/workflows/ci.yml
secrets: inherit
permissions:
contents: read

release:
needs: run_tests
if: github.ref_name == 'master'
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-release
cancel-in-progress: false

permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.ref_name }}

- name: Reset to triggered commit
run: git reset --hard ${{ github.sha }}

- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@350c48fcb3ffcdfd2e0a235206bc2ecea6b69df0 # v10.5.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
git_committer_name: "github-actions[bot]"
git_committer_email: "github-actions[bot]@users.noreply.github.com"
changelog: "false"

- name: Upload dist artifacts
if: steps.release.outputs.released == 'true'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: dist
path: dist/

outputs:
released: ${{ steps.release.outputs.released }}
version: ${{ steps.release.outputs.version }}

publish_to_pypi:
needs: release
if: needs.release.outputs.released == 'true'
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- name: Download dist artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pip-log.txt

# Unit test / coverage reports
.coverage
coverage.xml
.tox
nosetests.xml

Expand Down
7 changes: 5 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ build:
tools:
python: "3.12"

# Optionally set the version of Python and requirements required to build your docs
# Install doc dependencies from uv.lock using the doc dependency group
python:
install:
- requirements: requirements/docs.txt
- method: uv
command: sync
groups:
- doc
2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
include requirements/base.in
include NOTICE
include LICENSE
include requirements/constraints.txt
50 changes: 13 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,33 @@ REPO_NAME := DoneXBlock
DOCKER_NAME := donexblock

# For opening files in a browser. Use like: $(BROWSER)relative/path/to/file.html
BROWSER := python -m webbrowser file://$(CURDIR)/
BROWSER := uv run python -m webbrowser file://$(CURDIR)/

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

install-test:
pip install -q -r requirements/test.txt

install-dev:
pip install -q -r requirements/dev.txt

install: install-test

quality: ## Run the quality checks

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ruff is declared as a dependency in the quality group and fully configured ([tool.ruff]/[tool.ruff.lint]/[tool.ruff.format] in pyproject.toml), but this target never actually invokes it -- only pylint runs. Was ruff meant to run here too (matching the #511 XBlocks track's adoption of it elsewhere, e.g. xblocks-core), or was pylint intended to stay as the sole linter with ruff left over from an earlier draft? Either way it's currently dead config -- worth wiring in or dropping.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not adding ruff in this scope because it needs to add more files formatting, so i removed that.

pylint --rcfile=pylintrc done
python setup.py -q sdist
twine check dist/*
uv run pylint --rcfile=pylintrc src/done
uv run python -m build --sdist
uv run twine check dist/*

test: ## Run the tests
mkdir -p var
rm -rf .coverage
python -m coverage run --rcfile=.coveragerc -m pytest
uv run python -m coverage run -m pytest
uv run python -m coverage xml

covreport: ## Show the coverage results
python -m coverage report -m --skip-covered

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
pip install -q -r requirements/pip-tools.txt
pip install -q -r requirements/pip.txt
pip-compile --upgrade --allow-unsafe -o requirements/pip.txt requirements/pip.in
pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -q -r requirements/pip.txt
pip install -q -r requirements/pip-tools.txt
pip-compile --upgrade -o requirements/base.txt requirements/base.in
pip-compile --upgrade -o requirements/dev.txt requirements/dev.in
pip-compile --upgrade -o requirements/test.txt requirements/test.in
pip-compile --upgrade -o requirements/quality.txt requirements/quality.in
pip-compile --upgrade -o requirements/tox.txt requirements/tox.in
pip-compile --upgrade -o requirements/ci.txt requirements/ci.in
pip-compile --upgrade -o requirements/docs.txt requirements/docs.in
# lets tox controls the django versions.
sed -i.tmp '/^[d|D]jango==/d' requirements/test.txt
rm requirements/test.txt.tmp
uv run python -m coverage report -m --skip-covered

upgrade: ## update uv.lock and regenerate uv constraint-dependencies
uv run --with edx-lint edx_lint write_uv_constraints pyproject.toml
uv lock --upgrade

.PHONY: requirements
requirements: ## install development environment requirements
pip install -r requirements/pip.txt
pip install -qr requirements/pip-tools.txt
pip install -r requirements/dev.txt
uv sync --group dev

dev.clean:
-docker rm $(DOCKER_NAME)-dev
Expand All @@ -68,7 +44,7 @@ dev.run: dev.clean dev.build ## Clean, build and run test image

## Localization targets

WORKING_DIR := done
WORKING_DIR := src/done
EXTRACT_DIR := $(WORKING_DIR)/conf/locale/en/LC_MESSAGES
EXTRACTED_DJANGO := $(EXTRACT_DIR)/django-partial.po
EXTRACTED_TEXT := $(EXTRACT_DIR)/django.po
Expand Down
5 changes: 2 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@
import os
import sys
from datetime import datetime
from importlib.metadata import version as get_version

sys.path.insert(0, os.path.abspath('../..'))

import done

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

project = 'DoneXBlock'
current_year = datetime.utcnow().year
copyright = f'{current_year}, Axim Collaborative'
version = done.__version__
version = get_version("done-xblock")


# -- General configuration ---------------------------------------------------
Expand Down
7 changes: 0 additions & 7 deletions done/__init__.py

This file was deleted.

Loading