Skip to content
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
07b7f0b
Move Contributors and ContributorsRepository classes to contributors.…
RaumZeit Sep 26, 2026
a25e1a9
Update pyproject.toml to use flit >= 4
RaumZeit Sep 26, 2026
f5d0c1d
Create Repository class to allow for different provides
RaumZeit Sep 26, 2026
d0af6d4
Move Repository class into repository.py module
RaumZeit Sep 26, 2026
b31d7c6
Add email attribute to Contributor objects
RaumZeit Sep 26, 2026
df570f4
Separate github API requests from Repository class
RaumZeit Sep 26, 2026
1c71330
Add support for local repositories
RaumZeit Sep 26, 2026
ccbbecb
Add default avatar image
RaumZeit Sep 27, 2026
777f029
Acknowledge exclude list for local repos and some fixes and enhancements
RaumZeit Sep 28, 2026
a1a5766
DOCS: Update docs to include the new local repo and default avatar fe…
RaumZeit Sep 28, 2026
aa9a980
Allow for anonymous contributors within github repositories
RaumZeit Sep 28, 2026
b761cca
DOCS: Fix local repo with avatars and contributions example
RaumZeit Sep 28, 2026
f00938a
DOC: Fix description for local repo data retrieval in examples
RaumZeit Sep 29, 2026
d41c73d
Hardening and some logical changes
RaumZeit Sep 29, 2026
0cfd814
Avoid github user data lookup for anonymous contributors
RaumZeit Sep 30, 2026
ee239ce
TESTS: Fix tests with exclude list
RaumZeit Sep 30, 2026
3b56716
Add timeout to subprocess.run for git shortlog call
RaumZeit Sep 30, 2026
e12829f
Fix regression where :limit: option was neglected
RaumZeit Sep 30, 2026
f34fdd6
Fix anonymous user lookup for github
RaumZeit Sep 30, 2026
171b358
DOC: Adjust and clarify references section for local repositories
RaumZeit Sep 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Examples
========

The ``contributors`` directive renders the contributors of a given GitHub repository in a Sphinx documentation page. This page shows the different options available.
The ``contributors`` directive renders the contributors of a given GitHub or local git repository in a Sphinx documentation page. This page shows the different options available.

Basic usage
-----------
Expand All @@ -14,6 +14,19 @@ List the contributors from a repository:

.. contributors:: dgarcia360/sphinx-contributors

Local repository
----------------

List the contributors from a local repository:

.. code-block:: rst

.. contributors:: ../../
:provider: local

.. contributors:: ../../
:provider: local

With avatars
------------

