Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-hatch-fancy-pypi-readme for
openSUSE:Factory checked in at 2023-05-23 14:53:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-hatch-fancy-pypi-readme (Old)
and /work/SRC/openSUSE:Factory/.python-hatch-fancy-pypi-readme.new.1533
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-hatch-fancy-pypi-readme"
Tue May 23 14:53:23 2023 rev:5 rq:1088336 version:23.1.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-hatch-fancy-pypi-readme/python-hatch-fancy-pypi-readme.changes
2023-05-19 11:56:01.679437048 +0200
+++
/work/SRC/openSUSE:Factory/.python-hatch-fancy-pypi-readme.new.1533/python-hatch-fancy-pypi-readme.changes
2023-05-23 14:53:32.806129332 +0200
@@ -1,0 +2,8 @@
+Mon May 22 07:30:03 UTC 2023 - Johannes Kastl <[email protected]>
+
+- update to 23.1.0 (there is no 23.0.0):
+ The only change is that our CLI now also takes the presence of an
+ hatch.toml file into account.
+ The packaging side always supported it.
+
+-------------------------------------------------------------------
Old:
----
hatch_fancy_pypi_readme-22.8.0.tar.gz
New:
----
hatch_fancy_pypi_readme-23.1.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-hatch-fancy-pypi-readme.spec ++++++
--- /var/tmp/diff_new_pack.ROxAsY/_old 2023-05-23 14:53:33.262132031 +0200
+++ /var/tmp/diff_new_pack.ROxAsY/_new 2023-05-23 14:53:33.266132054 +0200
@@ -26,7 +26,7 @@
%endif
%{?sle15_python_module_pythons}
Name: python-hatch-fancy-pypi-readme%{psuffix}
-Version: 22.8.0
+Version: 23.1.0
Release: 0
Summary: Fancy PyPI READMEs with Hatch
License: MIT
++++++ hatch_fancy_pypi_readme-22.8.0.tar.gz ->
hatch_fancy_pypi_readme-23.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatch_fancy_pypi_readme-22.8.0/.github/FUNDING.yml
new/hatch_fancy_pypi_readme-23.1.0/.github/FUNDING.yml
--- old/hatch_fancy_pypi_readme-22.8.0/.github/FUNDING.yml 2020-02-02
01:00:00.000000000 +0100
+++ new/hatch_fancy_pypi_readme-23.1.0/.github/FUNDING.yml 2023-05-22
08:59:35.000000000 +0200
@@ -1,3 +1,2 @@
---
github: hynek
-ko_fi: the_hynek
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/hatch_fancy_pypi_readme-22.8.0/.github/dependabot.yml
new/hatch_fancy_pypi_readme-23.1.0/.github/dependabot.yml
--- old/hatch_fancy_pypi_readme-22.8.0/.github/dependabot.yml 1970-01-01
01:00:00.000000000 +0100
+++ new/hatch_fancy_pypi_readme-23.1.0/.github/dependabot.yml 2023-05-22
08:59:35.000000000 +0200
@@ -0,0 +1,6 @@
+version: 2
+updates:
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "monthly"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/hatch_fancy_pypi_readme-22.8.0/.github/workflows/ci.yml
new/hatch_fancy_pypi_readme-23.1.0/.github/workflows/ci.yml
--- old/hatch_fancy_pypi_readme-22.8.0/.github/workflows/ci.yml 2020-02-02
01:00:00.000000000 +0100
+++ new/hatch_fancy_pypi_readme-23.1.0/.github/workflows/ci.yml 2023-05-22
08:59:35.000000000 +0200
@@ -13,28 +13,29 @@
FORCE_COLOR: "1" # Make tools pretty.
PYTHONIOENCODING: utf-8
TOX_TESTENV_PASSENV: FORCE_COLOR
+ PIP_DISABLE_PIP_VERSION_CHECK: "1"
+ PIP_NO_PYTHON_VERSION_WARNING: "1"
SETUPTOOLS_SCM_PRETEND_VERSION: "1.0" # avoid warnings about shallow checkout
- PYTHON_LATEST: "3.10"
+ PYTHON_LATEST: "3.11"
jobs:
tests:
- name: tox on ${{ matrix.python-version }}
+ name: Tests on ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
- python-version: ["3.7", "3.8", "3.9", "3.10", "~3.11.0-0"]
+ python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
+ - run: python -Im pip install --upgrade wheel tox
- - run: python -m pip install --upgrade tox tox-gh-actions
-
- - run: python -m tox
+ - run: python -Im tox run -f py$(echo ${{ matrix.python-version }} | tr
-d .)
- name: Upload coverage data
uses: actions/upload-artifact@v3
@@ -51,9 +52,9 @@
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
- python-version: ${{env.PYTHON_LATEST}}
+ python-version: ${{ env.PYTHON_LATEST }}
- - run: python -m pip install --upgrade coverage[toml]
+ - run: python -Im pip install --upgrade coverage[toml]
- name: Download coverage data
uses: actions/download-artifact@v3
@@ -62,9 +63,9 @@
- name: Combine coverage and fail if it's <100%.
run: |
- python -m coverage combine
- python -m coverage html --skip-covered --skip-empty
- python -m coverage report --fail-under=100
+ python -Im coverage combine
+ python -Im coverage html --skip-covered --skip-empty
+ python -Im coverage report --fail-under=100
- name: Upload HTML report if check failed.
uses: actions/upload-artifact@v3
@@ -73,13 +74,18 @@
path: htmlcov
if: ${{ failure() }}
- package:
- name: Build & verify package
+ mypy:
+ name: Mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- - uses: hynek/build-and-inspect-python-package@v1
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ env.PYTHON_LATEST }}
+ - run: python -Im pip install --upgrade wheel tox
+
+ - run: python -Im tox run -e mypy
install-dev:
name: Verify dev env
@@ -92,9 +98,9 @@
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
- python-version: ${{env.PYTHON_LATEST}}
- - run: python -m pip install -e .[dev]
- - run: python -c 'import hatch_fancy_pypi_readme'
+ python-version: ${{ env.PYTHON_LATEST }}
+ - run: python -Im pip install -e .[dev]
+ - run: python -Ic 'import hatch_fancy_pypi_readme'
- run: python -m hatch_fancy_pypi_readme tests/example_pyproject.toml
- run: hatch-fancy-pypi-readme tests/example_pyproject.toml
@@ -105,7 +111,6 @@
needs:
- coverage
- install-dev
- - package
runs-on: ubuntu-latest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/hatch_fancy_pypi_readme-22.8.0/.github/workflows/pypi-package.yml
new/hatch_fancy_pypi_readme-23.1.0/.github/workflows/pypi-package.yml
--- old/hatch_fancy_pypi_readme-22.8.0/.github/workflows/pypi-package.yml
1970-01-01 01:00:00.000000000 +0100
+++ new/hatch_fancy_pypi_readme-23.1.0/.github/workflows/pypi-package.yml
2023-05-22 08:59:35.000000000 +0200
@@ -0,0 +1,65 @@
+---
+name: Build & maybe upload PyPI package
+
+on:
+ push:
+ branches: [main]
+ tags: ["*"]
+ pull_request:
+ branches: [main]
+ release:
+ types:
+ - published
+ workflow_dispatch:
+
+permissions:
+ contents: read
+ id-token: write
+
+jobs:
+ # Always build & lint package.
+ build-package:
+ name: Build & verify package
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - uses: hynek/build-and-inspect-python-package@v1
+
+ # Upload to Test PyPI on every tag on main.
+ release-test-pypi:
+ name: Publish tagged version to test.pypi.org
+ environment: release-test-pypi
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
+ runs-on: ubuntu-latest
+ needs: build-package
+
+ steps:
+ - name: Download packages built by build-and-inspect-python-package
+ uses: actions/download-artifact@v3
+ with:
+ name: Packages
+ path: dist
+
+ - name: Upload package to Test PyPI
+ uses: pypa/gh-action-pypi-publish@release/v1
+ with:
+ repository-url: https://test.pypi.org/legacy/
+
+ # Upload to real PyPI on GitHub Releases.
+ release-pypi:
+ name: Publish released package to pypi.org
+ environment: release-pypi
+ if: github.event.action == 'published'
+ runs-on: ubuntu-latest
+ needs: build-package
+
+ steps:
+ - name: Download packages built by build-and-inspect-python-package
+ uses: actions/download-artifact@v3
+ with:
+ name: Packages
+ path: dist
+
+ - name: Upload package to PyPI
+ uses: pypa/gh-action-pypi-publish@release/v1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/hatch_fancy_pypi_readme-22.8.0/.pre-commit-config.yaml
new/hatch_fancy_pypi_readme-23.1.0/.pre-commit-config.yaml
--- old/hatch_fancy_pypi_readme-22.8.0/.pre-commit-config.yaml 2020-02-02
01:00:00.000000000 +0100
+++ new/hatch_fancy_pypi_readme-23.1.0/.pre-commit-config.yaml 2023-05-22
08:59:35.000000000 +0200
@@ -2,45 +2,23 @@
ci:
autoupdate_schedule: monthly
-default_language_version:
- python: python3.10
-
repos:
- repo: https://github.com/psf/black
- rev: 22.8.0
+ rev: 23.3.0
hooks:
- id: black
- - repo: https://github.com/asottile/pyupgrade
- rev: v2.37.3
- hooks:
- - id: pyupgrade
- args: [--py37-plus]
-
- - repo: https://github.com/PyCQA/isort
- rev: 5.10.1
- hooks:
- - id: isort
- additional_dependencies: [toml]
-
- - repo: https://github.com/asottile/yesqa
- rev: v1.4.0
- hooks:
- - id: yesqa
- additional_dependencies: [flake8-bugbear]
-
- - repo: https://github.com/PyCQA/flake8
- rev: 5.0.4
+ - repo: https://github.com/charliermarsh/ruff-pre-commit
+ rev: v0.0.269
hooks:
- - id: flake8
- additional_dependencies: [flake8-bugbear]
+ - id: ruff
+ args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.3.0
+ rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: (.*\.svg)
- - id: debug-statements
- id: check-toml
- id: check-yaml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatch_fancy_pypi_readme-22.8.0/CHANGELOG.md
new/hatch_fancy_pypi_readme-23.1.0/CHANGELOG.md
--- old/hatch_fancy_pypi_readme-22.8.0/CHANGELOG.md 2020-02-02
01:00:00.000000000 +0100
+++ new/hatch_fancy_pypi_readme-23.1.0/CHANGELOG.md 2023-05-22
08:59:35.000000000 +0200
@@ -10,6 +10,13 @@
<!-- changelog follows -->
+##
[23.1.0](https://github.com/hynek/hatch-fancy-pypi-readme/compare/22.8.0...23.1.0)
- 2023-05-22
+
+### Added
+
+- CLI support for `hatch.toml`.
+ [#27](https://github.com/hynek/hatch-fancy-pypi-readme/issues/27)
+
##
[22.8.0](https://github.com/hynek/hatch-fancy-pypi-readme/compare/22.7.0...22.8.0)
- 2022-10-02
@@ -18,7 +25,7 @@
- Added `start-at` in addition to `start-after` that preserves the string that
is looked for. This often removes the need for adding markers because you can
define the starting point using a heading that becomes part of the fragment.
For example: `start-at = "## License"` gives you `## License` and
everything that follows.
- [#71](https://github.com/hynek/hatch-fancy-pypi-readme/issues/71)
+ [#16](https://github.com/hynek/hatch-fancy-pypi-readme/issues/16)
##
[22.7.0](https://github.com/hynek/hatch-fancy-pypi-readme/compare/22.6.0...22.7.0)
- 2022-09-12
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatch_fancy_pypi_readme-22.8.0/PKG-INFO
new/hatch_fancy_pypi_readme-23.1.0/PKG-INFO
--- old/hatch_fancy_pypi_readme-22.8.0/PKG-INFO 2020-02-02 01:00:00.000000000
+0100
+++ new/hatch_fancy_pypi_readme-23.1.0/PKG-INFO 2023-05-22 08:59:35.000000000
+0200
@@ -1,14 +1,13 @@
Metadata-Version: 2.1
Name: hatch-fancy-pypi-readme
-Version: 22.8.0
+Version: 23.1.0
Summary: Fancy PyPI READMEs with Hatch
Project-URL: Documentation,
https://github.com/hynek/hatch-fancy-pypi-readme#readme
Project-URL: Changelog,
https://github.com/hynek/hatch-fancy-pypi-readme/blob/main/CHANGELOG.md
Project-URL: Source Code, https://github.com/hynek/hatch-fancy-pypi-readme
Project-URL: Funding, https://github.com/sponsors/hynek
-Project-URL: Ko-fi, https://ko-fi.com/the_hynek
Author-email: Hynek Schlawack <[email protected]>
-License: MIT
+License-Expression: MIT
License-File: AUTHORS.md
License-File: LICENSE.txt
Keywords: documentation,hatch,pypi,readme
@@ -16,14 +15,11 @@
Classifier: Framework :: Hatch
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
-Classifier: Programming Language :: Python :: Implementation :: CPython
-Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Build Tools
Requires-Python: >=3.7
Requires-Dist: hatchling
@@ -38,15 +34,9 @@
Requires-Dist: wheel; extra == 'tests'
Description-Content-Type: text/markdown
-# Your â¨Fancy⨠Project Deserves a â¨Fancy⨠PyPI Readme! ð§
+# Your â¨Fancy⨠Project Deserves a â¨Fancy⨠PyPI Readme!
-[](https://pypi.org/project/hatch-fancy-pypi-readme)
-[](https://pypi.org/project/hatch-fancy-pypi-readme)
-[](https://github.com/pypa/hatch)
-[](https://github.com/hynek/hatch-fancy-pypi-readme/blob/main/LICENSE.txt)
-
-
-*hatch-fancy-pypi-readme* is an MIT-licensed metadata plugin for
[*Hatch*](https://hatch.pypa.io/).
+*hatch-fancy-pypi-readme* is an MIT-licensed metadata plugin for
[Hatch](https://hatch.pypa.io/) by [Hynek Schlawack](https://hynek.me/).
Its purpose is to help you to have fancy PyPI readmes â unlike *this* one
youâre looking at right now.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatch_fancy_pypi_readme-22.8.0/README.md
new/hatch_fancy_pypi_readme-23.1.0/README.md
--- old/hatch_fancy_pypi_readme-22.8.0/README.md 2020-02-02
01:00:00.000000000 +0100
+++ new/hatch_fancy_pypi_readme-23.1.0/README.md 2023-05-22
08:59:35.000000000 +0200
@@ -1,11 +1,11 @@
-# Your â¨Fancy⨠Project Deserves a â¨Fancy⨠PyPI Readme! ð§
+# Your â¨Fancy⨠Project Deserves a â¨Fancy⨠PyPI Readme!
[](https://pypi.org/project/hatch-fancy-pypi-readme)
[](https://pypi.org/project/hatch-fancy-pypi-readme)
[](https://github.com/pypa/hatch)
[](https://github.com/hynek/hatch-fancy-pypi-readme/blob/main/LICENSE.txt)
-*hatch-fancy-pypi-readme* is a [*Hatch*] metadata plugin for everyone who
cares about the first impression of their projectâs PyPI landing page.
+*hatch-fancy-pypi-readme* is a [Hatch] metadata plugin for everyone who cares
about the first impression of their projectâs PyPI landing page.
It allows you to define your PyPI project description in terms of concatenated
fragments that are based on **static strings**, **files**, and most importantly:
**parts of files** defined using **cut-off points** or **regular expressions**.
@@ -21,15 +21,23 @@
> We refer to it as âreadmeâ because thatâs how itâs called in [PEP
> 621](https://peps.python.org/pep-0621/)-based `pyproject.toml` files.
-### Showcases
+### Showcases ð§
<!-- Please add your project in alphabetic order, except leave
hatch-fancy-pypi-readme last. -->
+- [*Awkward Array*](https://pypi.org/project/awkward/)
([`pyproject.toml`](https://github.com/scikit-hep/awkward/blob/main/pyproject.toml))
+- [*Black*](https://pypi.org/project/black/)
([`pyproject.toml`](https://github.com/psf/black/blob/main/pyproject.toml))
+- [*doc2dash*](https://pypi.org/project/doc2dash/)
([`pyproject.toml`](https://github.com/hynek/doc2dash/blob/main/pyproject.toml))
+- [*environ-config*](https://pypi.org/project/environ-config/)
([`pyproject.toml`](https://github.com/hynek/environ-config/blob/main/pyproject.toml))
- [*jsonschema*](https://pypi.org/project/jsonschema/)
([`pyproject.toml`](https://github.com/python-jsonschema/jsonschema/blob/main/pyproject.toml))
- [*Gradio*](https://pypi.org/project/gradio/)
([`pyproject.toml`](https://github.com/gradio-app/gradio/blob/main/pyproject.toml))
+- [*httpx*](https://pypi.org/project/httpx/)
([`pyproject.toml`](https://github.com/encode/httpx/blob/master/pyproject.toml))
- [*pytermgui*](https://pypi.org/project/pytermgui/)
([`pyproject.toml`](https://github.com/bczsalba/pytermgui/blob/master/pyproject.toml))
+- [*scikit-build*](https://pypi.org/project/scikit-build/)
([`pyproject.toml`](https://github.com/scikit-build/scikit-build/blob/main/pyproject.toml))
- [*stamina*](https://pypi.org/project/stamina/)
([`pyproject.toml`](https://github.com/hynek/stamina/blob/main/pyproject.toml))
-- And finally
[*hatch-fancy-pypi-readme*](https://pypi.org/project/hatch-fancy-pypi-readme/22.5.0/)
22.5.0
([`pyproject.toml`](https://github.com/hynek/hatch-fancy-pypi-readme/blob/1a76f0d6cb78448e59466716ee3d5b5ea99915d1/pyproject.toml#L125-L168)),
before we went back to a static readme to avoid a circular dependency that can
be problematic in some cases.
- The shoemakerâs kids always go barefoot.
+- [*structlog*](https://pypi.org/project/structlog/)
([`pyproject.toml`](https://github.com/hynek/structlog/blob/main/pyproject.toml))
+
+*hatch-fancy-pypi-readme* doesnât use itself to avoid a circular dependency
that can be problematic in some cases.
+The shoemakerâs kids always go barefoot.
<!-- start docs -->
@@ -43,13 +51,17 @@
For example
[this](https://github.com/python-attrs/attrs/blob/b3dfebe2e10b44437c4f97d788fb5220d790efd0/setup.py#L110-L124)
is the code that gave me the PyPI readme for [*attrs*
22.1.0](https://pypi.org/project/attrs/22.1.0/).
Especially having a summary of the *latest* changes is something Iâve found
users to appreciate.
-[*Hatch*]âs extensibility finally allowed me to build this plugin that
allows you to switch away from `setup.py` without compromising on the user
experience.
+[Hatch]âs extensibility finally allowed me to build this plugin that allows
you to switch away from `setup.py` without compromising on the user experience.
Now *you* too can have fancy PyPI readmes â just by adding a few lines of
configuration to your `pyproject.toml`.
## Configuration
-*hatch-fancy-pypi-readme* is, like [*Hatch*], configured in your projectâs
`pyproject.toml`.
+*hatch-fancy-pypi-readme* is, like [Hatch], configured in your projectâs
`pyproject.toml`[^hatch-toml].
+
+[^hatch-toml]: As with Hatch, you can also use `hatch.toml` for configuration
options that start with `tool.hatch` and leave that prefix out.
+ That means `pyprojects.toml`âs
`[tool.hatch.metadata.hooks.fancy-pypi-readme]` becomes
`[metadata.hooks.fancy-pypi-readme]` when in `hatch.toml`.
+ To keep the documentation simple, the more common `pyproject.toml` syntax is
used throughout.
First you add *hatch-fancy-pypi-readme* to your `[build-system]`:
@@ -86,7 +98,7 @@
Finally, you also **must** supply an *array* of `fragments`.
A fragment is a piece of text that is appended to your readme in the order
that itâs specified.
-We recommend *TOML*âs [syntactic sugar for arrays of wrapping the array name
in double brackets](https://toml.io/en/v1.0.0#array-of-tables) and will use it
throughout this documentation.
+We recommend TOMLâs [syntactic sugar for arrays of wrapping the array name
in double brackets](https://toml.io/en/v1.0.0#array-of-tables) and will use it
throughout this documentation.
#### Text
@@ -136,7 +148,7 @@
to find it.
-Both *Markdown* and *reST* have comments (`<!-- this is a Markdown comment
-->` and `.. this is a reST comment`) that you can use for invisible markers:
+Both Markdown and *reST* have comments (`<!-- this is a Markdown comment -->`
and `.. this is a reST comment`) that you can use for invisible markers:
```markdown
# Boring Header
@@ -246,22 +258,27 @@

> **Warning**
-> While the execution model is somewhat different from the [*Hatch*]-Python
packaging pipeline, it uses the same configuration validator and text renderer,
so the fidelity should be high.
+> While the execution model is somewhat different from the [Hatch]-Python
packaging pipeline, it uses the same configuration validator and text renderer,
so the fidelity should be high.
>
> It will **not** help you debug **packaging issues**, though.
>
> To verify your PyPI readme using the full packaging pipeline, check out my
> [*build-and-inspect-python-package*](https://github.com/hynek/build-and-inspect-python-package)
> GitHub Action.
+>
+> If you ensure that *hatch-fancy-pypi-readme* is installed in your Hatch
environment (that means where the `hatch` CLI command lives â not your
development environment), you can also let Hatch render it for you:
+>
+> - `hatch project metadata readme` gives you a rendered version of the readme.
+> - `hatch project metadata | jq -r .readme.text` gives you the raw Markdown
(needs [*jq*](https://stedolan.github.io/jq/)).
-<!-- end docs -->
## Project Links
- **License**: [MIT](LICENSE.txt)
-- **Documentation**: https://github.com/hynek/hatch-fancy-pypi-readme#readme
-- **Changelog**: [CHANGELOG.md](CHANGELOG.md)
-- **PyPI**: https://pypi.org/project/hatch-fancy-pypi-readme/
-- **Source Code**: https://github.com/hynek/hatch-fancy-pypi-readme
-- **Supported Python Versions**: 3.7 and later (follows [*Hatch*])
+- **Supported Python Versions**: 3.7 and later (follows [Hatch])
+- [**Documentation**](https://github.com/hynek/hatch-fancy-pypi-readme#readme)
+- [**Changelog**](CHANGELOG.md)
+- [**PyPI**](https://pypi.org/project/hatch-fancy-pypi-readme/)
+- [**Source Code**](https://github.com/hynek/hatch-fancy-pypi-readme)
+
[example-config]: tests/example_pyproject.toml
-[*Hatch*]: https://hatch.pypa.io/
+[Hatch]: https://hatch.pypa.io/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatch_fancy_pypi_readme-22.8.0/pyproject.toml
new/hatch_fancy_pypi_readme-23.1.0/pyproject.toml
--- old/hatch_fancy_pypi_readme-22.8.0/pyproject.toml 2020-02-02
01:00:00.000000000 +0100
+++ new/hatch_fancy_pypi_readme-23.1.0/pyproject.toml 2023-05-22
08:59:35.000000000 +0200
@@ -5,12 +5,12 @@
[project]
name = "hatch-fancy-pypi-readme"
-version = "22.8.0"
+version = "23.1.0"
description = "Fancy PyPI READMEs with Hatch"
requires-python = ">=3.7"
keywords = ["hatch", "pypi", "readme", "documentation"]
authors = [{ name = "Hynek Schlawack", email = "[email protected]" }]
-license = { text = "MIT" }
+license = "MIT"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Hatch",
@@ -18,14 +18,11 @@
"Operating System :: OS Independent",
"Topic :: Software Development :: Build Tools",
- "Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
- "Programming Language :: Python :: Implementation :: CPython",
- "Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
"hatchling",
@@ -48,19 +45,12 @@
Changelog =
"https://github.com/hynek/hatch-fancy-pypi-readme/blob/main/CHANGELOG.md"
"Source Code" = "https://github.com/hynek/hatch-fancy-pypi-readme"
Funding = "https://github.com/sponsors/hynek"
-Ko-fi = "https://ko-fi.com/the_hynek"
[project.readme]
content-type = "text/markdown"
-text = """# Your â¨Fancy⨠Project Deserves a â¨Fancy⨠PyPI Readme! ð§
+text = """# Your â¨Fancy⨠Project Deserves a â¨Fancy⨠PyPI Readme!
-[](https://pypi.org/project/hatch-fancy-pypi-readme)
-[](https://pypi.org/project/hatch-fancy-pypi-readme)
-[](https://github.com/pypa/hatch)
-[](https://github.com/hynek/hatch-fancy-pypi-readme/blob/main/LICENSE.txt)
-
-
-*hatch-fancy-pypi-readme* is an MIT-licensed metadata plugin for
[*Hatch*](https://hatch.pypa.io/).
+*hatch-fancy-pypi-readme* is an MIT-licensed metadata plugin for
[Hatch](https://hatch.pypa.io/) by [Hynek Schlawack](https://hynek.me/).
Its purpose is to help you to have fancy PyPI readmes â unlike *this* one
youâre looking at right now.
@@ -82,7 +72,7 @@
source = ["hatch_fancy_pypi_readme"]
[tool.coverage.paths]
-source = ["src", ".tox/*/site-packages"]
+source = ["src", ".tox/py*/**/site-packages"]
[tool.coverage.report]
show_missing = true
@@ -117,10 +107,6 @@
line-length = 79
-[tool.isort]
-profile = "attrs"
-
-
[tool.mypy]
strict = true
follow_imports = "normal"
@@ -132,3 +118,43 @@
[[tool.mypy.overrides]]
module = "tests.*"
ignore_errors = true
+
+
+[tool.ruff]
+src = ["src", "tests"]
+select = [
+ "E", # pycodestyle
+ "W", # pycodestyle
+ "F", # Pyflakes
+ "UP", # pyupgrade
+ "N", # pep8-naming
+ "YTT", # flake8-2020
+ "S", # flake8-bandit
+ "B", # flake8-bugbear
+ "C4", # flake8-comprehensions
+ "T10", # flake8-debugger
+ "ISC", # flake8-implicit-str-concat
+ "RET", # flake8-return
+ "SIM", # flake8-simplify
+ "DTZ", # flake8-datetimez
+ "I", # isort
+ "PGH", # pygrep-hooks
+ "PLC", # Pylint
+ "PIE", # flake8-pie
+ "RUF", # ruff
+]
+
+ignore = [
+ "E501", # leave line-length enforcement to Black
+]
+
+[tool.ruff.per-file-ignores]
+"tests/*" = [
+ "S101", # assert
+ "SIM300", # Yoda rocks in tests
+ "PLC1901", # empty strings are falsey, but are less specific in tests
+]
+
+[tool.ruff.isort]
+lines-between-types = 1
+lines-after-imports = 2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/hatch_fancy_pypi_readme-22.8.0/src/hatch_fancy_pypi_readme/__main__.py
new/hatch_fancy_pypi_readme-23.1.0/src/hatch_fancy_pypi_readme/__main__.py
--- old/hatch_fancy_pypi_readme-22.8.0/src/hatch_fancy_pypi_readme/__main__.py
2020-02-02 01:00:00.000000000 +0100
+++ new/hatch_fancy_pypi_readme-23.1.0/src/hatch_fancy_pypi_readme/__main__.py
2023-05-22 08:59:35.000000000 +0200
@@ -8,6 +8,7 @@
import sys
from contextlib import closing
+from pathlib import Path
from typing import TextIO
from ._cli import cli_run
@@ -21,7 +22,8 @@
def main() -> None:
parser = argparse.ArgumentParser(
- description="Render a README from a pyproject.toml"
+ description="Render a README from a pyproject.toml & hatch.toml."
+ " If a hatch.toml is passed / detected, it's preferred."
)
parser.add_argument(
"pyproject_path",
@@ -32,23 +34,41 @@
"Default: pyproject.toml in current directory.",
)
parser.add_argument(
+ "--hatch-toml",
+ nargs="?",
+ metavar="PATH-TO-HATCH.TOML",
+ default=None,
+ help="Path to an additional hatch.toml to use for rendering. "
+ "Default: Auto-detect in the current directory.",
+ )
+ parser.add_argument(
"-o",
help="Target file for output. Default: standard out.",
metavar="TARGET-FILE-PATH",
)
args = parser.parse_args()
- with open(args.pyproject_path, "rb") as fp:
- cfg = tomllib.load(fp)
+ pyproject = tomllib.loads(Path(args.pyproject_path).read_text())
+ hatch_toml = _maybe_load_hatch_toml(args.hatch_toml)
out: TextIO
- if args.o:
- out = open(args.o, "w")
- else:
- out = sys.stdout
+ out = open(args.o, "w") if args.o else sys.stdout # noqa: SIM115
with closing(out):
- cli_run(cfg, out)
+ cli_run(pyproject, hatch_toml, out)
+
+
+def _maybe_load_hatch_toml(hatch_toml_arg: str | None) -> dict[str, object]:
+ """
+ If hatch.toml is passed or detected, load it.
+ """
+ if hatch_toml_arg:
+ return tomllib.loads(Path(hatch_toml_arg).read_text())
+
+ if Path("hatch.toml").exists():
+ return tomllib.loads(Path("hatch.toml").read_text())
+
+ return {}
if __name__ == "__main__":
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/hatch_fancy_pypi_readme-22.8.0/src/hatch_fancy_pypi_readme/_cli.py
new/hatch_fancy_pypi_readme-23.1.0/src/hatch_fancy_pypi_readme/_cli.py
--- old/hatch_fancy_pypi_readme-22.8.0/src/hatch_fancy_pypi_readme/_cli.py
2020-02-02 01:00:00.000000000 +0100
+++ new/hatch_fancy_pypi_readme-23.1.0/src/hatch_fancy_pypi_readme/_cli.py
2023-05-22 08:59:35.000000000 +0200
@@ -6,6 +6,7 @@
import sys
+from contextlib import suppress
from typing import Any, NoReturn, TextIO
from hatch_fancy_pypi_readme.exceptions import ConfigurationError
@@ -14,28 +15,47 @@
from ._config import load_and_validate_config
-def cli_run(pyproject: dict[str, Any], out: TextIO) -> None:
+def cli_run(
+ pyproject: dict[str, Any], hatch_toml: dict[str, Any], out: TextIO
+) -> None:
"""
Best-effort verify config and print resulting PyPI readme.
"""
is_dynamic = False
- try:
+ with suppress(KeyError):
is_dynamic = "readme" in pyproject["project"]["dynamic"]
- except KeyError:
- pass
if not is_dynamic:
_fail("You must add 'readme' to 'project.dynamic'.")
try:
- cfg = pyproject["tool"]["hatch"]["metadata"]["hooks"][
- "fancy-pypi-readme"
- ]
+ if (
+ pyproject["tool"]["hatch"]["metadata"]["hooks"][
+ "fancy-pypi-readme"
+ ]
+ and hatch_toml["metadata"]["hooks"]["fancy-pypi-readme"]
+ ):
+ _fail(
+ "Both pyproject.toml and hatch.toml contain "
+ "hatch-fancy-pypi-readme configuration."
+ )
+ except KeyError:
+ pass
+
+ try:
+ cfg = hatch_toml["metadata"]["hooks"]["fancy-pypi-readme"]
except KeyError:
- _fail(
- "Missing configuration "
- "(`[tool.hatch.metadata.hooks.fancy-pypi-readme]`)",
- )
+ try:
+ cfg = pyproject["tool"]["hatch"]["metadata"]["hooks"][
+ "fancy-pypi-readme"
+ ]
+ except KeyError:
+ _fail(
+ "Missing configuration "
+ "(`[tool.hatch.metadata.hooks.fancy-pypi-readme]` in"
+ " pyproject.toml or `[metadata.hooks.fancy-pypi-readme]`"
+ " in hatch.toml)",
+ )
try:
config = load_and_validate_config(cfg)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/hatch_fancy_pypi_readme-22.8.0/src/hatch_fancy_pypi_readme/_fragments.py
new/hatch_fancy_pypi_readme-23.1.0/src/hatch_fancy_pypi_readme/_fragments.py
---
old/hatch_fancy_pypi_readme-22.8.0/src/hatch_fancy_pypi_readme/_fragments.py
2020-02-02 01:00:00.000000000 +0100
+++
new/hatch_fancy_pypi_readme-23.1.0/src/hatch_fancy_pypi_readme/_fragments.py
2023-05-22 08:59:35.000000000 +0200
@@ -24,7 +24,7 @@
key: ClassVar[str]
@classmethod
- def from_config(self, cfg: dict[str, str]) -> Fragment:
+ def from_config(cls, cfg: dict[str, str]) -> Fragment:
...
def render(self) -> str:
@@ -76,7 +76,9 @@
try:
contents = path.read_text(encoding="utf-8")
except FileNotFoundError:
- raise ConfigurationError([f"Fragment file '{path}' not found."])
+ raise ConfigurationError(
+ [f"Fragment file '{path}' not found."]
+ ) from None
if start_after and start_at:
raise ConfigurationError(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatch_fancy_pypi_readme-22.8.0/tests/test_cli.py
new/hatch_fancy_pypi_readme-23.1.0/tests/test_cli.py
--- old/hatch_fancy_pypi_readme-22.8.0/tests/test_cli.py 2020-02-02
01:00:00.000000000 +0100
+++ new/hatch_fancy_pypi_readme-23.1.0/tests/test_cli.py 2023-05-22
08:59:35.000000000 +0200
@@ -9,7 +9,7 @@
import pytest
-from hatch_fancy_pypi_readme.__main__ import tomllib
+from hatch_fancy_pypi_readme.__main__ import _maybe_load_hatch_toml, tomllib
from hatch_fancy_pypi_readme._cli import cli_run
from .utils import run
@@ -42,7 +42,9 @@
assert (
"Missing configuration "
- "(`[tool.hatch.metadata.hooks.fancy-pypi-readme]`)\n" == out
+ "(`[tool.hatch.metadata.hooks.fancy-pypi-readme]` in"
+ " pyproject.toml or `[metadata.hooks.fancy-pypi-readme]` in"
+ " hatch.toml)\n" == out
)
def test_ok(self):
@@ -79,6 +81,51 @@
assert out.read_text().startswith("# Level 1 Header")
+ def test_empty_explicit_hatch_toml(self, tmp_path):
+ """
+ Explicit empty hatch.toml is ignored.
+ """
+ hatch_toml = tmp_path / "hatch.toml"
+ hatch_toml.write_text("")
+
+ assert run(
+ "hatch_fancy_pypi_readme",
+ "tests/example_pyproject.toml",
+ f"--hatch-toml={hatch_toml.resolve()}",
+ ).startswith("# Level 1 Header")
+
+ def test_config_in_hatch_toml(self, tmp_path, monkeypatch):
+ """
+ Implicit empty hatch.toml is used.
+ """
+ pyproject = tmp_path / "pyproject.toml"
+ pyproject.write_text(
+ """\
+[build-system]
+requires = ["hatchling", "hatch-fancy-pypi-readme"]
+build-backend = "hatchling.build"
+
+[project]
+name = "my-pkg"
+version = "1.0"
+dynamic = ["readme"]
+"""
+ )
+ hatch_toml = tmp_path / "hatch.toml"
+ hatch_toml.write_text(
+ """\
+[metadata.hooks.fancy-pypi-readme]
+content-type = "text/markdown"
+
+[[metadata.hooks.fancy-pypi-readme.fragments]]
+text = '# Level 1 Header'
+"""
+ )
+
+ monkeypatch.chdir(tmp_path)
+
+ assert run("hatch_fancy_pypi_readme").startswith("# Level 1 Header")
+
class TestCLI:
def test_cli_run_missing_dynamic(self, capfd):
@@ -86,7 +133,7 @@
Missing readme in dynamic is caught and gives helpful advice.
"""
with pytest.raises(SystemExit):
- cli_run({}, sys.stdout)
+ cli_run({}, {}, sys.stdout)
out, err = capfd.readouterr()
@@ -99,14 +146,49 @@
"""
with pytest.raises(SystemExit):
cli_run(
- {"project": {"dynamic": ["foo", "readme", "bar"]}}, sys.stdout
+ {"project": {"dynamic": ["foo", "readme", "bar"]}},
+ {},
+ sys.stdout,
)
out, err = capfd.readouterr()
assert (
"Missing configuration "
- "(`[tool.hatch.metadata.hooks.fancy-pypi-readme]`)\n" == err
+ "(`[tool.hatch.metadata.hooks.fancy-pypi-readme]` in"
+ " pyproject.toml or `[metadata.hooks.fancy-pypi-readme]` in"
+ " hatch.toml)\n" == err
+ )
+ assert "" == out
+
+ def test_cli_run_two_configs(self, capfd):
+ """
+ Ambiguous two configs.
+ """
+ meta = {
+ "metadata": {
+ "hooks": {
+ "fancy-pypi-readme": {"content-type": "text/markdown"}
+ }
+ }
+ }
+ with pytest.raises(SystemExit):
+ cli_run(
+ {
+ "project": {
+ "dynamic": ["foo", "readme", "bar"],
+ },
+ "tool": {"hatch": meta},
+ },
+ meta,
+ sys.stdout,
+ )
+
+ out, err = capfd.readouterr()
+
+ assert (
+ "Both pyproject.toml and hatch.toml contain "
+ "hatch-fancy-pypi-readme configuration.\n" == err
)
assert "" == out
@@ -115,7 +197,7 @@
Configuration errors are detected and give helpful advice.
"""
with pytest.raises(SystemExit):
- cli_run(empty_pyproject, sys.stdout)
+ cli_run(empty_pyproject, {}, sys.stdout)
out, err = capfd.readouterr()
@@ -134,10 +216,49 @@
"""
sio = StringIO()
- cli_run(pyproject, sio)
+ cli_run(pyproject, {}, sio)
out, err = capfd.readouterr()
assert "" == err
assert "" == out
assert sio.getvalue().startswith("# Level 1 Header")
+
+
+class TestMaybeLoadHatchToml:
+ def test_none(self, tmp_path, monkeypatch):
+ """
+ If nothing is passed and not hatch.toml is found, return empty dict.
+ """
+ monkeypatch.chdir(tmp_path)
+
+ assert {} == _maybe_load_hatch_toml(None)
+
+ def test_explicit(self, tmp_path, monkeypatch):
+ """
+ If one is passed, return its parsed content and ignore files called
+ hatch.toml.
+ """
+ monkeypatch.chdir(tmp_path)
+
+ hatch_toml = tmp_path / "hatch.toml"
+ hatch_toml.write_text("gibberish")
+
+ not_hatch_toml = tmp_path / "not-hatch.toml"
+ not_hatch_toml.write_text("[foo]\nbar='qux'")
+
+ assert {"foo": {"bar": "qux"}} == _maybe_load_hatch_toml(
+ str(not_hatch_toml)
+ )
+
+ def test_implicit(self, tmp_path, monkeypatch):
+ """
+ If none is passed, but a hatch.toml is present in current dir, parse
+ it.
+ """
+ monkeypatch.chdir(tmp_path)
+
+ hatch_toml = tmp_path / "hatch.toml"
+ hatch_toml.write_text("[foo]\nbar='qux'")
+
+ assert {"foo": {"bar": "qux"}} == _maybe_load_hatch_toml(None)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/hatch_fancy_pypi_readme-22.8.0/tests/test_substitutions.py
new/hatch_fancy_pypi_readme-23.1.0/tests/test_substitutions.py
--- old/hatch_fancy_pypi_readme-22.8.0/tests/test_substitutions.py
2020-02-02 01:00:00.000000000 +0100
+++ new/hatch_fancy_pypi_readme-23.1.0/tests/test_substitutions.py
2023-05-22 08:59:35.000000000 +0200
@@ -35,15 +35,15 @@
https://github.com/twisted/twisted/blob/eda9d29dc7fe34e7b207781e5674dc92f798bffe/setup.py#L19-L24
"""
assert (
- "For information on changes in this release, see the `NEWS
<https://github.com/twisted/twisted/blob/trunk/NEWS.rst>`_ file." # noqa
+ "For information on changes in this release, see the `NEWS
<https://github.com/twisted/twisted/blob/trunk/NEWS.rst>`_ file."
) == Substituter.from_config(
{
"pattern": r"`([^`]+)\s+<(?!https?://)([^>]+)>`_",
- "replacement": r"`\1
<https://github.com/twisted/twisted/blob/trunk/\2>`_", # noqa
+ "replacement": r"`\1
<https://github.com/twisted/twisted/blob/trunk/\2>`_",
"ignore-case": True,
}
).substitute(
- "For information on changes in this release, see the `NEWS
<NEWS.rst>`_ file." # noqa
+ "For information on changes in this release, see the `NEWS
<NEWS.rst>`_ file."
)
@pytest.mark.parametrize(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatch_fancy_pypi_readme-22.8.0/tests/utils.py
new/hatch_fancy_pypi_readme-23.1.0/tests/utils.py
--- old/hatch_fancy_pypi_readme-22.8.0/tests/utils.py 2020-02-02
01:00:00.000000000 +0100
+++ new/hatch_fancy_pypi_readme-23.1.0/tests/utils.py 2023-05-22
08:59:35.000000000 +0200
@@ -10,7 +10,7 @@
def run(*args, check=True):
process = subprocess.run(
- [sys.executable, "-m", *args],
+ [sys.executable, "-m", *args], # noqa: S603
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
encoding="utf-8",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hatch_fancy_pypi_readme-22.8.0/tox.ini
new/hatch_fancy_pypi_readme-23.1.0/tox.ini
--- old/hatch_fancy_pypi_readme-22.8.0/tox.ini 2020-02-02 01:00:00.000000000
+0100
+++ new/hatch_fancy_pypi_readme-23.1.0/tox.ini 2023-05-22 08:59:35.000000000
+0200
@@ -1,14 +1,15 @@
-[gh-actions]
-python =
- 3.7: py37
- 3.8: py38
- 3.9: py39
- 3.10: py310, mypy
- 3.11: py311
-
-
[tox]
-envlist =
pre-commit,mypy,py37,py38,py39,py310,py311,py3{7,10,11}-cli,coverage-report
+min_version = 4
+env_list =
+ pre-commit,
+ mypy,
+ py37,
+ py38,
+ py39,
+ py310,
+ py311,
+ py3{7,10,11}-cli,
+ coverage-report
isolated_build = true
@@ -21,7 +22,6 @@
[testenv:pre-commit]
-basepython = python3.10
skip_install = true
deps = pre-commit
commands = pre-commit run --all-files
@@ -35,21 +35,21 @@
[testenv]
extras = tests
-commands = python -m pytest {posargs}
+commands = pytest {posargs}
-[testenv:py3{10,11}]
+[testenv:py31{0,1}]
deps = coverage[toml]
-commands = python -m coverage run -m pytest {posargs}
+commands = coverage run -m pytest {posargs}
[testenv:coverage-report]
-basepython = python3.10
+base_python = python3.11
deps = coverage[toml]
skip_install = true
commands =
- python -m coverage combine
- python -m coverage report
+ coverage combine
+ coverage report
[testenv:svg]