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
38 changes: 16 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
name: Python CI
name: CI

on:
push:
branches: [master]
pull_request:
branches:
- '**'


jobs:
run_tests:
name: tests
runs-on: ${{ matrix.os }}
name: ${{ matrix.toxenv }}
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.11', '3.12']
toxenv: ['django42', 'django52']
python-version: ["3.12"]
toxenv: [django42, django52]

steps:
- uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Checkout repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.2.2

- name: Install pip
run: pip install -r requirements/pip.txt
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
enable-cache: true
python-version: "${{ matrix.python-version }}"

- name: Install tox
run: pip install tox
- name: Install CI dependencies
run: uv sync --group ci

- name: Run Tests
env:
TOXENV: ${{ matrix.toxenv }}
run: tox
- name: Run tox
run: uv run tox -e ${{ matrix.toxenv }}
31 changes: 0 additions & 31 deletions .github/workflows/publish_pypi.yml

This file was deleted.

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

on:
push:
branches: [master]

jobs:
run_ci:
uses: ./.github/workflows/ci.yml

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

permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.2.2
with:
ref: ${{ github.ref_name }}

- name: Force branch to workflow sha
run: git reset --hard ${{ github.sha }}

- name: Run Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@8f4d8c4e3e4fcd2b8df16444b148aa49920cc4d3 # v10.6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
git_committer_name: "github-actions"
git_committer_email: "actions@users.noreply.github.com"
changelog: "false"

- name: Upload to GitHub Release Assets
uses: python-semantic-release/publish-action@98e6c872368aff4290ef8444db095e5bcd3fba6c # v10.6.1
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}

- name: Upload distribution artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: steps.release.outputs.released == 'true'
with:
name: distribution-artifacts
path: dist
if-no-files-found: error

outputs:
released: ${{ steps.release.outputs.released || 'false' }}
version: ${{ steps.release.outputs.version }}

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

permissions:
contents: read
id-token: write

steps:
- name: Download build artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: distribution-artifacts
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # release/v1
# No user/password — OIDC trusted publisher. Configure on PyPI before merging.
20 changes: 9 additions & 11 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
include AUTHORS.rst
include CONTRIBUTING.rst
include HISTORY.rst
include LICENSE
include README.rst
# Exclude development, test, and documentation folders
prune .github
prune docs
prune tests

recursive-include tests *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]

recursive-include docs *.rst conf.py Makefile make.bat
include requirements/constraints.txt
# Exclude root level configuration and build files
exclude Makefile
exclude conftest.py
exclude .gitignore
exclude tox.ini
23 changes: 10 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ clean-pyc:
find . -name '*~' -exec rm -f {} +

lint:
flake8 django-babel-underscore tests
flake8 src tests

test:
py.test tests/
# pytest-pep8 and pytest-flakes are incompatible with pytest 8+ on Python 3.12; disable their auto-loading
python -Wd -m pytest -p no:pep8 -p no:flakes tests/

test-all:
tox
Expand Down Expand Up @@ -57,15 +58,11 @@ dist: clean
python setup.py bdist_wheel
ls -l dist

requirements: ## install development environment requirements
uv sync --group dev
uv tool install tox --with tox-uv

upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade:
pip install -qr requirements/pip-tools.txt
pip-compile --upgrade --allow-unsafe --rebuild -o requirements/pip.txt requirements/pip.in
pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -qr requirements/pip.txt
pip install -qr requirements/pip-tools.txt
pip-compile --upgrade -o requirements/base.txt requirements/base.in
pip-compile --upgrade -o requirements/test.txt requirements/test.in
pip-compile --upgrade -o requirements/dev.txt requirements/dev.in
# Let tox control the Django version for tests
sed '/^[dD]jango==/d' requirements/test.txt > requirements/tox.txt
upgrade: ## update python dependencies
uv run --with edx-lint edx_lint write_uv_constraints pyproject.toml
uv lock --upgrade
129 changes: 129 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
[build-system]
requires = ["setuptools", "setuptools-scm>8.1"]
build-backend = "setuptools.build_meta"

[project]
name = "enmerkar-underscore"
description = "Implements a underscore extractor for django-babel."
requires-python = ">=3.12"
license = "BSD-3-Clause"
license-files = ["LICENSE*"]
authors = [
{name = "Open edX Project", email = "oscm@openedx.org"},
]
classifiers = [
'Development Status :: 5 - Production/Stable',
'Framework :: Django',
'Framework :: Django :: 4.2',
'Framework :: Django :: 5.2',
'Intended Audience :: Developers',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.12',
]
keywords = [
"Python",
"edx",
"enmerkar-underscore",
]

dynamic = ["readme", "version"]

dependencies = [
"django",
"babel>=1.3",
"enmerkar==0.7.1",
]

[project.entry-points."babel.extractors"]
underscore = "enmerkar_underscore:extract"

[project.urls]
Homepage = "https://github.com/openedx/enmerkar-underscore"
Repository = "https://github.com/openedx/enmerkar-underscore"

[tool.setuptools]
include-package-data = true

[tool.setuptools.dynamic]
readme = {file = ["README.rst"], content-type = "text/x-rst"}

[tool.setuptools.packages.find]
where = ["src"]

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

[tool.semantic_release]
# SETUPTOOLS_SCM_PRETEND_VERSION lets python-semantic-release drive the version
# at build time without needing a setup.py file.
build_command = "pip install build && SETUPTOOLS_SCM_PRETEND_VERSION=$NEW_VERSION python -m build"

[tool.semantic_release.commit_parser_options]
minor_tags = ["feat", "docs"]

[tool.setuptools_scm]
version_scheme = 'only-version'
local_scheme = 'no-local-version'
fallback_version = "0.0.0.dev0"

[dependency-groups]
test-base = [
"coverage",
"flake8>=2.0",
"pytest",
"pytest-cov>=1.4",
"pytest-flakes",
"pytest-pep8",
"python-coveralls",
"setuptools",
"sphinx",
]
test = [
{include-group = "test-base"},
"Django>=5.2,<6.0",
]
django42 = [
{include-group = "test-base"},
"Django>=4.2,<5.0",
]
quality = [
{include-group = "test-base"},
]
ci = [
"tox",
"tox-uv",
]
dev = [
{include-group = "test"},
{include-group = "ci"},
]

[tool.uv]
conflicts = [
[{group = "test"}, {group = "django42"}],
]
# 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",
"setuptools<71",
]

[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 = [
# Date: 2026-07-28
# enmerkar==0.7.1 uses pkg_resources which was removed from setuptools>=71.
# Pin until enmerkar is upgraded to use importlib.metadata.
# https://github.com/openedx/enmerkar/issues
"setuptools<71",
]
8 changes: 0 additions & 8 deletions requirements/base.in

This file was deleted.

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

This file was deleted.

Loading
Loading