Skip to main content

The sphinxfeed package

Build status PyPI - package version PyPI - supported python versions

This Sphinx extension is a fork of Fergus Doyle’s sphinxfeed package which itself is derived from Dan Mackinlay’s sphinxcontrib.feed package. It relies on Lars Kiesow’s python-feedgen package instead of the defunct feedformatter package or of Django utils to generate the feed.

Features added

  • Support Python 3 (by using feedgen instead of feedformatter).

  • Don’t publish items having a publication datetime in the future.

  • Ability to write ATOM instead of RSS.

  • Detect category and tags fields in the page metadata and if either or both is present, call the feedgen.FeedEntry.category() method to add <category> elements to the feed item. The difference between category and tags is that the category of a blog post may contain whitespace while the tags metadata field is a space-separated list of tags, so each tag must be a single word. Both the category and each tag will become a <category> element in the feed item.

  • Additional Sphinx config variables:

    • feed_field_name to change the name of the metadata field to use for specifying the publication date.

    • use_dirhtml to specify whether dirhtml instead of html builder is used when calculating the url

    • feed_entry_permalink to set a permalink GUID for each feed entry. GUIDs are generated based on the entry URL. Or if a guid value is found in page metadata, that will be used instead. For example, so it can be manually set if the URL changes. Defaults to False, in which case the entry URL will be used as a non-permalink ID. Applies to both Atom and RSS feeds.

    • feed_use_atom to generate an Atom feed instead of RSS

Installation

You can install it using pip:

pip install sphinxfeed-lsaffre

How to test whether the right version of sphinxfeed is installed:

>>> import sphinxfeed
>>> sphinxfeed.__version__
'0.3.1'

Usage

  1. Add sphinxfeed to the list of extensions in your conf.py:

    extensions = [..., 'sphinxfeed']
  2. Customise the necessary configuration options to correctly generate the feed:

    feed_base_url = 'https://YOUR_HOST_URL'
    feed_author = 'YOUR NAME'
    feed_description = "A longer description"
    
    # optional options
    feed_field_name = 'date'  # default value is "Publish Date"
    feed_use_atom = False
    use_dirhtml = False
  3. Optionally use the following metadata fields:

    • date (or any other name configured using feed_field_name)

    • author

    • guid

    • tags

    • category

  4. Sphinxfeed will include only .rst files that have a :date: field with a date that does not lie in the future.

Maintenance

See also the files LICENSE and CHANGELOG.rst.

Install a developer version:

git clone https://github.com/lsaffre/sphinxfeed.git
pip install -e ".[dev]"

Run the test suite:

$ pytest

Generate an HTML test coverage report:

$ pytest --cov-report=html
$ python -m webbrowser test-reports/index.html

Release a new version to PyPI:

$ hatch version micro
$ git commit -am "release to pypi"
$ git tag v$(hatch version)
$ git push --tags

See Hatch Versioning. and Publishing to PyPI with a Trusted Publisher.

Manually release to PyPI using your machine and token:

$ hatch build
$ twine check --strict dist/*
$ twine upload dist/*

The twine upload step requires authentication credentials in your ~/.pypirc file.

Metadata

Release files for sphinxfeed-lsaffre 0.3.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinxfeed-lsaffre 0.3.7
File Size Uploaded
sphinxfeed_lsaffre-0.3.7.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sphinxfeed-lsaffre 0.3.7
File Interpreter ABI Platform
sphinxfeed_lsaffre-0.3.7-py3-none-any.whl Python 3 none any Details

Total release size: 12.7 kB

Release files / sphinxfeed_lsaffre-0.3.7.tar.gz

Download URL sphinxfeed_lsaffre-0.3.7.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
22872d7f1705690fed55ed1fa3b29411c9ba124510d55b18cea912ba4d843b28
BLAKE2b-256 checksum
How to use checksums
92e83ad66dc6b2018b6a5e60fff671928cb593193efdc6e6d8fcf9800ce789eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / sphinxfeed_lsaffre-0.3.7-py3-none-any.whl

Download URL sphinxfeed_lsaffre-0.3.7-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e424be806b8aad5054d31355c7d4b54fe487298af9317b35710de32a006e725a
BLAKE2b-256 checksum
How to use checksums
0bb362d024ebb36ca6bcb581c155e052691ec19c93c00edb2e0ee91a2f84a78b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.3.7 This release

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page