Skip to content

Commit a92a548

Browse files
authored
Merge branch 'main' into main
2 parents 6fb6dc9 + c574e5a commit a92a548

18 files changed

Lines changed: 1066 additions & 350 deletions

File tree

.github/workflows/build-book.yml

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@ on:
1010
branches:
1111
- main
1212

13-
# This job installs dependencies, build the book, and pushes it to `gh-pages`
13+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
19+
# Build and test the book, then deploy from a separate job.
1420
jobs:
1521
build-test-book:
1622
runs-on: ubuntu-latest
1723
steps:
18-
- uses: actions/checkout@v6
24+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1925
with:
2026
fetch_depth: 0
2127

@@ -25,7 +31,7 @@ jobs:
2531
git restore-mtime
2632
2733
- name: Setup Python
28-
uses: actions/setup-python@v6
34+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2935
with:
3036
python-version: "3.13"
3137

@@ -38,7 +44,7 @@ jobs:
3844
run: echo "::set-output name=dir::$(pip cache dir)"
3945

4046
- name: Cache dependencies
41-
uses: actions/cache@v5
47+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5.0.5
4248
with:
4349
path: ${{ steps.pip-cache.outputs.dir }}
4450
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
@@ -50,6 +56,9 @@ jobs:
5056

5157
- name: Build book
5258
run: nox -s docs-test
59+
- name: Setup Pages
60+
id: pages
61+
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d #v6
5362

5463
# Save html as artifact
5564
- name: Save book html as artifact for viewing
@@ -59,20 +68,30 @@ jobs:
5968
path: |
6069
_build/html/
6170
62-
# Push the book's HTML to github-pages
63-
- name: Push to GitHub Pages
64-
# Only push if on main branch
65-
if: github.ref == 'refs/heads/main'
66-
uses: peaceiris/actions-gh-pages@v4.0.0
71+
- name: Upload artifact
72+
# Automatically uploads an artifact from the './_site' directory by default
73+
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b #v4
6774
with:
68-
github_token: ${{ secrets.GITHUB_TOKEN }}
69-
publish_dir: ./_build/html
75+
path: ./_build/html
7076

7177
# Test for bad links and ensure alt tags for usability
7278
- name: Check HTML using htmlproofer
79+
continue-on-error: true
7380
uses: chabad360/htmlproofer@master
7481
with:
7582
directory: "_build/html"
7683
arguments: |
7784
--ignore-files "/.+\/_static\/.+/,/genindex.html/"
78-
--ignore-status-codes "0, 200, 403, 429, 503"
85+
--ignore-status-codes "0, 200, 401, 403, 429, 503"
86+
87+
deploy:
88+
if: github.ref == 'refs/heads/main'
89+
needs: build-test-book
90+
runs-on: ubuntu-latest
91+
environment:
92+
name: github-pages
93+
url: ${{ steps.deployment.outputs.page_url }}
94+
steps:
95+
- name: Deploy to GitHub Pages
96+
id: deployment
97+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 #v5.0.0

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repos:
2525
- id: trailing-whitespace
2626

2727
- repo: https://github.com/codespell-project/codespell
28-
rev: v2.4.1
28+
rev: v2.4.2
2929
hooks:
3030
- id: codespell
3131
additional_dependencies:
@@ -36,7 +36,7 @@ repos:
3636
)$
3737
3838
- repo: https://github.com/errata-ai/vale
39-
rev: v3.13.1
39+
rev: v3.14.1
4040
hooks:
4141
- id: vale
4242

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Initiatives.
2424

2525
## Contributing statement
2626

27-
2827
## How to setup
2928