Expand Down Expand Up @@ -92,6 +105,19 @@ Manually add contributors not detected by the API (e.g., ``Co-authored-by`` cont
.. contributors:: dgarcia360/sphinx-contributors
:include: Peque

Including anonymous contributors
--------------------------------

Also add contributors that are not linked to a github account:

.. code-block:: rst

.. contributors:: dgarcia360/sphinx-contributors
:anonymous:

.. contributors:: dgarcia360/sphinx-contributors
:anonymous:

Multiple repositories
---------------------

Expand Down Expand Up @@ -127,7 +153,7 @@ Control how many contributors are shown and in what order:
Combining options
-----------------

Avatars, real names, and contribution counts together:
Avatars, real names, and exclude list together:

.. code-block:: rst

Expand All @@ -141,4 +167,25 @@ Avatars, real names, and contribution counts together:
:names:
:exclude: dependabot[bot]

Local Repo with default avatars
-------------------------------

Local repository with default avatars, real names, and contribution counts together:

.. code-block:: rst

.. contributors:: ../../
:provider: local
:contributions:
:avatars:
:names:
:exclude: dependabot[bot]

.. contributors:: ../../
:provider: local
:contributions:
:avatars:
:names:
:exclude: dependabot[bot]

For more information on how to style the list, see :doc:`Customization <customization>`.
8 changes: 4 additions & 4 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Overview
========

``sphinx-contributors`` is a Sphinx extension that automatically lists the people who have contributed to your GitHub repositories, right inside your documentation.
``sphinx-contributors`` is a Sphinx extension that automatically lists the people who have contributed to your Git repositories, right inside your documentation.

Features
---------

- List contributors from one or multiple GitHub repositories in a single directive.
- Display real names, avatars, and contribution counts.
- List contributors from one or multiple **GitHub** or **local** ``git`` repositories in a single directive.
- Display real names, avatars, and contribution counts, if such data is available.
- Manually include contributors not detected by the API (e.g., ``Co-authored-by`` contributors).
- Exclude bots and specific users.
- Sort by most or least active, and limit the number shown.

Requirements
---------------------

- GitHub public repositories.
- GitHub public or local git repositories.
- Python 3.10+ and Sphinx 7.0+.

Get started
Expand Down
20 changes: 19 additions & 1 deletion docs/source/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,26 @@ Contributors directive

.. rst:directive:: .. contributors:: username/repository [username/repository ...]

One or more GitHub repositories, separated by spaces. When multiple repositories are specified, contributors are merged into a single list and contribution counts are summed for users who appear in more than one repository.
One or more GitHub or local repositories, separated by spaces. When multiple repositories are specified, contributors are merged into a single list and contribution counts are summed for users who appear in more than one repository.

.. code-block:: rst

.. contributors:: dgarcia360/sphinx-contributors dgarcia360/other-repo
:contributions:

or

.. code-block:: rst

.. contributors:: ../
:provider: local
:contributions:

.. rst:directive:option:: provider
:type: string

By default, repositories specified as first argument of the directive are considered public github repositories. Set this option to ``local`` if they point to a local git repository instead. Defaults to ``github`` if not provided.

.. rst:directive:option:: limit
:type: integer

Expand Down Expand Up @@ -53,6 +66,11 @@ Contributors directive

Comma separated usernames to exclude from the list of contributors, for example: ``dependabot[bot],pre-commit-ci[bot]``.

.. rst:directive:option:: anonymous
:type: boolean

Also show ``anonymous`` contributors, i.e. those that appear in the git commit history but are not registered with github

.. note::

The GitHub REST API used by this extension does not include contributors added via ``Co-authored-by`` commit trailers. Use the ``:include:`` option to manually add those contributors.
39 changes: 29 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
[build-system]
requires = ["flit_core >=2,<4"]
requires = ["flit_core >=4"]
build-backend = "flit_core.buildapi"

[tool.flit.metadata]
module = "sphinx_contributors"
author = "David Garcia"
author-email = "hi@davidgarcia.dev"
home-page = "https://github.com/dgarcia360/sphinx-contributors"
description-file = "README.rst"

[project]
name = "sphinx_contributors"
description = "A Sphinx extension that automatically lists the people who have contributed to your GitHub repositories"
authors = [
{ name = "David Garcia", email = "hi@davidgarcia.dev" }
]
readme = "README.rst"
license = "MIT"
requires-python = ">=3.10"
requires = [
dynamic = ["version"]

dependencies = [
"sphinx >= 7",
"requests",
]

classifiers=[
"Framework :: Sphinx :: Extension",
"Programming Language :: Python :: 3",
Expand All @@ -23,12 +29,25 @@ classifiers=[
"Programming Language :: Python :: 3.14",
]

[tool.flit.metadata.requires-extra]

[project.urls]
Homepage = "https://github.com/dgarcia360/sphinx-contributors"
Issues = "https://github.com/dgarcia360/sphinx-contributors/issues"


[project.optional-dependencies]
test = [
"pre-commit",
"pytest",
]
doc = ["furo"]
doc = [
"sphinx",
"furo"
]

[tool.pytest.ini_options]
pythonpath = ["src"]

[tool.flit.sdist]
include = ["docs/"]
exclude = ["docs/build/"]
Loading