Skip to content

Commit

Permalink
Publish doc to GitHub Pages
Browse files Browse the repository at this point in the history
- Update documentation
- Fix links and badges
  • Loading branch information
arneso-ssb committed Aug 29, 2023
1 parent 6ed4035 commit d632b49
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 26 deletions.
41 changes: 36 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
name: Check documentation
on: [push, pull_request]
name: Documentation

on:
push:
branches:
- main
- master
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
docs:
build:
name: Build documentation & check links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4.5.0
- uses: actions/setup-python@v4.7.0
with:
python-version: "3.8"
python-version: "3.11"
- run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip install --constraint=.github/workflows/constraints.txt nox
Expand All @@ -20,3 +33,21 @@ jobs:
path: docs/_build
- name: Check links
run: nox --force-color --session=linkcheck

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
contents: read
pages: write
id-token: write
runs-on: ubuntu-latest
needs: build
steps:
- name: Setup Pages
uses: actions/configure-pages@v3

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@
[black project]: https://github.com/psf/black
[calver badge]: https://img.shields.io/badge/calver-YYYY.MM.DD-22bfda.svg
[calver]: https://calver.org/
[code of conduct]: https://github.com/cjolowicz/cookiecutter-hypermodern-python/blob/main/CODE_OF_CONDUCT.md
[code of conduct]: https://github.com/statisticsnorway/ssb-pypitemplate/blob/main/CODE_OF_CONDUCT.md
[codecov badge]: https://codecov.io/gh/cjolowicz/cookiecutter-hypermodern-python-instance/branch/main/graph/badge.svg
[codecov page]: https://app.codecov.io/gh/cjolowicz/cookiecutter-hypermodern-python-instance
[contributor covenant badge]: https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg
[github actions badge]: https://github.com/cjolowicz/cookiecutter-hypermodern-python/workflows/Tests/badge.svg
[github actions page]: https://github.com/cjolowicz/cookiecutter-hypermodern-python/actions?workflow=Tests
[github page]: https://github.com/cjolowicz/cookiecutter-hypermodern-python
[license badge]: https://img.shields.io/github/license/cjolowicz/cookiecutter-hypermodern-python
[github actions badge]: https://github.com/statisticsnorway/ssb-pypitemplate/workflows/Tests/badge.svg
[github actions page]: https://github.com/statisticsnorway/ssb-pypitemplate/actions?workflow=Tests
[github page]: https://github.com/statisticsnorway/ssb-pypitemplate
[license badge]: https://img.shields.io/github/license/statisticsnorway/ssb-pypitemplate
[license]: https://opensource.org/licenses/MIT
[pre-commit badge]: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
[pre-commit project]: https://pre-commit.com/
[python version badge]: https://img.shields.io/pypi/pyversions/cookiecutter-hypermodern-python-instance
[readthedocs badge]: https://img.shields.io/readthedocs/cookiecutter-hypermodern-python/latest.svg?label=Read%20the%20Docs
[readthedocs page]: https://cookiecutter-hypermodern-python.readthedocs.io/
[status badge]: https://badgen.net/badge/status/alpha/d8624d
[status badge]: https://badgen.net/badge/status/beta/d8624d

<!-- badges-end -->

Expand Down Expand Up @@ -89,7 +89,7 @@ cruft update
- Generate command-line reference with [sphinx-click]
- Manage project labels with [GitHub Labeler]

The template supports Python 3.8, 3.9, 3.10 and 3.11.
The template supports Python 3.9, 3.10 and 3.11.

[autodoc]: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
[bandit]: https://github.com/PyCQA/bandit
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from datetime import datetime


project = "Hypermodern Python Cookiecutter"
author = "Claudio Jolowicz"
project = "SSB PyPI Template"
author = "Claudio Jolowicz and Statistics Norway"
copyright = f"{datetime.now().year}, {author}"
extensions = ["sphinx.ext.intersphinx", "myst_parser"]
intersphinx_mapping = {"mypy": ("https://mypy.readthedocs.io/en/stable/", None)}
Expand Down
10 changes: 7 additions & 3 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ myst:
# User Guide

