Skip to content

Commit 9c63afe

Browse files
committed
Modernize packaging and CI (pyproject.toml, Tox, GHA)
1 parent 076d7d5 commit 9c63afe

File tree

11 files changed

+232
-102
lines changed

11 files changed

+232
-102
lines changed

.github/workflows/pipeline.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Pipeline
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
push:
7+
branches:
8+
- main
9+
push:
10+
tags:
11+
- '[0-9]+.[0-9]+.[0-9]+'
12+
13+
jobs:
14+
check:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
env:
19+
- lint
20+
- format
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.12'
26+
- run: pip install tox
27+
- run: tox run -e ${{ matrix.env }}
28+
29+
test:
30+
runs-on: ubuntu-latest
31+
strategy:
32+
matrix:
33+
python-version:
34+
- '3.10'
35+
- '3.11'
36+
- '3.12'
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: actions/setup-python@v5
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
- run: pip install tox
43+
- run: tox run -e py
44+
45+
publish:
46+
if: startsWith(github.ref, 'refs/tags/')
47+
needs:
48+
- check
49+
- test
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v4
53+
- uses: actions/setup-python@v5
54+
with:
55+
python-version: '3.12'
56+
- name: Install build tools
57+
run: pip install tox
58+
- name: Verify package version is same as Git tag
59+
run: tox run -qe ensure_version_matches -- $GIT_TAG
60+
env:
61+
GIT_TAG: ${{ github.ref_name }}
62+
- name: Build package and upload to PyPI
63+
run: tox run -e package -- upload
64+
env:
65+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
66+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

.travis.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

AUTHORS.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
Maintainers
22
-----------
33

4-
* Derek Stegelman (@dstegelman), original author
5-
* Peter Bittner (@bittner), current maintainer
4+
* Peter Bittner (@bittner)
65

76
Contributors
87
------------
@@ -11,3 +10,10 @@ Contributors
1110
* Aaron VanDerlip (@aaronvanderlip)
1211
* Travis Swicegood (@tswicegood)
1312
* Pablo Castellano (@PabloCastellano)
13+
* Amit Kumar (@umrao-ak47)
14+
* Wolfgang Herget (@wherget)
15+
16+
Original Author
17+
---------------
18+
19+
* Derek Stegelman (@dstegelman)

README.rst

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Django Bootstrap Static Files |latest-version|
33
==============================================
44

5-
|bootstrap| |jquery| |fontawesome| |build-status|
5+
|bootstrap| |jquery| |fontawesome| |pipeline|
66

77
Bootstrap and optional Font Awesome static files ready for the picking.
88

@@ -20,9 +20,9 @@ Also ships the latest jQuery compatible with Bootstrap, for optional inclusion.
2020
.. |fontawesome| image:: https://img.shields.io/badge/Font_Awesome-v6.5.2-1c9a71.svg
2121
:alt: Font Awesome 6.5.2
2222
:target: https://fontawesome.com/icons?m=free
23-
.. |build-status| image:: https://img.shields.io/travis/bittner/django-bootstrap-static/master.svg?logo=travis
23+
.. |pipeline| image:: https://github.com/bittner/django-bootstrap-static/actions/workflows/pipeline.yml/badge.svg
2424
:alt: Build status
25-
:target: https://travis-ci.org/bittner/django-bootstrap-static
25+
:target: https://github.com/bittner/django-bootstrap-static/actions/workflows/pipeline.yml
2626

2727
Install
2828
=======
@@ -75,7 +75,7 @@ to save a few kilobytes of bandwidth.
7575

7676
More details on integration may be available from each of the two projects:
7777

78-
- https://getbootstrap.com/docs/5.0/getting-started/introduction/
78+
- https://getbootstrap.com/docs/5.3/getting-started/introduction/
7979
- https://fontawesome.com/get-started (`Upgrading from Version 4 of Font Awesome`_)
8080

8181
.. _Upgrading from Version 4 of Font Awesome:
@@ -91,18 +91,35 @@ Sources and Procedures
9191
----------------------
9292

9393
Bootstrap: (all files from dist package)
94-
`Bootstrap website / Download`_ -> drop into ``bootstrap/static/bootstrap/``
94+
`Bootstrap website / Download`_ drop into ``bootstrap/static/bootstrap/``
9595
jQuery: (compressed, uncompressed, map)
96-
`jQuery website / Download`_ -> rename and mix into ``bootstrap/static/bootstrap/js/``
96+
`jQuery website / Download`_ rename and mix into ``bootstrap/static/bootstrap/js/``
9797

9898
Pick the latest version denoted as a dependency in ``bower.json`` (see `Dependencies`_).
9999
Font Awesome: (content of the ``on-server/`` folder only)
100-
`Font Awesome website / Download Free`_ -> drop into ``fontawesome/static/fontawesome/``
100+
`Font Awesome website / Download Free`_ drop into ``fontawesome/static/fontawesome/``
101101

102-
.. _Bootstrap website / Download: https://getbootstrap.com/
103-
.. _jQuery website / Download: https://jquery.com/download/
104-
.. _Dependencies: https://getbootstrap.com/docs/5.0/getting-started/javascript/
105-
.. _Font Awesome website / Download Free: https://fontawesome.com/
102+
Tests
103+
-----
104+
105+
Tests are great! And necessary. Please, add more. More is better!
106+
We use `Tox`_.
107+
108+
.. code-block:: console
109+
110+
pip install tox
111+
112+
Run all the linting and tests locally using Tox like this:
113+
114+
.. code-block:: console
115+
116+
tox
117+
118+
.. code-block:: console
119+
120+
tox list
121+
tox package
122+
tox clean
106123
107124
Releases
108125
========
@@ -115,4 +132,9 @@ a new change within this package itself, e.g.
115132
``django-bootstrap-static==3.3.1.1`` == Bootstrap ``3.3.1`` with an additional
116133
package change.
117134

