Skip to content

Commit d5d2339

Browse files
authored
Merge branch 'main' into tests
2 parents 2da7dad + af15e8c commit d5d2339

23 files changed

+306
-233
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2.1
22
jobs:
33
build-book:
44
docker:
5-
- image: cimg/python:3.9
5+
- image: cimg/python:3.13
66
steps:
77
- checkout
88
- run:

.github/workflows/build-book.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup Python
2121
uses: actions/setup-python@v5
2222
with:
23-
python-version: "3.9"
23+
python-version: "3.13"
2424

2525
- name: Upgrade pip
2626
run: |
@@ -68,4 +68,4 @@ jobs:
6868
directory: "_build/html"
6969
arguments: |
7070
--ignore-files "/.+\/_static\/.+/,/genindex.html/"
71-
--ignore-status-codes "404, 403, 429, 503"
71+
--ignore-status-codes "0, 200, 403, 429, 503"

TRANSLATING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ If a language is ready to go live, the maintainers will add the language code to
287287

288288
When the guide is built for release in CI, Sphinx will also generate the translated versions of the guide for the languages in the `RELEASE_LANGUAGES` list.
289289

290-
Translations are released in the same way as the English version of the guide, and the translated versions will be available in folders named after the language code. For example, the Spanish translation will be available in [https://www.pyopensci.org/python-package-guide/es/](https://www.pyopensci.org/python-package-guide/es/).
290+
Translations are released in the same way as the English version of the guide, and the translated versions will be available in folders named after the language code. For example, the Spanish translation will be available at: `https://www.pyopensci.org/python-package-guide/es/` when it is published online.
291291

292292
## Frequently Asked Questions (FAQ)
293293

_ext/__init__.py

Whitespace-only changes.

_ext/rss.py

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
"""
2+
Create an RSS feed of tutorials
3+
4+
Cribbed from: https://github.com/python/peps/blob/main/pep_sphinx_extensions/generate_rss.py
5+
"""
6+
7+
from dataclasses import dataclass, asdict
8+
from datetime import datetime, UTC
9+
from email.utils import format_datetime
10+
from html import escape
11+
from pprint import pformat
12+
from typing import TYPE_CHECKING
13+
from urllib.parse import urljoin
14+
15+
if TYPE_CHECKING:
16+
from sphinx.application import Sphinx
17+
18+
19+
def _format_rfc_2822(dt: datetime) -> str:
20+
datetime = dt.replace(tzinfo=UTC)
21+
return format_datetime(datetime, usegmt=True)
22+
23+
24+
@dataclass
25+
class RSSItem:
26+
title: str
27+
date: datetime
28+
description: str
29+
url: str
30+
author: str = "pyOpenSci"
31+
32+
@classmethod
33+
def from_meta(cls, page_name: str, meta: dict, app: "Sphinx") -> "RSSItem":
34+
"""Create from a page's metadata"""
35+
url = urljoin(app.config.html_baseurl, app.builder.get_target_uri(page_name))
36+
# purposely don't use `get` here because we want to error if these fields are absent
37+
return RSSItem(
38+
title=meta[":og:title"],
39+
description=meta[":og:description"],
40+
date=datetime.fromisoformat(meta["date"]),
41+
author=meta.get(":og:author", "pyOpenSci"),
42+
url=url,
43+
)
44+
45+
def render(self) -> str:
46+
return f"""\
47+
<item>
48+
<title>{escape(self.title, quote=False)}</title>
49+
<link>{escape(self.url, quote=False)}</link>
50+
<description>{escape(self.description, quote=False)}</description>
51+
<author>{escape(self.author, quote=False)}</author>
52+
<guid isPermaLink="true">{self.url}</guid>
53+
<pubDate>{_format_rfc_2822(self.date)}</pubDate>
54+
</item>"""
55+
56+
57+
@dataclass
58+
class RSSFeed:
59+
items: list[RSSItem]
60+
last_build_date: datetime = datetime.now()
61+
title: str = "pyOpenSci Tutorials"
62+
link: str = "https://www.pyopensci.org/python-package-guide/tutorials/intro.html"
63+
self_link: str = "https://www.pyopensci.org/python-package-guide/tutorials.rss"
64+
description: str = "Tutorials for learning python i guess!!!"
65+
language: str = "en"
66+
67+
def render(self) -> str:
68+
items = sorted(self.items, key=lambda i: i.date, reverse=True)
69+
items = "\n".join([item.render() for item in items])
70+
return f"""\
71+
<?xml version='1.0' encoding='UTF-8'?>
72+
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
73+
<channel>
74+
<title>{self.title}</title>
75+
<link>{self.link}</link>
76+
<atom:link href="{self.self_link}" rel="self"/>
77+
<description>{self.description}</description>
78+
<language>{self.language}</language>
79+
<lastBuildDate>{_format_rfc_2822(self.last_build_date)}</lastBuildDate>
80+
{items}
81+
</channel>
82+
</rss>
83+
"""
84+
85+
86+
def generate_tutorials_feed(app: "Sphinx"):
87+
from sphinx.util import logging
88+
89+
logger = logging.getLogger("_ext.rss")
90+
logger.info("Generating RSS feed for tutorials")
91+
metadata = app.builder.env.metadata
92+
tutorials = [t for t in metadata if t.startswith("tutorials/")]
93+
feed_items = [RSSItem.from_meta(t, metadata[t], app) for t in tutorials]
94+
feed = RSSFeed(items=feed_items)
95+
with open(app.outdir / "tutorials.rss", "w") as f:
96+
f.write(feed.render())
97+
98+
logger.info(
99+
f"Generated RSS feed for tutorials, wrote to {app.outdir / 'tutorials.rss'}"
100+
)
101+
logger.debug(f"feed items: \n{pformat([asdict(item) for item in feed_items])}")

bibliography.bib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ @misc{creativecommonsShareAlikeCompatibilityGPLv32015
3838
year = {2015},
3939
month = sep,
4040
journal = {Creative Commons Wiki},
41-
url = {https://wiki.creativecommons.org/wiki/ShareAlike\_compatibility:\_GPLv3},
41+
url = {https://wiki.creativecommons.org/wiki/ShareAlike_compatibility:_GPLv3},
4242
urldate = {2024-03-02}
4343
}

conf.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@
1010
# add these directories to sys.path here. If the directory is relative to the
1111
# documentation root, use os.path.abspath to make it absolute, like shown here.
1212
#
13-
# import os
14-
# import sys
15-
# sys.path.insert(0, os.path.abspath('.'))
13+
import os
14+
import sys
15+
sys.path.insert(0, os.path.abspath('.'))
1616
from datetime import datetime
1717
import subprocess
1818
import os
19+
from typing import TYPE_CHECKING
20+
from _ext import rss
21+
22+
if TYPE_CHECKING:
23+
from sphinx.application import Sphinx
1924

2025
current_year = datetime.now().year
2126
organization_name = "pyOpenSci"
@@ -96,9 +101,10 @@
96101
]
97102

98103
html_baseurl = "https://www.pyopensci.org/python-package-guide/"
104+
lang_selector_baseurl = "/python-package-guide/"
99105
if not sphinx_env == "production":
100106
# for links in language selector when developing locally
101-
html_baseurl = "/"
107+
lang_selector_baseurl = "/"
102108

103109
html_theme_options = {
104110
"announcement": "<p><a href='https://www.pyopensci.org/about-peer-review/index.html'>We run peer review of scientific Python software. Learn more.</a></p>",
@@ -148,7 +154,7 @@
148154
"github_version": "main",
149155
"language": language,
150156
"languages": build_languages,
151-
"baseurl": html_baseurl,
157+
"baseurl": lang_selector_baseurl,
152158
}
153159

154160
# Add any paths that contain templates here, relative to this directory.
@@ -198,3 +204,14 @@
198204
bibtex_bibfiles = ["bibliography.bib"]
199205
# myst complains about bibtex footnotes because of render order
200206
suppress_warnings = ["myst.footnote"]
207+
208+
209+
def _post_build(app: "Sphinx", exception: Exception | None) -> None:
210+
rss.generate_tutorials_feed(app)
211+
212+
213+
def setup(app: "Sphinx"):
214+
app.connect("build-finished", _post_build)
215+
216+
# Parallel safety: https://www.sphinx-doc.org/en/master/extdev/index.html#extension-metadata
217+
return {"parallel_read_safe": True, "parallel_write_safe": True}

documentation/repository-files/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ name: moving-pandas-github-community
1616
width: 80%
1717
alt: Image showing that the MovingPandas GitHub repository community health page with green checks next to each file including a description, README, code of conduct, contributing, license and issue templates. Note that Security policy has a yellow circle next to it as that is missing from the repo.
1818
---
19-
GitHub community health looks for a readme file among other elements when it evaluates the community level health of your repository. This example is from the [MovingPandas GitHub repo](https://github.com/anitagraser/movingpandas/community) *(screen shot taken Nov 23 2022)*
19+
GitHub community health looks for a readme file among other elements when it evaluates the community level health of your repository. This example is from the [MovingPandas GitHub repo](https://github.com/movingpandas/movingpandas/community) *(screen shot taken Nov 23 2022)*
2020
```
2121

2222
[Snyk](https://snyk.io/advisor/python) is another well-known company that

documentation/repository-files/license-files.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ bibliography:
55

66
(license-file)=
77

8-
# License files for scientific Python open source software
8+
# License files for Python open source software
99

1010
:::{button-link} <https://www.pyopensci.org/about-peer-review/>
1111
:color: primary
@@ -69,7 +69,7 @@ in some cases the license that you want is not available through that online
6969
process.
7070

7171
:::{admonition} License recommendations from the SciPy package
72-
[The SciPy documentation has an excellent overview of licenses.](https://docs.scipy.org/doc/scipy/dev/core-dev/index.html#licensing). One of the key elements
72+
[The SciPy documentation has an excellent overview of licenses.](https://docs.scipy.org/doc/scipy/dev/core-dev/index.html#licensing) One of the key elements
7373
that these docs recommend is ensuring that the license that you select is
7474
compatible with licenses used in many parts of the scientific Python ecosystem.
7575
Below is a highlight of this text which outlines license that are compatible

locales/ja/LC_MESSAGES/index.po

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
# SOME DESCRIPTIVE TITLE.
2-
# Copyright (C) 2024, pyOpenSci
2+
# Copyright (C) 2025, pyOpenSci
33
# This file is distributed under the same license as the pyOpenSci Python
44
# Package Guide package.
5-
# FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
5+
# FIRST AUTHOR <EMAIL@ADDRESS>, 2025.
66
#
7+
# Translators:
8+
# Tetsuo Koyama <[email protected]>, 2025
79
#, fuzzy
810
msgid ""
911
msgstr ""
10-
"Project-Id-Version: pyOpenSci Python Package Guide \n"
12+
"Project-Id-Version: pyOpenSci Python Package Guide\n"
1113
"Report-Msgid-Bugs-To: \n"
12-
"POT-Creation-Date: 2025-02-17 22:50+0000\n"
13-
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14-
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14+
"POT-Creation-Date: 2025-04-20 11:32+0900\n"
15+
"PO-Revision-Date: 2025-04-14 18:12+0000\n"
16+
"Last-Translator: Tetsuo Koyama <[email protected]>, 2025\n"
1517
"Language: ja\n"
1618
"Language-Team: ja <[email protected]>\n"
1719
"Plural-Forms: nplurals=1; plural=0;\n"
@@ -42,11 +44,11 @@ msgstr "テスト"
4244

4345
#: ../../index.md:325
4446
msgid "CI/CD"
45-
msgstr ""
47+
msgstr "CI/CD"
4648

4749
#: ../../index.md:325
4850
msgid "Continuous Integration"
49-
msgstr ""
51+
msgstr "継続的インテグレーション"
5052

5153
#: ../../index.md:1
5254
msgid "pyOpenSci Python Package Guide"
@@ -87,7 +89,6 @@ msgid "About this guide"
8789
msgstr "このガイドについて"
8890

8991
#: ../../index.md:29
90-
#, fuzzy
9192
msgid ""
9293
"Image with the pyOpenSci flower logo in the upper right hand corner. The "
9394
"image shows the packaging lifecycle. The graphic shows a high level "
@@ -164,15 +165,14 @@ msgid "_new_ Tutorial Series: Create a Python Package"
164165
msgstr "_new_ チュートリアルシリーズ: Pythonパッケージの作成"
165166

166167
#: ../../index.md:61
167-
#, fuzzy
168168
msgid ""
169169
"The first round of our community-developed, how to create a Python "
170170
"package tutorial series for scientists is complete! Join our community "
171171
"review process or watch development of future tutorials in our [GitHub "
172172
"repo here](https://github.com/pyOpenSci/python-package-guide)."
173173
msgstr ""
174174
"コミュニティが開発した、科学者のためのPythonパッケージの作り方チュートリアルシリーズの第一弾が完成しました! "
175-
"コミュニティのレビュープロセスに参加したり、 [Github リポジトリはこちら](https://github.com/pyOpenSci"
175+
"コミュニティのレビュープロセスに参加したり、 [GitHub リポジトリはこちら](https://github.com/pyOpenSci"
176176
"/python-package-guide) で今後のチュートリアルの開発を見守ったりしてください。"
177177

178178
#: ../../index.md:71
@@ -221,11 +221,11 @@ msgstr "[Hatch入門](/tutorials/get-to-know-hatch)"
221221

222222
#: ../../index.md:102
223223
msgid "✿ Reference Guides ✿"
224-
msgstr ""
224+
msgstr "✿ リファレンスガイド ✿"
225225

226226
#: ../../index.md:106
227227
msgid "[Command Line Reference Guide](/tutorials/command-line-reference)"
228-
msgstr ""
228+
msgstr "[コマンドラインリファレンスガイド](/tutorials/command-line-reference)"
229229

230230
#: ../../index.md:111
231231
msgid "Python Packaging for Scientists"
@@ -391,12 +391,11 @@ msgstr ""
391391
"doc-syntax)"
392392

393393
#: ../../index.md:192
394-
#, fuzzy
395394
msgid ""
396395
"[Host your docs on Read The Docs or GitHub Pages](/documentation/hosting-"
397396
"tools/publish-documentation-online)"
398397
msgstr ""
399-
"[Read The Docs または Github Pages でドキュメントをホストする](/documentation/hosting-"
398+
"[Read The Docs または GitHub Pages でドキュメントをホストする](/documentation/hosting-"
400399
"tools/publish-documentation-online)"
401400

402401
#: ../../index.md:198
@@ -458,7 +457,6 @@ msgid ""
458457
msgstr "このガイドへのご貢献をお待ちしております。貢献方法についてはこちらをご覧ください。"
459458

460459
#: ../../index.md:255
461-
#, fuzzy
462460
msgid ""
463461
"xkcd comic showing a stick figure on the ground and one in the air. The "
464462
"one on the ground is saying. `You're flying! how?` The person in the air"
@@ -544,11 +542,10 @@ msgstr ""
544542
"forum](https://pyopensci.discourse.group/) をご利用ください。"
545543

546544
#: ../../index.md:289
547-
#, fuzzy
548545
msgid ""
549546
"This living Python packaging guide is updated as tools and best practices"
550547
" evolve in the Python packaging ecosystem. We will be adding new content "
551548
"over the next year."
552549
msgstr ""
553-
"これは Python のパッケージングエコシステムにおけるツールやベストプラクティスの進化に合わせて更新される生きたガイドです。 "
554-
"来年にかけて新しいコンテンツを追加していく予定です。"
550+
"これは Python のパッケージングエコシステムにおけるツールやベストプラクティスの進化に合わせて更新されるこの生きた Python "
551+
"パッケージングガイドです。 来年にかけて新しいコンテンツを追加していく予定です。"

0 commit comments

Comments
 (0)