3029
This repository contains the source files for the [pyOpenSci Python packaging guide](https://pyopensci.org/python-package-guide).
@@ -44,44 +43,49 @@ To build, follow these steps:
4443
1. Install `nox`
4544

4645
```console
47-
$ python -m pip install nox
46+
python -m pip install nox
4847
```
48+
4949
2. Build the documentation:
5050

5151
```console
52-
$ nox -s docs
52+
nox -s docs
5353
```
5454

5555
This should create a local environment in a `.nox` folder, build the documentation (as specified in the `noxfile.py` configuration), and the output will be in `_build/html`.
5656

5757
To build live documentation that updates when you update local files, run the following command:
5858

5959
```console
60-
$ nox -s docs-live
60+
nox -s docs-live
6161
```
6262

63+
If you are a uv user, you can also skip installing `nox` and use `uvx` instead:
64+
65+
`uvx nox -s docs-live`
66+
6367
### Building for release
6468

6569
When building for release, the docs are built multiple times for each translation,
6670
but translations are only included in the production version of the guide after some completion threshold.
6771

6872
The sphinx build environment is controlled by an environment variable `SPHINX_ENV`
6973

70-
- when `SPHINX_ENV=development` (default), sphinx assumes all languages are built,
74+
* when `SPHINX_ENV=development` (default), sphinx assumes all languages are built,
7175
and includes them in the language selector
72-
- when `SPHINX_ENV=production`, only those languages in `release_languages` (set in `conf.py`)
76+
* when `SPHINX_ENV=production`, only those languages in `release_languages` (set in `conf.py`)
7377
are built and included in the language selector.
7478

7579
Most of the time you should not need to set `SPHINX_ENV`,
7680
as it is forced by the primary nox sessions intended to be used for release or development:
7781

7882
`SPHINX_ENV=development`
79-
- `docs-live` - autobuild english
80-
- `docs-live-lang` - autobuild a single language
81-
- `docs-live-langs` - autobuild all languages
83+
* `docs-live` - autobuild english
84+
* `docs-live-lang` - autobuild a single language
85+
* `docs-live-langs` - autobuild all languages
8286

8387
`SPHINX_ENV=production`
84-
- `build-test` - build all languages for production
88+
* `build-test` - build all languages for production
8589

8690
## Contributing to this guide
8791

_static/pyos.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,21 +340,21 @@ See https://github.com/pydata/pydata-sphinx-theme/pull/1784
340340
src: url("./fonts/poppins-v20-latin-600.woff2") format("woff2"); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
341341
}
342342

343-
/* nunitosans-regular - latin */
343+
/* nunitosans-variable - latin */
344344
@font-face {
345345
font-display: swap;
346346
font-family: "NunitoSans";
347347
font-style: normal;
348-
font-weight: 400;
348+
font-weight: 200 800;
349349
src: url("./fonts/NunitoSans-VariableFont.woff2") format("woff2");
350350
}
351351

352-
/* nunitosans-italic - latin */
352+
/* nunitosans-italic-variable - latin */
353353
@font-face {
354354
font-display: swap;
355355
font-family: "NunitoSans";
356356
font-style: italic;
357-
font-weight: 400;
357+
font-weight: 200 800;
358358
src: url("./fonts/NunitoSans-Italic-VariableFont.woff2") format("woff2");
359359
}
360360

conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@
176176
".pytest_cache/README.md",
177177
"vale-styles/*",
178178
"CODE_OF_CONDUCT.md",
179+
"CLAUDE.md",
180+
# Local virtualenv under the doc root; otherwise Sphinx/Myst scans site-packages.
181+
".venv",
182+
"venv",
183+
"env",
184+
"LICENSE.rst"
179185
]
180186

181187
# For sitemap generation

documentation/repository-files/license-files.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ This would not be true with a GPL licensed package. `GPL-3` packages can include
132132

133133
While many permissive licenses do not require citation, we strongly encourage that you cite all software that you use in papers, blogs, and other publications. You tell your users how to cite your package by using a [citation.cff file](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-citation-files).
134134

