Skip to content

Commit

Permalink
Merge pull request #42 from lsst-sqre/tickets/DM-41187
Browse files Browse the repository at this point in the history
DM-41187: Add -i/--ignore option to templatekit check command
  • Loading branch information
jonathansick authored Oct 13, 2023
2 parents aa7d601 + cadc991 commit 16f5094
Show file tree
Hide file tree
Showing 17 changed files with 276 additions and 289 deletions.
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
max-line-length = 79
# E203: whitespace before :, flake8 disagrees with PEP 8
# W503: line break after binary operator, flake8 disagrees with PEP 8
ignore = E203, W503
exclude =
docs/conf.py
52 changes: 39 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ name: Python CI
- "renovate/**"
- "tickets/**"
- "u/**"
tags:
- "*"
pull_request: {}
release:
types: [published]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -36,9 +36,11 @@ jobs:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -52,7 +54,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -62,7 +64,7 @@ jobs:
- name: Run tox
uses: lsst-sqre/run-tox@v1
with:
python-version: "3.10"
python-version: "3.12"
tox-envs: "docs"

# Only attempt documentation uploads for tagged releases and pull
Expand All @@ -80,18 +82,42 @@ jobs:
username: ${{ secrets.LTD_USERNAME }}
password: ${{ secrets.LTD_PASSWORD }}

test-packaging:
name: Test packaging
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history for setuptools_scm

- name: Build and publish
uses: lsst-sqre/build-and-publish-to-pypi@v2
with:
python-version: '3.12'
upload: false

pypi:
# This job requires set up:
# 1. Set up a trusted publisher for PyPI
# 2. Set up a "pypi" environment in the repository
# See https://github.com/lsst-sqre/build-and-publish-to-pypi
name: Upload release to PyPI
runs-on: ubuntu-latest
needs: [test, docs]
if: startsWith(github.ref, 'refs/tags/')
needs: [lint, test, docs, test-packaging]
environment:
name: pypi
url: https://pypi.org/p/templatekit
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history for setuptools_scm

- name: Upload
uses: lsst-sqre/build-and-publish-to-pypi@v1
- name: Build and publish
uses: lsst-sqre/build-and-publish-to-pypi@v2
with:
pypi-token: ${{ secrets.PYPI_SQRE_ADMIN }}
python-version: "3.10"
python-version: '3.12'
33 changes: 33 additions & 0 deletions .github/workflows/dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Dependency Update

'on':
schedule:
- cron: '0 12 * * 1'
workflow_dispatch: {}

jobs:
update:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v4

- name: Run neophile
uses: lsst-sqre/run-neophile@v1
with:
python-version: '3.11'
mode: pr
types: pre-commit
app-id: ${{ secrets.NEOPHILE_APP_ID }}
app-secret: ${{ secrets.NEOPHILE_PRIVATE_KEY }}

- name: Report status
if: always()
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
notify_when: 'failure'
notification_title: 'Periodic dependency update for {repo} failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ALERT_WEBHOOK }}
18 changes: 9 additions & 9 deletions .github/workflows/periodic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ name: Periodic CI

"on":
schedule:
- cron: "0 12 * * 1"
- cron: "0 13 * * 1"

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -32,7 +32,7 @@ jobs:
- "3.10"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -48,17 +48,17 @@ jobs:
python-version: ${{ matrix.python }}
tox-envs: "py,typing"

pypi:
test-packaging:
name: Test packaging
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history for setuptools_scm

- name: Upload
uses: lsst-sqre/build-and-publish-to-pypi@v1
- name: Build and publish
uses: lsst-sqre/build-and-publish-to-pypi@v2
with:
pypi-token: ${{ secrets.PYPI_SQRE_ADMIN }}
python-version: "3.10"
python-version: '3.12'
upload: false
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
Change log
##########

0.6.0 (2023-10-13)
==================

