Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
47 changes: 46 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
# manually triggered

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -33,3 +33,48 @@ jobs:
uv run ruff format . --check
uv run ruff check .
.venv/bin/pytest -x tests --cov=confetti --cov-report=html

docs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@main
- name: Install the default version of uv
id: setup-uv
uses: astral-sh/setup-uv@v3
- name: Building docs
run: |
uv venv --python 3.11
uv pip install ".[doc]"
.venv/bin/sphinx-build -a -W -E doc build/sphinx/html

publish:
if: startsWith(github.ref, 'refs/tags/')
needs: test
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install hatch
run: pip install hatch

- name: Build package
run: hatch build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
skip-existing: true
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test: env

env:
uv venv
uv pip install -e ".[testing]"
uv pip install -e ".[testing,doc]"

doc: env
.venv/bin/sphinx-build -a -W -E doc build/sphinx/html
Expand Down
31 changes: 23 additions & 8 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

# import sys, os
import alabaster
import importlib.metadata

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand All @@ -25,7 +26,7 @@

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ["sphinx.ext.autodoc", "sphinx.ext.doctest"]
extensions = ["sphinx.ext.autodoc", "sphinx.ext.doctest", "releases"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
Expand All @@ -47,10 +48,7 @@
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = "1.1.0"
# The full version, including alpha/beta/rc tags.
release = "1.1.0"
version = release = importlib.metadata.distribution("confetti").version

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -91,7 +89,24 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = "default"
html_theme_path = [alabaster.get_path()]

html_theme = "alabaster"
html_theme_options = {
"github_user": "getslash",
"github_repo": "confetti",
"github_button": True,
"github_banner": True,
"travis_button": False,
}
html_sidebars = {
"**": [
"about.html",
"navigation.html",
"searchbox.html",
"donate.html",
]
}

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -120,7 +135,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
# html_static_path = ["_static"]

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
Expand Down
8 changes: 4 additions & 4 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ However, it is not allowed to extend using a Config object if it will remove exi
Traceback (most recent call last):
...
CannotSetValue: ...

In the above example, in order to add the path c.root.extended_value.child2, without re-specifying extended_value.child1, use the :func:`.Config.update` method:

>>> c.update(Config({'extended_value':{'child2':2}}))
>>> c.root.extended_value.child1
1
>>> c.root.extended_value.child2
2


Advanced Uses
~~~~~~~~~~~~~
Expand All @@ -132,7 +132,7 @@ Config objects can assign to paths using the :func:`.Config.assign_path` method:
2

Which is a synonym for:

>>> c.get_config("a.b.c").set_value(2)

In some cases you want to process config overrides from various sources that are not completely type safe, e.g. command-line or environment variables. Such variables would look like ``'some.value=2'``. Confetti provides a utility for easily assigning such expressions, optionally deducing the leaf type::
Expand All @@ -141,7 +141,7 @@ In some cases you want to process config overrides from various sources that are
>>> c.root.a.b.c
234

The default is no type deduction, which results in string values always::
The default is no type deduction, which results in string values always::

>>> c.assign_path_expression("a.b.c=230")
>>> c.root.a.b.c
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ authors = [{ name = "Rotem Yaari", email = "[email protected]" }]

[project.optional-dependencies]
testing = ["pytest", "pytest-cov", "ruff"]
doc = ["Sphinx", "alabaster", "releases"]

[tool.hatch.version]
source = "vcs"
Expand Down