Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 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
dc7378e
Manually register default image for proper sphinx building
RaumZeit Oct 2, 2026
7d6568b
Add all-contributors support and avatar image size config
RaumZeit Oct 2, 2026
07850e6
Add contribution types table
RaumZeit Oct 3, 2026
eca2f13
Refactor contributions output
RaumZeit Oct 15, 2026
c07f56d
Enable emojis for contribution types
RaumZeit Oct 15, 2026
486896e
Remove bullet for contribution types in HTML output
RaumZeit Oct 15, 2026
e12cc6f
Add :emojis-only: directive option to suppress contribution type text…
RaumZeit Oct 15, 2026
8308c27
DOC: Update documentation according to recent feature additions
RaumZeit Oct 16, 2026
8064695
Fix issues pointed out by code-rabbit
RaumZeit Oct 21, 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
13 changes: 8 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
sphinx-contributors
===================

``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 project or Git repositories, right inside your documentation.

.. image:: https://raw.githubusercontent.com/dgarcia360/sphinx-contributors/master/docs/source/_static/example_avatars.png

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.
- Include additional contributors from an `All Contributors <https://allcontributors.org>`_-style JSON file
- Manually include contributors not detected by the API (e.g., ``Co-authored-by`` contributors).
- Display real names, avatars, and contribution types, commit counts, etc. if such data is available.
- Exclude bots and specific users.
- Sort by most or least active, and limit the number shown.
- Merge contributors based on login or email aliases
- Sort by name, login, email address, contributions or commits and limit the number shown.

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

- GitHub public repositories.
- GitHub public or local git repositories or local ``.all-contributorsrc`` JSON file.
- Python 3.10+ and Sphinx 7.0+.


Installation
------------

Expand Down
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>`.
12 changes: 7 additions & 5 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
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 project or 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.
- Include additional contributors from an `All Contributors <https://allcontributors.org>`_-style JSON file
- Manually include contributors not detected by the API (e.g., ``Co-authored-by`` contributors).
- Display real names, avatars, and contribution types, commit counts, etc. if such data is available.
- Exclude bots and specific users.
- Sort by most or least active, and limit the number shown.
- Merge contributors based on login or email aliases
- Sort by name, login, email address, contributions or commits and limit the number shown.

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

- GitHub public repositories.
- GitHub public or local git repositories or local ``.all-contributorsrc`` JSON file.
- Python 3.10+ and Sphinx 7.0+.

Get started
Expand Down
55 changes: 55 additions & 0 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,61 @@ Follow these steps to add sphinx-contributors to your Sphinx project:

See :doc:`Examples <examples>` for all available options.


Configuration
-------------

Use the ``sphinx_contributors_conf`` dictionary in your ``conf.py`` file to
overwrite any of the default values. The default configuration for this extension is

.. code-block:: python

sphinx_contributors_conf = {
"avatar_image_default" : "sc_user_avartar_default.svg",
"avatar_size_default" : 150,
"all_contributors" : False,
"all_contributors_file" : ".all-contributorsrc",
"all_contributors_imageSize_ignore" : False,
"all_contributors_precedence" : [ "name", "avatar_url", "email", "profile" ],
}

General settings
^^^^^^^^^^^^^^^^

The key/value pairs ``avatar_image_default`` and ``avatar_size_default`` can be used to change the default
avatar image if none can be obtained for a contributor, and the default avatar image size in pixels, respectively.

All Contributors settings
^^^^^^^^^^^^^^^^^^^^^^^^^

In addition to contributors taken directly from the git repository, or passed via
the ``:include:`` directive option, auxiliary contributors may also be specified in
an `All Contributors <https://allcontributors.org>`_-style JSON file. This has the
advantage to **include contributors that do not show up anywhere in github or your
local git repository**. It also allows for a more fine-grained level of detail for
the actual contribution type. See https://allcontributors.org for more details of
contribution types.

