Skip to content

Commit

Permalink
update project files
Browse files Browse the repository at this point in the history
* update pre-commit hooks
* show url in publish environment
* update actions versions
* use dependabot grouped updates
  ignore upload/download-artifact until slsa updates
* update dev dependencies
* update editorconfig
* update gitignore
* license is txt, readme is md
* use pyproject.toml
* add tox env to update all dev dependencies
  • Loading branch information
davidism committed Apr 19, 2024
1 parent d7a12b1 commit 1ec5f1e
Show file tree
Hide file tree
Showing 20 changed files with 240 additions and 153 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ end_of_line = lf
charset = utf-8
max_line_length = 88

[*.{yml,yaml,json,js,css,html}]
[*.{css,html,js,json,jsx,scss,ts,tsx,yaml,yml}]
indent_size = 2
29 changes: 22 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
day: "monday"
time: "16:00"
timezone: "UTC"
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
ignore:
# slsa depends on upload/download v3
- dependency-name: actions/upload-artifact
versions: '>= 4'
- dependency-name: actions/download-artifact
versions: '>= 4'
groups:
github-actions:
patterns:
- '*'
- package-ecosystem: pip
directory: /requirements/
schedule:
interval: monthly
groups:
python-requirements:
patterns:
- '*'
14 changes: 6 additions & 8 deletions .github/workflows/lock.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
name: 'Lock inactive closed issues'
name: Lock inactive closed issues
# Lock closed issues that have not received any further activity for two weeks.
# This does not close open issues, only humans may do that. We find that it is
# easier to respond to new issues with fresh examples rather than continuing
# discussions on old issues.
# This does not close open issues, only humans may do that. It is easier to
# respond to new issues with fresh examples rather than continuing discussions
# on old issues.

on:
schedule:
- cron: '0 0 * * *'

permissions:
issues: write
pull-requests: write

concurrency:
group: lock

jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@be8aa5be94131386884a6da4189effda9b14aa21
- uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v5.0.1
with:
issue-inactive-days: 14
pr-inactive-days: 14
discussion-inactive-days: 14
30 changes: 15 additions & 15 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,42 @@ jobs:
outputs:
hash: ${{ steps.hash.outputs.hash }}
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.x'
cache: 'pip'
cache-dependency-path: 'requirements/*.txt'
- run: pip install build
cache: pip
cache-dependency-path: requirements*/*.txt
- run: pip install -r requirements/build.txt
# Use the commit date instead of the current date during the build.
- run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
- run: python -m build
# Generate hashes used for provenance.
- name: generate hash
id: hash
run: cd dist && echo "hash=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
path: ./dist
provenance:
needs: ['build']
needs: [build]
permissions:
actions: read
id-token: write
contents: write
# Can't pin with hash due to how this workflow works.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.9.0
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.10.0
with:
base64-subjects: ${{ needs.build.outputs.hash }}
create-release:
# Upload the sdist, wheels, and provenance to a GitHub release. They remain
# available as build artifacts for a while as well.
needs: ['provenance']
needs: [provenance]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
- name: create release
run: >
gh release create --draft --repo ${{ github.repository }}
Expand All @@ -53,21 +53,21 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
publish-pypi:
needs: ['provenance']
needs: [provenance]
# Wait for approval before attempting to upload to PyPI. This allows reviewing the
# files in the draft release.
environment:
name: publish
url: https://pypi.org/project/Pallets-Sphinx-Themes/
url: https://pypi.org/project/Pallets-Sphinx-Themes/${{ github.ref_name }}
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
- uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
- uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: artifact/
- uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e
- uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
with:
packages-dir: artifact/
20 changes: 6 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
.DS_Store
.idea/
.env
.flaskenv
*.pyc
*.pyo
env/
.vscode/
.venv*/
venv*/
__pycache__/
dist/
build/
*.egg
*.egg-info/
.tox/
.cache/
.pytest_cache/
.coverage*
htmlcov/
.coverage
.coverage.*
.tox/
docs/_build/
32 changes: 10 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
ci:
autoupdate_schedule: monthly
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.0
hooks:
- id: pyupgrade
args: ["--py38-plus"]
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
hooks:
- id: reorder-python-imports
args: ["--application-directories", "src"]
- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-implicit-str-concat
- id: ruff
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-byte-order-marker
- id: check-merge-conflict
- id: debug-statements
- id: fix-byte-order-marker
- id: trailing-whitespace
- id: end-of-file-fixer
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Version 2.1.2
-------------

Unreleased

- Use modern packaging metadata with ``pyproject.toml`` instead of ``setup.cfg``.
- Use ``flit_core`` instead of ``setuptools`` as build backend.


Version 2.1.1
-------------

Expand Down
File renamed without changes.
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Pallets Sphinx Themes

Themes for the Pallets projects. If you're writing an extension, use the
appropriate theme to make your documentation look consistent.

Available themes:

- flask
- jinja
- werkzeug
- click

Enable the extension and choose the theme in `docs/conf.py`:

```python
extensions = [
"pallets_sphinx_themes",
...
]

html_theme = "flask"
```
29 changes: 0 additions & 29 deletions README.rst

This file was deleted.

67 changes: 67 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[project]
name = "Pallets-Sphinx-Themes"
version = "2.1.1"
description = "Sphinx themes for Pallets and related projects."
readme = "README.md"
license = { file = "LICENSE.txt" }
maintainers = [{ name = "Pallets", email = "contact@palletsprojects.com" }]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Sphinx",
"Framework :: Sphinx :: Theme",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Documentation",
"Topic :: Documentation :: Sphinx",
"Topic :: Software Development :: Documentation",
]
requires-python = ">=3.8"
dependencies = [
"packaging",
"sphinx>=3",
]

[project.urls]
Donate = "https://palletsprojects.com/donate"
Source = "https://github.com/pallets/pallets-sphinx-themes/"
Chat = "https://discord.gg/pallets"

[project.entry-points."pygments.styles"]
pocoo = "pallets_sphinx_themes.themes.pocoo:PocooStyle"
jinja = "pallets_sphinx_themes.themes.jinja:JinjaStyle"

[build-system]
requires = ["flit_core<4"]
build-backend = "flit_core.buildapi"

[tool.flit.module]
name = "pallets_sphinx_themes"

[tool.flit.sdist]
include = [
"requirements/",
"CHANGES.rst",
]

[tool.ruff]
src = ["src"]
fix = true
show-fixes = true
output-format = "full"

[tool.ruff.lint]
select = [
"B", # flake8-bugbear
"E", # pycodestyle error
"F", # pyflakes
"I", # isort
"UP", # pyupgrade
"W", # pycodestyle warning
]
ignore-init-module-imports = true

[tool.ruff.lint.isort]
force-single-line = true
order-by-type = false
1 change: 1 addition & 0 deletions requirements/build.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
12 changes: 12 additions & 0 deletions requirements/build.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile build.in
#
build==1.2.1
# via -r build.in
packaging==24.0
# via build
pyproject-hooks==1.0.0
# via build
2 changes: 1 addition & 1 deletion requirements/dev.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pip-compile-multi
pre-commit
tox
Loading

0 comments on commit 1ec5f1e

Please sign in to comment.