Skip to content

Commit cc2e5b0

Browse files
authored
Merge pull request #1 from DiUS/formatting-changes
Formatting changes, docs and general cleanup
2 parents d25ee6f + 26f58f1 commit cc2e5b0

27 files changed

+806
-247
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy Documentation to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ "formatting-changes" ]
6+
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v5
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v6
27+
with:
28+
python-version: '3.12'
29+
30+
- name: Install Hatch
31+
run: pip install hatch
32+
33+
- name: Install dependencies
34+
run: |
35+
pip install -e ".[docs]"
36+
37+
- name: Build documentation
38+
run: |
39+
cd docs
40+
make html
41+
42+
- name: Setup Pages
43+
uses: actions/configure-pages@v4
44+
45+
- name: Upload artifact
46+
uses: actions/upload-pages-artifact@v3
47+
with:
48+
path: 'docs/build/html'
49+
50+
deploy:
51+
runs-on: ubuntu-latest
52+
needs: build
53+
steps:
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
__pycache__
22
.*.swp
3+
.idea/
4+
*.DS_Store

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build/

docs/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Minimal makefile for Sphinx documentation
2+
3+
SPHINXOPTS ?=
4+
SPHINXBUILD ?= sphinx-build
5+
SOURCEDIR = source
6+
BUILDDIR = build
7+
8+
help:
9+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
10+
11+
.PHONY: help Makefile
12+
13+
%: Makefile
14+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.https://sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd
3.67 KB
Loading

docs/source/api.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
API Reference
2+
=============
3+
4+
.. automodule:: powersensor_local
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
9+
Submodules
10+
__________
11+
12+
.. autosummary::
13+
:toctree: submodules
14+
:recursive:
15+
16+
devices
17+
listener

docs/source/conf.py

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
"""Sphinx configuration file for powersensor_local documentation."""
2+
3+
import sys
4+
from pathlib import Path
5+
6+
# Add the package to the Python path
7+
project_root = Path(__file__).parent.parent.parent
8+
sys.path.insert(0, str(project_root / "src"))
9+
print(project_root)
10+
11+
# Project information
12+
project = "powersensor_local"
13+
copyright = "2025, DiUS" # noqa A001
14+
author = "Powersensor Team!"
15+
16+
html_favicon = "_static/powersensor-logo.png"
17+
html_logo = "_static/powersensor-logo.png"
18+
19+
# The full version, including alpha/beta/rc tags
20+
try:
21+
from powersensor_local import __version__ as release
22+
except ImportError:
23+
release = "0.1.0"
24+
25+
version = ".".join(release.split(".")[:2])
26+
27+
# Extensions
28+
extensions = [
29+
"sphinx.ext.autodoc",
30+
"sphinx.ext.viewcode",
31+
"sphinx.ext.napoleon",
32+
"sphinx.ext.intersphinx",
33+
"sphinx_autodoc_typehints",
34+
"sphinx.ext.autosummary"
35+
]
36+
37+
# Napoleon settings (for Google and NumPy style docstrings)
38+
napoleon_google_docstring = True
39+
napoleon_numpy_docstring = True
40+
napoleon_include_init_with_doc = False
41+
napoleon_include_private_with_doc = False
42+
43+
# Autodoc settings
44+
autodoc_default_options = {
45+
"members": True,
46+
"undoc-members": True,
47+
"show-inheritance": True,
48+
}
49+
50+
# Intersphinx mapping
51+
intersphinx_mapping = {
52+
"python": ("https://docs.python.org/3", None),
53+
}
54+
55+
# HTML theme
56+
html_theme = "sphinx_rtd_theme"
57+
html_static_path = ["_static"]
58+
html_css_files = []
59+
60+
61+
# Output file base name for HTML help builder
62+
htmlhelp_basename = "powersensor_localdoc"
63+
64+
# Options for LaTeX output
65+
latex_elements = {}
66+
latex_documents = [
67+
("index", "powersensor_local.tex", "powersensor_local Documentation", "Your Name", "manual"),
68+
]
69+
70+
# Options for manual page output
71+
man_pages = [
72+
("index", "powersensor_local", "powersensor_local Documentation", [author], 1)
73+
]
74+
75+
# Options for Texinfo output
76+
texinfo_documents = [
77+
(
78+
"index",
79+
"powersensor_local",
80+
"powersensor_local Documentation",
81+
author,
82+
"powersensor_local",
83+
"One line description of project.",
84+
"Miscellaneous",
85+
),
86+
]

docs/source/contributing.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Contributing
2+
============
3+
4+
We welcome contributions! Here's how you can help:
5+
6+
Development Setup
7+
-----------------
8+
9+
1. Fork the repository
10+
2. Clone your fork:
11+
12+
.. code-block:: bash
13+
14+
git clone https://github.com/yourusername/powersensor_local.git
15+
16+
3. Install development dependencies:
17+
18+
.. code-block:: bash
19+
20+
pip install -e ".[docs]"
21+
22+
23+
Building Documentation
24+
----------------------
25+
26+
.. code-block:: bash
27+
28+
cd docs
29+
make html
30+
31+
The documentation will be built in `docs/build/html/`.
32+
33+
Submitting Changes
34+
------------------
35+
36+
1. Create a new branch for your changes
37+
2. Make your changes and add tests
38+
3. Submit a pull request

docs/source/index.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Welcome to powersensor_local's documentation!
2+
=================================================
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
:caption: Contents:
7+
8+
installation
9+
usage
10+
api
11+
contributing
12+
13+
Indices and tables
14+
==================
15+
16+
* :ref:`genindex`
17+
* :ref:`modindex`
18+
* :ref:`search`

0 commit comments

Comments
 (0)