Skip to content

Commit 9a202df

Browse files
docs: Added new sphinx docs (#726)
### Changes included in this PR - Upgraded all dependencies to latest compatible versions - Removed old docs and replaced with new sphinx based documentation - Added docs for installation, debugging, basic server and client setup. - Updated type checking in `ocpp/message.py`. Previously, we were using `type(message) == Call`, now we are using `isinstance(message, Call)` to compare the types. ### Current behavior - Old docs not compatible with existing codebase ### New behavior - New docs compatible with existing codebase with more structured and complete documentation - For local development, we now need Python 3.11 or more. ### Impact - Easier user onboarding - Using sphinx_rtd_theme for better UI and UX ### Checklist 1. [x] Does your submission pass the existing tests? 2. [ ] Are there new tests that cover these additions/changes? 3. [x] Have you linted your code locally before submission?
1 parent 073625d commit 9a202df

File tree

14 files changed

+782
-735
lines changed

14 files changed

+782
-735
lines changed

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version: 2
66

77
# Set the OS, Python version and other tools you might need
88
build:
9-
os: ubuntu-lts-latest
9+
os: ubuntu-22.04
1010
tools:
1111
python: "3.12"
1212
# You can also specify other tool versions:

docs/source/README.rst

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/source/central_system.rst

Lines changed: 0 additions & 180 deletions
This file was deleted.

docs/source/client.rst

Whitespace-only changes.

docs/source/conf.py

Lines changed: 17 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,31 @@
11
# Configuration file for the Sphinx documentation builder.
22
#
3-
# This file only contains a selection of the most common options. For a full
4-
# list see the documentation:
5-
# http://www.sphinx-doc.org/en/master/config
6-
7-
# -- Path setup --------------------------------------------------------------
8-
9-
# If extensions (or modules to document with autodoc) are in another directory,
10-
# add these directories to sys.path here. If the directory is relative to the
11-
# documentation root, use os.path.abspath to make it absolute, like shown here.
12-
#
13-
import os
14-
import sys
15-
16-
sys.path.insert(0, os.path.abspath("../../"))
17-
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
185

196
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
208

21-
project = "OCPP"
22-
copyright = "2024, Auke Willem Oosterhoff"
23-
author = "Auke Willem Oosterhoff"
24-
25-
# The full version, including alpha/beta/rc tags
26-
release = "2.0.0"
27-
9+
project = 'ocpp'
10+
copyright = '2025, Mohit Jain'
11+
author = 'Mohit Jain'
12+
release = '3.0.0'
2813

2914
# -- General configuration ---------------------------------------------------
15+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
3016

31-
# Add any Sphinx extension module names here, as strings. They can be
32-
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
33-
# ones.
34-
extensions = ["sphinx.ext.autodoc"]
35-
36-
# Add any paths that contain templates here, relative to this directory.
37-
templates_path = ["_templates"]
17+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinx.ext.viewcode']
3818

39-
# List of patterns, relative to source directory, that match files and
40-
# directories to ignore when looking for source files.
41-
# This pattern also affects html_static_path and html_extra_path.
19+
templates_path = ['_templates']
4220
exclude_patterns = []
4321

44-
master_doc = "index"
4522

46-
# -- Options for HTML output -------------------------------------------------
4723

48-
# The theme to use for HTML and HTML Help pages. See the documentation for
49-
# a list of builtin themes.
50-
#
51-
html_theme = "alabaster"
24+
# -- Options for HTML output -------------------------------------------------
25+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
5226

53-
# Add any paths that contain custom static files (such as style sheets) here,
54-
# relative to this directory. They are copied after the builtin static files,
55-
# so a file named "default.css" will overwrite the builtin "default.css".
56-
html_static_path = ["_static"]
27+
html_theme = 'sphinx_rtd_theme'
28+
html_static_path = ['_static']
29+
html_theme_options = {
30+
'collapse_navigation': False,
31+
}

docs/source/debugging.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Debugging
2+
=========
3+
4+
Python's default log level is ``logging.WARNING``. As a result most of the logs generated by this package are discarded.
5+
6+
To see the log output of this package lower the log level to ``logging.DEBUG``.
7+
8+
.. code-block:: python
9+
10+
import logging
11+
logging.basicConfig(level=logging.DEBUG)
12+
13+
However, this approach defines the log level for the complete logging system.
14+
In other words: the log level of all dependencies is set to ``logging.DEBUG``.
15+
16+
To lower the logs for this package only use the following code:
17+
18+
.. code-block:: python
19+
20+
import logging
21+
logging.getLogger('ocpp').setLevel(level=logging.DEBUG)
22+
logging.getLogger('ocpp').addHandler(logging.StreamHandler())

docs/source/index.rst

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
.. OCPP documentation master file, created by
2-
sphinx-quickstart on Tue May 28 20:40:32 2019.
1+
.. ocpp documentation master file, created by
2+
sphinx-quickstart on Sun May 4 14:28:47 2025.
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
.. include:: ../../README.rst
6+
ocpp documentation
7+
==================
8+
9+
Add your content using ``reStructuredText`` syntax. See the
10+
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
11+
documentation for details.
712

8-
Index
9-
-----
1013

1114
.. toctree::
1215
:maxdepth: 2
16+
:caption: Contents:
1317

14-
README
15-
central_system
18+
installation
19+
usage/index
20+
debugging

docs/source/installation.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Installation
2+
============
3+
4+
You can either install the project from Pypi:
5+
6+
.. code-block:: bash
7+
8+
pip install ocpp
9+
10+
Or clone the project and install it manually using:
11+
12+
.. code-block:: bash
13+
14+
pip install .
15+
16+
**Dependencies**
17+
18+
- Python 3.7 or higher
19+
- The project also requires a websocket library. We recommend using `websockets`_:
20+
21+
.. code-block:: bash
22+
23+
pip install websockets
24+
25+
.. _websockets: https://pypi.org/project/websockets/

0 commit comments

Comments
 (0)