- Add a new ``-i/--ignore`` option to the ``templatekit check`` command.
This option allows the user to ignore certain files when checking for untracked files or dirty Git state after regenerating examples.
This is useful for files that have dynamic content, such as dates and times, that we do not expect to be consistent.
- Migrate the packaging to ``pyproject.toml`` and retire the ``setup.cfg`` and ``setup.py`` files.
- Migrate to the new Rubin user guide theme for documentation.
- Add GitHub Actions workflow to update pre-commit hooks with Neophile.
- Adopted the PyPI trusted publishers workflow.

0.5.1 (2022-03-15)
==================

Expand Down
7 changes: 7 additions & 0 deletions docs/_rst_epilog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

.. _Cookiecutter: https://cookiecutter.readthedocs.io/en/latest/
.. _Jinja: http://jinja.pocoo.org
.. _lsst/templates: https://github.com/lsst/templates
.. _mypy: http://www.mypy-lang.org
.. _tox: https://tox.readthedocs.io/en/latest/
.. _pytest: https://docs.pytest.org/en/latest/
140 changes: 1 addition & 139 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,139 +1 @@
import os
import sys

import lsst_sphinx_bootstrap_theme
from documenteer.sphinxconfig.utils import form_ltd_edition_name

# Work around Sphinx bug related to large and highly-nested source files
sys.setrecursionlimit(2000)

# -- Common links and substitutions ---------------------------------------

rst_epilog = """
.. _Cookiecutter: https://cookiecutter.readthedocs.io/en/latest/
.. _Jinja: http://jinja.pocoo.org
.. _lsst/templates: https://github.com/lsst/templates
.. _mypy: http://www.mypy-lang.org
.. _tox: https://tox.readthedocs.io/en/latest/
.. _pytest: https://docs.pytest.org/en/latest/
"""

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

# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'

# 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.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.ifconfig",
"sphinx_click.ext",
"numpydoc",
"sphinx_automodapi.automodapi",
"sphinx_automodapi.smart_resolver",
"documenteer.sphinxext",
]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = ".rst"

# The master toctree document.
master_doc = "index"

# General information about the project.
project = "Templatekit"
copyright = "2018-2019 Association of Universities for Research in Astronomy"
author = "LSST Data Management"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
if os.getenv("TRAVIS_BRANCH", default="master") == "master":
# Use the current release as the version tag if on master
version = "Current"
release = version
else:
# Use branch name as the version tag
version = form_ltd_edition_name(
git_ref_name=os.getenv("TRAVIS_BRANCH", default="master")
)
release = version

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# today = ''
# Else, today_fmt is used as the format for a strftime call.
# today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ["_build", "README.rst"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"

# The reST default role cross-links Python (used for this markup: `text`)
default_role = "py:obj"

# Intersphinx

intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"cookiecutter": ("https://cookiecutter.readthedocs.io/en/latest/", None),
}

# -- Options for linkcheck builder ----------------------------------------

linkcheck_retries = 2

# -- Options for HTML output ----------------------------------------------

templates_path = [
"_templates",
lsst_sphinx_bootstrap_theme.get_html_templates_path(),
]

html_theme = "lsst_sphinx_bootstrap_theme"
html_theme_path = [lsst_sphinx_bootstrap_theme.get_html_theme_path()]


html_context = {
# Enable "Edit in GitHub" link
"display_github": True,
# https://{{ github_host|default("github.com") }}/{{ github_user }}/
# {{ github_repo }}/blob/
# {{ github_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}
"github_user": "lsst-sqre",
"github_repo": "templatekit",
"conf_py_path": "docs/",
# TRAVIS_BRANCH is available in CI, but master is a safe default
"github_version": os.getenv("TRAVIS_BRANCH", default="master") + "/",
}

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {"logotext": project}

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
# html_title = None

# A shorter title for the navigation bar. Default is the same as html_title.
html_short_title = project

# 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 = []

# If true, links to the reST sources are added to the pages.
html_show_sourcelink = False
from documenteer.conf.guide import * # noqa: F401, F403
10 changes: 10 additions & 0 deletions docs/dev/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#################
Development guide
#################

.. toctree::
:maxdepth: 2
:titlesonly:

development
release
Loading

0 comments on commit 16f5094

Please sign in to comment.