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
30 changes: 14 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,30 @@ on:
pull_request:
branches:
- '**'

workflow_call:

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

steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: setup python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
python-version: ${{ matrix.python-version }}

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

- 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.

83 changes: 83 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
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@9a026e9303981c866c3425723009becb2437c757 # v10.6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
git_committer_name: "github-actions"
git_committer_email: "actions@users.noreply.github.com"
vcs_release: "false"

- name: Create GitHub Release with Assets
if: steps.release.outputs.released == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_NOTES: ${{ steps.release.outputs.release_notes }}
TAG: ${{ steps.release.outputs.tag }}
run: |
printf '%s' "$RELEASE_NOTES" > "$RUNNER_TEMP/release_notes.md"
gh release create "$TAG" \
--verify-tag \
--title "$TAG" \
--notes-file "$RUNNER_TEMP/release_notes.md" \
dist/*

- 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@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
22 changes: 0 additions & 22 deletions .github/workflows/upgrade-python-requirements.yml

This file was deleted.

19 changes: 8 additions & 11 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
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 tox.ini
exclude .gitignore
45 changes: 15 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
.PHONY: clean-pyc clean-build docs clean upgrade
.PHONY: clean-pyc clean-build docs clean upgrade requirements lint test test-all coverage dist

help:
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "requirements - install development environment requirements"
@echo "lint - check style with flake8"
@echo "test - run tests quickly with the default Python"
@echo "test-all - run tests on every Python version with tox"
@echo "coverage - check code coverage quickly with the default Python"
@echo "docs - generate Sphinx HTML documentation, including API docs"
@echo "release - package and upload a release"
@echo "dist - package"
@echo "upgrade update the pip requirements files to use the latest releases satisfying our constraints"
@echo "upgrade update the python requirements files to use the latest releases satisfying our constraints"

clean: clean-build clean-pyc
rm -fr htmlcov/
Expand All @@ -25,47 +25,32 @@ clean-pyc:
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +

requirements: ## install development environment requirements
uv sync --group dev

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

test:
py.test tests/
python -Wd -m pytest tests/

test-all:
tox

coverage:
coverage run --source django-babel-underscore setup.py test
coverage run --source src/enmerkar_underscore -m pytest tests/
coverage report -m
coverage html
open htmlcov/index.html

docs:
rm -f docs/django-babel-underscore.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ django-babel-underscore
$(MAKE) -C docs clean
$(MAKE) -C docs html
open docs/_build/html/index.html

release: clean
python setup.py sdist upload
python setup.py bdist_wheel upload
$(MAKE) -e -C docs clean
$(MAKE) -e -C docs html

dist: clean
python setup.py sdist
python setup.py bdist_wheel
python -m build
ls -l dist

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
5 changes: 1 addition & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ Django Babel Underscore Extractor
.. image:: https://github.com/openedx/enmerkar-underscore/workflows/Python%20CI/badge.svg?branch=master
:target: https://github.com/openedx/enmerkar-underscore/actions?query=workflow%3A%22Python+CI%22

.. image:: https://pypip.in/d/django-babel-underscore/badge.png
:target: https://pypi.python.org/pypi/django-babel-underscore


Implements a underscore extractor for django-babel.

* Free software: BSD license
* Documentation: http://django-babel-underscore.readthedocs.org.
* Documentation: https://github.com/openedx/enmerkar-underscore

Features
--------
Expand Down
14 changes: 4 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# version is used.
sys.path.insert(0, project_root)

import django-babel-underscore
from importlib.metadata import version as _version

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

Expand All @@ -39,7 +39,7 @@

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.viewcode']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand All @@ -62,9 +62,9 @@
# the built documents.
#
# The short X.Y version.
version = django-babel-underscore.__version__
version = _version("enmerkar-underscore")
# The full version, including alpha/beta/rc tags.
release = django-babel-underscore.__version__
release = _version("enmerkar-underscore")

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -137,12 +137,6 @@
# 16x16 or 32x32 pixels large.
#html_favicon = None

# Add any paths that contain custom static files (such as style sheets)
# here, relative to this directory. They are copied after the builtin
# static files, so a file named "default.css" will overwrite the builtin
# "default.css".
html_static_path = ['_static']

# If not '', a 'Last updated on:' timestamp is inserted at every page
# bottom, using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
contain the root `toctree` directive.

Welcome to Django Babel Underscore Extractor's documentation!
======================================
=============================================================

Contents:

Expand Down
Loading