135+
:::{tip} Additional resources on software citation
136+
The Turing Way has excellent guides on this topic:
137+
138+
- [CITATION.cff files](https://book.the-turing-way.org/communication/citable/citable-cff) — detailed guide on creating and maintaining citation files
139+
- [Software citation pathways](https://book.the-turing-way.org/pathways/pathways-software-citation) — overview of how software citation works in practice
140+
:::
141+
135142
### Citation.cff files: Making your software citable
136143

137144
A `CITATION.cff` file is a machine-readable file that provides citation information for your software package. The "cff" stands for "Citation File Format," which is a standardized format for software citation metadata.

examples/pure-hatch/.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
hatch --version # Verify that Hatch is installed
2929
- name: Build artifacts
3030
run: hatch build
31-
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
31+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
3232
with:
3333
path: dist/
3434
name: dist.zip
@@ -50,4 +50,4 @@ jobs:
5050
with:
5151
name: dist.zip
5252
path: dist/
53-
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
53+
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0

index.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ We support the Python tools that scientists need to create open science workflow
1717

1818
```{only} html
1919
![GitHub release (latest by date)](https://img.shields.io/github/v/release/pyopensci/python-package-guide?color=purple&display_name=tag&style=plastic)
20-
[![](https://img.shields.io/github/stars/pyopensci/python-package-guide?style=social)](https://github.com/pyopensci/contributing-guide)
20+
[![](https://img.shields.io/github/stars/pyopensci/python-package-guide?style=social)](https://github.com/pyopensci/python-package-guide)
2121
[![DOI](https://zenodo.org/badge/556814582.svg)](https://zenodo.org/badge/latestdoi/556814582)
2222
```
2323

@@ -56,7 +56,7 @@ Community docs
5656
Publish your docs
5757
```
5858

59-
## Tutorial Series: Create a Python Package
59+
## Tutorial Series: Create a Python Package
6060

6161
The first round of our community-developed, how to create a Python package tutorial series for scientists is complete! Join our community review process or watch development of future tutorials in our [GitHub repo here](https://github.com/pyOpenSci/python-package-guide).
6262

@@ -91,6 +91,7 @@ The first round of our community-developed, how to create a Python package tutor
9191
:class-card: left-aligned
9292

9393
* [Introduction to Hatch](/tutorials/get-to-know-hatch)
94+
* [Run Python scripts using Hatch](/tutorials/run-python-scripts-hatch)
9495

9596
:::
9697
::::
@@ -193,7 +194,6 @@ Learn about best practices for:
193194

194195
## Tests
195196

196-
197197
:::::{grid} 1 1 2 2
198198
:class-container: text-center
199199
:gutter: 3
@@ -212,7 +212,8 @@ Learn about best practices for:
212212
:::{card} ✨ Run your tests ✨
213213
:class-card: left-aligned
214214

215-
* [Run tests locally](tests/run-tests)
215+
* [Run tests locally with Hatch](tests/run-tests)
216+
* [Run tests with nox](tests/run-tests-nox)
216217
* [Run tests in CI](tests/tests-ci)
217218
:::
218219
::::
@@ -245,7 +246,7 @@ contribute.
245246

246247
:::::
247248

248-
:::{image} https://www.pyopensci.org/images/people-building-blocks.jpg
249+
:::{image} <https://www.pyopensci.org/images/people-building-blocks.jpg>
249250
:align: right
250251
:width: 350
251252
:alt: xkcd comic showing a stick figure on the ground and one in the air. The one on the ground is saying. `You're flying! how?` The person in the air replies `Python!` Below is a 3 rectangle comic with the following text in each box. Box 1 - I learned it last night. Everything is so simple. Hello world is just print hello world. Box 2 - the person on the ground says - come join us programming is fun again. It's a whole new world. But how are you flying? box 3 - the person flying says - i just typed import antigravity. I also sampled everything in the medicine cabinet. But i think this is the python. The person on the ground is saying - that's it?

package-structure-code/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This section covers everything you need to structure your Python package, configure metadata, choose build tools, and publish your package to PyPI and conda-forge.
44

5-
:::::{grid} 1 2
5+
:::::{grid} 1 1 2 2
66
:gutter: 3
77

88
::::{grid-item}

package-structure-code/python-package-structure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Want to learn how to create the structure to build your package? Click here.
3939

4040
An example of the **src/package** layout structure is below.
4141

42-
```{console}
42+
```bash
4343
myPackageRepoName
4444
├── CHANGELOG.md ┐
4545
├── CODE_OF_CONDUCT.md │

0 commit comments

Comments
 (0)