Skip to content

Commit

Permalink
Modernize packaging and CI (pyproject.toml, Tox, GHA)
Browse files Browse the repository at this point in the history
  • Loading branch information
bittner committed Jun 18, 2024
1 parent 076d7d5 commit b3ddb01
Show file tree
Hide file tree
Showing 13 changed files with 292 additions and 107 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Pipeline
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
check:
runs-on: ubuntu-latest
strategy:
matrix:
env:
- lint
- format
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install tox
- run: tox run -e ${{ matrix.env }}

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.10'
- '3.11'
- '3.12'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install tox
- run: tox run -e py

publish:
if: startsWith(github.ref, 'refs/tags/')
needs:
- check
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install build tools
run: pip install tox
- name: Verify package version is same as Git tag
run: tox run -qe ensure_version_matches -- $GIT_TAG
env:
GIT_TAG: ${{ github.ref_name }}
- name: Build package and upload to PyPI
run: tox run -e package -- upload
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Bytecode
*.py[co]

# Packages
django_bootstrap_static-*/
*.egg
*.egg-info
dist
Expand All @@ -20,10 +22,10 @@ pip-log.txt
.coverage
.tox

#Translations
# Translations
*.mo

#Mr Developer
# Mr Developer
.mr.developer.cfg
.idea
*.DS_Store
*.DS_Store
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

10 changes: 8 additions & 2 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Maintainers
-----------

* Derek Stegelman (@dstegelman), original author
* Peter Bittner (@bittner), current maintainer
* Peter Bittner (@bittner)

Contributors
------------
Expand All @@ -11,3 +10,10 @@ Contributors
* Aaron VanDerlip (@aaronvanderlip)
* Travis Swicegood (@tswicegood)
* Pablo Castellano (@PabloCastellano)
* Amit Kumar (@umrao-ak47)
* Wolfgang Herget (@wherget)

Original Author
---------------

* Derek Stegelman (@dstegelman)
7 changes: 5 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
graft bootstrap/static
graft fontawesome/static
exclude .gitignore tox.ini
include README.rst
recursive-include bootstrap/static *.*
recursive-include fontawesome/static *.*
prune .github
prune tests
45 changes: 34 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Django Bootstrap Static Files |latest-version|
==============================================

|bootstrap| |jquery| |fontawesome| |build-status|
|bootstrap| |jquery| |fontawesome| |pipeline|

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

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

Install
=======
Expand Down Expand Up @@ -75,7 +75,7 @@ to save a few kilobytes of bandwidth.

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

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

.. _Upgrading from Version 4 of Font Awesome:
Expand All @@ -91,18 +91,36 @@ Sources and Procedures
----------------------

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

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

.. _Bootstrap website / Download: https://getbootstrap.com/
.. _jQuery website / Download: https://jquery.com/download/
.. _Dependencies: https://getbootstrap.com/docs/5.0/getting-started/javascript/
.. _Font Awesome website / Download Free: https://fontawesome.com/
Tests
-----

Tests are great! And necessary. Please, add more. More is better!
We use `Tox`_.

.. code-block:: console
pip install tox
Run all the linting and tests locally using Tox like this:

.. code-block:: console
tox
.. code-block:: console
tox list
tox -e package
tox -e py310,clean
tox -e format -- tests
Releases
========
Expand All @@ -115,4 +133,9 @@ a new change within this package itself, e.g.
``django-bootstrap-static==3.3.1.1`` == Bootstrap ``3.3.1`` with an additional
package change.

.. _Bootstrap website / Download: https://getbootstrap.com/
.. _jQuery website / Download: https://jquery.com/download/
.. _Dependencies: https://getbootstrap.com/docs/5.0/getting-started/javascript/
.. _Font Awesome website / Download Free: https://fontawesome.com/
.. _Tox: https://tox.wiki/
.. _semver: https://semver.org/
9 changes: 3 additions & 6 deletions bootstrap/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
"""
A collection of Bootstrap static files.
A collection of Bootstrap static files. Font Awesome.
"""
__author__ = 'Peter Bittner'
__email__ = '[email protected]'
__license__ = 'MIT'
__url__ = 'https://github.com/bittner/django-bootstrap-static'
__version__ = '5.3.3'

__version__ = "5.3.3"
9 changes: 3 additions & 6 deletions fontawesome/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
"""
A collection of Bootstrap static files.
A collection of Bootstrap static files. Font Awesome.
"""
__author__ = 'Peter Bittner'
__email__ = '[email protected]'
__license__ = 'MIT'
__url__ = 'https://github.com/bittner/django-bootstrap-static'
__version__ = '6.5.2'

__version__ = "6.5.2"
61 changes: 61 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=64", "setuptools_scm>=8"]

[project]
name = "django-bootstrap-static"
dynamic = ["version"]
description = "A collection of Bootstrap static files."
readme = "README.rst"
license = {file = "LICENSE"}
authors = [
{name = "Peter Bittner", email = "[email protected]"},
]
maintainers = [
{name = "Peter Bittner", email = "[email protected]"},
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"Natural Language :: English",
"Operating System :: OS Independent",
"Framework :: Django",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries",
"Topic :: Utilities",
"License :: OSI Approved :: MIT License",
]
keywords=[
"django",
"staticfiles",
"bootstrap",
"jquery",
"fontawesome",
]

[project.urls]
source = "https://github.com/bittner/django-bootstrap-static"

[tool.pytest.ini_options]
addopts = "--color=yes --doctest-modules --verbose"

[tool.ruff]
extend-exclude = []
extend-include = []

[tool.ruff.lint]
extend-select = ["ALL"]
extend-ignore = ["ANN", "D", "INP001", "UP"]

[tool.ruff.lint.per-file-ignores]
"tests/*.py" = ["S101"]

[tool.setuptools]
include-package-data = true
packages = ["bootstrap", "fontawesome"]

[tool.setuptools_scm]
local_scheme = "no-local-version"
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

43 changes: 0 additions & 43 deletions setup.py

This file was deleted.

Loading

0 comments on commit b3ddb01

Please sign in to comment.