-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
731 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: "Documentation" | ||
|
||
on: | ||
push: | ||
branches: | ||
- "master" | ||
tags: | ||
- "v*" | ||
pull_request: | ||
branches: | ||
- "master" | ||
|
||
jobs: | ||
build: | ||
name: Build sphinx documentation | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Install Poetry | ||
run: pipx install poetry | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.12 | ||
cache: "poetry" | ||
- name: Setup environment | ||
run: poetry install | ||
- name: Build HTML | ||
run: poetry run sphinx-build -M html docs docs/build | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: github-pages | ||
path: docs/build/html/ | ||
deploy: | ||
name: Deploy documentation | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
permissions: | ||
pages: write # to deploy to Pages | ||
id-token: write # to verify the deployment originates from an appropriate source | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
ImmutableOrderedDict | ||
====================== | ||
|
||
.. autoclass:: immutabledict.ImmutableOrderedDict | ||
:exclude-members: dict_cls | ||
:show-inheritance: | ||
:member-order: bysource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
immutabledict | ||
====================== | ||
|
||
.. autoclass:: immutabledict.immutabledict | ||
:exclude-members: items,keys,values | ||
:member-order: bysource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""sphinx configuration.""" | ||
from immutabledict import __version__ | ||
|
||
# Project info | ||
project = "immutabledict" | ||
copyright = "2023, corenting" | ||
author = "corenting" | ||
version = __version__ | ||
release = __version__ | ||
|
||
# General configuration | ||
extensions = [ | ||
"alabaster", | ||
"sphinx.ext.intersphinx", | ||
"sphinx.ext.autodoc", | ||
] | ||
|
||
templates_path = ["_templates"] | ||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] | ||
|
||
# Autodoc settings | ||
autodoc_default_options = { | ||
"members": True, | ||
} | ||
|
||
# intersphinx to Python | ||
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} | ||
|
||
# HTML output | ||
html_theme = "alabaster" | ||
html_sidebars = { | ||
"**": [ | ||
"about.html", | ||
"navigation.html", | ||
"relations.html", | ||
"searchbox.html", | ||
"donate.html", | ||
] | ||
} | ||
html_theme_options = { | ||
"description": "An immutable wrapper around dictionaries", | ||
"github_user": "corenting", | ||
"github_repo": "immutabledict", | ||
"codecov_button": True, | ||
"badge_branch": "master", | ||
"sidebar_width": "300px", | ||
"donate_url": "https://corenting.fr/donate", | ||
"extra_nav_links": { | ||
"Github repository": "https://github.com/corenting/immutabledict", | ||
"PyPI page": "https://pypi.org/project/immutabledict/", | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Welcome to immutabledict’s documentation! | ||
========================================= | ||
|
||
This site covers immutabledict’s API documentation. For more information about immutabledict, see `the Github repository <https://github.com/corenting/immutabledict>`_. | ||
|
||
Usage | ||
----- | ||
|
||
The :class:`.immutabledict` class can be used as a drop-in replacement for :class:`dict`. | ||
|
||
For replacing an :class:`collections.OrderedDict`, you can use an :class:`.ImmutableOrderedDict`. The API is the same as :class:`.immutabledict`, but it will use an :class:`collections.OrderedDict` under the hood. | ||
|
||
.. code-block:: python | ||
from immutabledict import immutabledict | ||
my_item = immutabledict({"a": "value", "b": "other_value"}) | ||
print(my_item["a"]) # Print "value" | ||
Some additional methods are provided, see the API reference. | ||
|
||
|
||
API reference | ||
------------- | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
/api/immutabledict | ||
/api/immutable_ordered_dict | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.