This is the user guide
for the [Hypermodern Python Cookiecutter],
for the [SSB PyPI Template],
a Python template based on the [Hypermodern Python] article series.
It is a fork of [Hypermodern Python Cookiecutter] and adopted for use in
[Statistics Norway].

If you're in a hurry, check out the [quickstart guide](quickstart)
and the [tutorials](tutorials).
Expand Down Expand Up @@ -2729,13 +2731,15 @@ You can also read the articles on [this blog][hypermodern python blog].
[safety]: https://github.com/pyupio/safety
[salsify/action-detect-and-tag-new-version]: https://github.com/salsify/action-detect-and-tag-new-version
[schlawack semantic]: https://hynek.me/articles/semver-will-not-save-you/
[schreiner constraints]: https://iscinumpy.dev/post/bound-version-constraints/
[schreiner poetry]: https://iscinumpy.dev/post/poetry-versions/
[schreiner constraints]: https://iscinumpy.gitlab.io/post/bound-version-constraints/
[schreiner poetry]: https://iscinumpy.gitlab.io/post/poetry-versions/
[semantic versioning]: https://semver.org/
[sphinx configuration]: https://www.sphinx-doc.org/en/master/usage/configuration.html
[sphinx-autobuild]: https://github.com/executablebooks/sphinx-autobuild
[sphinx-click]: https://sphinx-click.readthedocs.io/
[sphinx]: http://www.sphinx-doc.org/
[ssb pypi template]: https://github.com/statisticsnorway/ssb-pypitemplate
[statistics norway]: https://www.ssb.no/
[test fixture]: https://docs.pytest.org/en/latest/explanation/fixtures.html#about-fixtures
[testpypi]: https://test.pypi.org/
[toml]: https://github.com/toml-lang/toml
Expand Down
13 changes: 11 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Hypermodern Python Cookiecutter
# SSB PyPI Template

```{toctree}
---
Expand All @@ -23,12 +23,20 @@ end-before: <!-- badges-end -->
```

[Cookiecutter] template for a Python package
based on the [Hypermodern Python] article series.
based on the [Hypermodern Python] article series,
and adopted for use in [Statistics Norway].

## Usage

Use [Cruft](https://cruft.github.io/cruft/) to create and update an instance of this template.

```console
cruft create https://github.com/statisticsnorway/ssb-pypitemplate.git --checkout=2023.2.24

# To check if there are there are template updates and update your instance with
# the new updates, run the following commands from the root directory:
cruft check
cruft update
```

## Features
Expand Down Expand Up @@ -81,3 +89,4 @@ All images on the
[hypermodern python]: https://medium.com/@cjolowicz/hypermodern-python-d44485d9d769
[hypermodernism]: https://en.wikipedia.org/wiki/Hypermodernism_(chess)
[retrofuturism]: https://en.wikipedia.org/wiki/Retrofuturism
[statistics norway]: https://www.ssb.no/
2 changes: 1 addition & 1 deletion docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $ pipx inject nox nox-poetry

[pipx] is preferred, but you can also install with `pip install --user`.

It is recommended to set up Python 3.8, 3.9, 3.10 and 3.11 using [pyenv].
It is recommended to set up Python 3.9, 3.10 and 3.11 using [pyenv].

## Creating a project

Expand Down
6 changes: 0 additions & 6 deletions {{cookiecutter.project_name}}/.github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
Expand Down
2 changes: 2 additions & 0 deletions {{cookiecutter.project_name}}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@

[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)][pre-commit]
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)][black]
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)][poetry]

[pypi status]: https://pypi.org/project/{{cookiecutter.project_name}}/
[read the docs]: https://{{cookiecutter.project_name}}.readthedocs.io/
[tests]: https://github.com/{{cookiecutter.github_organization}}/{{cookiecutter.project_name}}/actions?workflow=Tests
[codecov]: https://app.codecov.io/gh/{{cookiecutter.github_organization}}/{{cookiecutter.project_name}}
[pre-commit]: https://github.com/pre-commit/pre-commit
[black]: https://github.com/psf/black
[poetry]: https://python-poetry.org/

## Features

Expand Down

0 comments on commit d632b49

Please sign in to comment.