135+
.. _Bootstrap website / Download: https://getbootstrap.com/
136+
.. _jQuery website / Download: https://jquery.com/download/
137+
.. _Dependencies: https://getbootstrap.com/docs/5.0/getting-started/javascript/
138+
.. _Font Awesome website / Download Free: https://fontawesome.com/
139+
.. _Tox: https://tox.wiki/
118140
.. _semver: https://semver.org/

bootstrap/__init__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
"""
2-
A collection of Bootstrap static files.
2+
A collection of Bootstrap static files. Font Awesome.
33
"""
4-
__author__ = 'Peter Bittner'
5-
__email__ = '[email protected]'
6-
__license__ = 'MIT'
7-
__url__ = 'https://github.com/bittner/django-bootstrap-static'
8-
__version__ = '5.3.3'
4+
5+
__version__ = "5.3.3"

fontawesome/__init__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
"""
2-
A collection of Bootstrap static files.
2+
A collection of Bootstrap static files. Font Awesome.
33
"""
4-
__author__ = 'Peter Bittner'
5-
__email__ = '[email protected]'
6-
__license__ = 'MIT'
7-
__url__ = 'https://github.com/bittner/django-bootstrap-static'
8-
__version__ = '6.5.2'
4+
5+
__version__ = "6.5.2"

pyproject.toml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[build-system]
2+
build-backend = "setuptools.build_meta"
3+
requires = ["setuptools>=64", "setuptools_scm>=8"]
4+
5+
[project]
6+
name = "django-bootstrap-static"
7+
dynamic = ["version"]
8+
description = "A collection of Bootstrap static files."
9+
readme = "README.rst"
10+
license = {file = "LICENSE"}
11+
authors = [
12+
{name = "Peter Bittner", email = "[email protected]"},
13+
]
14+
maintainers = [
15+
{name = "Peter Bittner", email = "[email protected]"},
16+
]
17+
classifiers = [
18+
"Development Status :: 5 - Production/Stable",
19+
"Environment :: Web Environment",
20+
"Intended Audience :: Developers",
21+
"Natural Language :: English",
22+
"Operating System :: OS Independent",
23+
"Framework :: Django",
24+
"Programming Language :: Python",
25+
"Programming Language :: Python :: 2",
26+
"Programming Language :: Python :: 3",
27+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries",
28+
"Topic :: Utilities",
29+
"License :: OSI Approved :: MIT License",
30+
]
31+
keywords=[
32+
"django",
33+
"staticfiles",
34+
"bootstrap",
35+
"jquery",
36+
"fontawesome",
37+
]
38+
39+
[project.urls]
40+
source = "https://github.com/bittner/django-bootstrap-static"
41+
42+
[tool.ruff]
43+
extend-exclude = []
44+
extend-include = []
45+
46+
[tool.ruff.lint]
47+
extend-select = ["ALL"]
48+
extend-ignore = ["ANN", "D", "FBT002", "INP001", "Q000", "TRY200", "UP"]
49+
50+
[tool.ruff.lint.per-file-ignores]
51+
"tests/*.py" = ["S101"]
52+
53+
[tool.setuptools]
54+
include-package-data = true
55+
packages = ["bootstrap", "fontawesome"]
56+
57+
[tool.setuptools_scm]
58+
local_scheme = "no-local-version"

setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

tests/test_packaging.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""Functional tests."""
2+
3+
4+
def test_imports():
5+
"""Importing the package should work as described in the README."""
6+
7+
import bootstrap
8+
import fontawesome
9+
10+
assert bootstrap.__version__ == "5.3.3"
11+
assert fontawesome.__version__ == "6.5.2"

tox.ini

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[tox]
2+
envlist =
3+
lint
4+
format
5+
py
6+
7+
[testenv]
8+
description = Unit tests and test coverage
9+
deps = pytest
10+
commands = pytest {posargs}
11+
12+
[testenv:clean]
13+
description = Remove bytecode and other debris
14+
skip_install = true
15+
deps = pyclean
16+
commands = pyclean {posargs:--debris .}
17+
18+
[testenv:ensure_version_matches]
19+
description = Verify package version is same as Git tag
20+
deps =
21+
commands = python -c 'import os; from importlib.metadata import version; pkg, tag = os.environ["PKG_NAME"], os.environ["GIT_TAG"]; ver = version(pkg); error = f"`{ver}` != `{tag}`"; abort = f"Package version does not match the Git tag ({error}). ABORTING."; raise SystemExit(0 if ver and tag and ver == tag else abort)'
22+
setenv =
23+
PKG_NAME=django-bootstrap-static
24+
GIT_TAG={posargs}
25+
26+
[testenv:format]
27+
description = Ensure consistent code style (Ruff)
28+
skip_install = true
29+
deps = ruff
30+
commands = ruff format {posargs:--check --diff .}
31+
32+
[testenv:lint]
33+
description = Lightening-fast linting (Ruff)
34+
skip_install = true
35+
deps = ruff
36+
commands = ruff check {posargs:--output-format=full .}
37+
38+
[testenv:package]
39+
description = Build package and check metadata (or upload package)
40+
skip_install = true
41+
deps =
42+
build
43+
twine
44+
commands =
45+
python -m build
46+
twine {posargs:check --strict} dist/*
47+
passenv =
48+
TWINE_USERNAME
49+
TWINE_PASSWORD
50+
TWINE_REPOSITORY_URL

0 commit comments

Comments
 (0)