Skip to content

Conversation

Copy link

Copilot AI commented Nov 2, 2025

Converts manual RST documentation to Sphinx autodoc to maintain docs in Python docstrings, enabling IDE integration and eliminating duplication between source code and website documentation.

Changes

Docstrings

  • Added NumPy-style docstrings to all public classes and methods in presence.py, client.py, baseclient.py, and types.py
  • Includes parameter types, descriptions, return values, and usage examples

Sphinx Configuration

  • Enabled sphinx.ext.autodoc and sphinx.ext.napoleon extensions
  • Configured sys.path for module imports
  • Converted presence.rst and client.rst to use .. autoclass:: directives

Infrastructure

  • Updated .gitignore to exclude docs/sphinx/_build/
  • Added build instructions to DEVELOPMENT.md

Example

Docstrings are now available in IDEs and auto-generated in documentation:

from pypresence import Presence

# IDE shows full docstring with all parameters
RPC = Presence("client_id")
RPC.connect()
RPC.update(
    state="Playing a game",
    details="In main menu",
    large_image="game_logo",
    buttons=[{"label": "Join", "url": "https://example.com"}]
)

Build docs with: cd docs/sphinx && sphinx-build -b html . _build

Original prompt

This section details on the original issue you should resolve

<issue_title>Automatic documentation</issue_title>
<issue_description>Would make things easier, right? sphinx (the software we're using right now) comes with autodoc which can build documentation from docstrings. This way, we can have the same docs in the IDE and on the website, making development for end users easy.</issue_description>

<agent_instructions>Basically, move the docs for all public functions into docstrings, then configure sphinx with autodoc</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits November 2, 2025 19:30
- Added detailed NumPy-style docstrings to all public methods in Presence and AioPresence classes
- Added detailed NumPy-style docstrings to all public methods in Client and AioClient classes
- Added comprehensive docstrings to BaseClient class
- Enhanced ActivityType and StatusDisplayType enum documentation
- Updated Sphinx conf.py to enable autodoc, napoleon, and configure sys.path
- Converted presence.rst and client.rst to use autodoc directives
- Documentation now automatically generated from Python docstrings
- All tests pass successfully
- Documentation builds without errors

Co-authored-by: kaneryu <[email protected]>
Copilot AI changed the title [WIP] Configure Sphinx with autodoc for automatic documentation Implement Sphinx autodoc for automatic documentation generation from docstrings Nov 2, 2025
Copilot AI requested a review from kaneryu November 2, 2025 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatic documentation

2 participants