Moreover, the JSON file allows for specifying a list of ``aliases`` for each contributor
that in turn helps to **merge contributors** that are the same person or entity but
show up under different ``login`` or ``email address``.

The ``all_contributors`` flag decides, whether or not contributor data from an
`All Contributors <https://allcontributors.org>`_-style JSON file should be included
in the output. The actual path to this JSON file can be specified with the
``all_contributors_file`` and it should be relative to your ``conf.py`` location. If
the ``imageSize`` attribute is present in the all-contributors JSON file, it will by
default overwrite the ``avatar_size_default`` value. Set the
``all_contributors_imageSize_ignore = True`` to always use the ``avatar_size_default``
instead. Last but not least, the ``all_contributors_precedence`` list specifies which
entries from the all-contributors JSON file must not be overwritten by any data
queried from git repositories.

.. note::

If ``all_contributors = True``, the contributors taken from the all-contributors JSON file are collected first! Any git repositories are queried afterwards and the
contributors (and their contributions) taken from those repositories are merged.

GitHub API rate limits
----------------------

Expand Down
57 changes: 51 additions & 6 deletions docs/source/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,28 @@ 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:

The latter assumes that your local git repository root resides two levels up from the document this directive has been placed.

.. 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 All @@ -21,22 +36,42 @@ Contributors directive
.. rst:directive:option:: order
:type: string

Results are sorted by the number of contributions. This parameter controls whether they are sorted by most active users first (``DESC``) or least active users first (``ASC``). Default is ``DESC``.
Results are unordered by default. Use this option to specify how the contributors should be ordered. The string argument is a whitespace delimited list of up to two keywords, one describing the
attribute to use while ordering, the second to specify ascending or descending order. Use the following keywords to select an order attribute:

- ``byContribution`` to order by the total number of contributions
- ``byCommit`` to order by the total number of git commits
- ``byName`` to order by the cotributors full name
- ``byLogin`` to order by the contributors login name
- ``byEmail`` to order by the contributors email address

The keywords ``ASC`` or ``asc`` and ``DESC`` or ``desc`` can be used to change between ascending and descending order. Default is ``DESC``.

.. rst:directive:option:: avatars
:type: boolean

Whether to include an image with the avatar returned by GitHub. Use CSS to customize the image size, since the returned images might vary.
Whether to include an image with the avatar returned by GitHub or read from all-contributors JSON data. Use CSS or the ``avatars_size`` option to customize the image size, since the returned images might vary.

.. rst:directive:option:: avatars_only
:type: boolean

Show only avatar images with no usernames or contribution counts. Each avatar links to the contributor's GitHub profile, and the username is shown as a tooltip on hover. Implies ``:avatars:``.
Show only avatar images with no usernames or contribution counts. Each avatar links to the contributor's (GitHub) profile, and the username is shown as a tooltip on hover. Implies ``:avatars:``.

.. rst:directive:option:: avatar_size
:type: int

Set the avatar size in pixels. Default is specified by the global default setting ``sphinx_contributors_conf['avatar_size_default']``.

.. rst:directive:option:: contributions
:type: boolean
:type: string

Whether to show the total number of contributions by each user or not.
If present, individual contributions are shown. The optional string argument is a whitespace delimited
list of keywords to change the level of detail of the contribution output. By default, a detailed list
of contributions is created. Use the ``brief`` keyword to create a brief list of contribution types.
Add the ``emoji`` keyword to place an emoji icon before the contribution type. Use the ``emojis-only``
keyword to omit the contribution type text and only render the emoji icon if one is available for the
particular contribution type. Detailed output may consist of additional text describing the contribution
and key/value pairs, such as total number of commits in git repositories.

.. rst:directive:option:: names
:type: boolean
Expand All @@ -53,6 +88,16 @@ 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

.. rst:directive:option:: class_name
:type: string

By default, the directive uses the CSS class prefix ``sphinx-contributors``. Use this option to over-write the prefix to allow for individual CSS styling of the generated (HTML) output.

.. 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