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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ clean:
Pipfile* \
coverage.xml \
dist \
docs/_build
public
find . -name '*.egg-info' -print0 | xargs -0 rm -rf
find . -name '*.pyc' -print0 | xargs -0 rm -f
find . -name '*.swp' -print0 | xargs -0 rm -f
Expand Down Expand Up @@ -75,4 +75,4 @@ docs:
${PIPRUN} python -m sphinx.cmd.build docs public

docs-autobuild:
${PIPRUN} python -m sphinx_autobuild docs public
${PIPRUN} python -m sphinx_autobuild docs public --watch src
4 changes: 2 additions & 2 deletions Makefile.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ clean:
Pipfile* \
coverage.xml \
dist \
docs/_build
public
find . -name '*.egg-info' -print0 | xargs -0 rm -rf
find . -name '*.pyc' -print0 | xargs -0 rm -f
find . -name '*.swp' -print0 | xargs -0 rm -f
Expand Down Expand Up @@ -77,4 +77,4 @@ docs:
${PIPRUN} python -m sphinx.cmd.build docs public

docs-autobuild:
${PIPRUN} python -m sphinx_autobuild docs public
${PIPRUN} python -m sphinx_autobuild docs public --watch src
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ A development-focused Python project template with various integrations, configu
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/5697b1e4c4a9790ece607654e6c02a160620c7e1/docs/badge/v2.json)](https://pydantic.dev)
[![Serious Scaffold Python](https://img.shields.io/badge/serious%20scaffold-python-blue)](https://github.com/serious-scaffold/serious-scaffold-python)
[![PyPI](https://img.shields.io/pypi/v/serious-scaffold)](https://pypi.org/project/serious-scaffold/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/serious-scaffold)](https://pypi.org/project/serious-scaffold/)
Expand Down
1 change: 1 addition & 0 deletions README.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/5697b1e4c4a9790ece607654e6c02a160620c7e1/docs/badge/v2.json)](https://pydantic.dev)
[![Serious Scaffold Python](https://img.shields.io/badge/serious%20scaffold-python-blue)](https://github.com/serious-scaffold/serious-scaffold-python)
[![PyPI](https://img.shields.io/pypi/v/{{ package_name }})](https://pypi.org/project/{{ package_name }}/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/{{ package_name }})](https://pypi.org/project/{{ package_name }}/)
Expand Down
64 changes: 34 additions & 30 deletions constraints/default.txt
Original file line number Diff line number Diff line change
@@ -1,62 +1,66 @@
alabaster==0.7.13
autodoc-pydantic==1.8.0
annotated-types==0.5.0
autodoc-pydantic==2.0.1
Babel==2.12.1
beautifulsoup4==4.12.2
black==23.3.0
black==23.7.0
bleach==6.0.0
build==0.10.0
certifi==2023.5.7
certifi==2023.7.22
cffi==1.15.1
charset-normalizer==3.1.0
click==8.1.3
charset-normalizer==3.2.0
click==8.1.6
colorama==0.4.6
coverage==7.2.6
cryptography==40.0.2
coverage==7.2.7
cryptography==41.0.3
docutils==0.20.1
exceptiongroup==1.1.1
furo==2023.5.20
exceptiongroup==1.1.2
furo==2023.7.26
idna==3.4
imagesize==1.4.1
importlib-metadata==6.6.0
importlib-metadata==6.8.0
iniconfig==2.0.0
isort==5.12.0
jaraco.classes==3.2.3
jaraco.classes==3.3.0
jeepney==0.8.0
Jinja2==3.1.2
keyring==23.13.1
keyring==24.2.0
livereload==2.6.3
markdown-it-py==2.2.0
MarkupSafe==2.1.2
markdown-it-py==3.0.0
MarkupSafe==2.1.3
mdurl==0.1.2
more-itertools==9.1.0
mypy==1.3.0
more-itertools==10.0.0
mypy==1.4.1
mypy-extensions==1.0.0
packaging==23.1
pathspec==0.11.1
pathspec==0.11.2
pkginfo==1.9.6
platformdirs==3.5.1
pluggy==1.0.0
platformdirs==3.10.0
pluggy==1.2.0
pycparser==2.21
pydantic==1.10.8
pydantic==2.1.1
pydantic-settings==2.0.2
pydantic_core==2.4.0
Pygments==2.15.1
pyproject_hooks==1.0.0
pytest==7.3.1
pytest==7.4.0
pytest-cov==4.1.0
readme-renderer==37.3
python-dotenv==1.0.0
readme-renderer==40.0
requests==2.31.0
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==13.3.5
ruff==0.0.270
rich==13.5.2
ruff==0.0.282
SecretStorage==3.3.3
setuptools-scm==7.1.0
shellingham==1.5.0.post1
six==1.16.0
snowballstemmer==2.2.0
soupsieve==2.4.1
Sphinx==7.0.1
Sphinx==7.1.2
sphinx-autobuild==2021.3.14
sphinx-basic-ng==1.0.0b1
sphinx-basic-ng==1.0.0b2
sphinx-click==4.4.0
sphinxcontrib-applehelp==1.0.4
sphinxcontrib-devhelp==1.0.2
Expand All @@ -66,11 +70,11 @@ sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
toml-sort==0.23.1
tomli==2.0.1
tomlkit==0.11.8
tomlkit==0.12.1
tornado==6.3.2
twine==4.0.2
typer==0.9.0
typing_extensions==4.6.2
urllib3==2.0.2
typing_extensions==4.7.1
urllib3==2.0.4
webencodings==0.5.1
zipp==3.15.0
zipp==3.16.2
7 changes: 7 additions & 0 deletions docs/api/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
API Reference
=============

.. toctree::
:maxdepth: 1

settings
7 changes: 7 additions & 0 deletions docs/api/index.rst.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
API Reference
=============

.. toctree::
:maxdepth: 1

settings
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ serious_scaffold.settings
=========================

.. automodule:: serious_scaffold.settings
:members:
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
=========================

.. automodule:: {{ module_name }}.settings
:members:
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

autodoc_pydantic_settings_show_field_summary = False
autodoc_default_options = {
"members": None,
}
autodoc_pydantic_settings_show_json = False

# -- Options for HTML output -------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion docs/conf.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ extensions = [
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

autodoc_pydantic_settings_show_field_summary = False
autodoc_default_options = {
"members": None,
}
autodoc_pydantic_settings_show_json = False

# -- Options for HTML output -------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Welcome to Serious Scaffold Python's documentation!
:maxdepth: 2

cli/index
modules/index
api/index

Indices and tables
==================
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Welcome to {{ project_name }}'s documentation!
:maxdepth: 2

cli/index
modules/index
api/index

Indices and tables
==================
Expand Down
7 changes: 0 additions & 7 deletions docs/modules/index.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/modules/index.rst.jinja

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ keywords = [
]
name = "{{ package_name }}"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">={{ minimal_python_version }}"

[project.scripts]
{{ package_name }}-cli = "{{ module_name }}.cli:app"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Requirements for runtime.
pydantic
pydantic-settings
typer[all]
36 changes: 23 additions & 13 deletions src/serious_scaffold/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,38 @@
from logging import getLevelName
from typing import Optional

from pydantic import BaseSettings
from pydantic_settings import BaseSettings, SettingsConfigDict


class Settings(BaseSettings):
"""Project specific settings."""

logging_level: Optional[str] = getLevelName(logging.INFO)
class GlobalSettings(BaseSettings):
"""System level settings."""

class Config:
"""Config for settings."""
ci: bool = False
"""Indicator for whether or not in CI/CD environment."""

env_prefix = "SERIOUS_SCAFFOLD_"

class Settings(BaseSettings):
"""Project specific settings."""

class GlobalSettings(BaseSettings):
"""System level settings."""
# NOTE(huxuan): Pydantic cannot leverage future annotations at runtime prior to
# Python 3.10, so `from __future__ import annotations` cannot be used here, and the
# lint error need to be ignored unless the minimal Python version >= 3.10.
# Reference: https://github.com/pydantic/pydantic/issues/3300#issuecomment-1034007897
logging_level: Optional[str] = getLevelName(logging.INFO) # noqa: FA100
"""Default logging level for the project."""

ci: bool = False
model_config = SettingsConfigDict(
env_prefix="SERIOUS_SCAFFOLD_",
)


#: Instance for project specific settings.
settings = Settings()
# NOTE(huxuan): `#:` style docstring is required for module attributes to satisfy both
# autodoc [1] and `check-docstring-first` in `pre-commit` [2].
# [1] https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#directive-autoattribute
# [2] https://github.com/pre-commit/pre-commit-hooks/issues/159#issuecomment-559886109

#: Instance for system level settings.
global_settings = GlobalSettings()

#: Instance for project specific settings.
settings = Settings()
43 changes: 30 additions & 13 deletions src/{{ module_name }}/settings.py.jinja
Original file line number Diff line number Diff line change
@@ -1,30 +1,47 @@
{% from pathjoin("includes", "version_compare.jinja") import version_lt -%}
"""Settings Module."""
import logging
from logging import getLevelName
{%- if version_lt(minimal_python_version, "3.10") | bool %}
from typing import Optional
{%- endif %}

from pydantic import BaseSettings
from pydantic_settings import BaseSettings, SettingsConfigDict


class Settings(BaseSettings):
"""Project specific settings."""

logging_level: Optional[str] = getLevelName(logging.INFO)
class GlobalSettings(BaseSettings):
"""System level settings."""

class Config:
"""Config for settings."""
ci: bool = False
"""Indicator for whether or not in CI/CD environment."""

env_prefix = "{{ module_name|upper }}_"

class Settings(BaseSettings):
"""Project specific settings."""

class GlobalSettings(BaseSettings):
"""System level settings."""
{%- if version_lt(minimal_python_version, "3.10") | bool %}
# NOTE(huxuan): Pydantic cannot leverage future annotations at runtime prior to
# Python 3.10, so `from __future__ import annotations` cannot be used here, and the
# lint error need to be ignored unless the minimal Python version >= 3.10.
# Reference: https://github.com/pydantic/pydantic/issues/3300#issuecomment-1034007897
logging_level: Optional[str] = getLevelName(logging.INFO) # noqa: FA100
{%- else %}
logging_level: str | None = getLevelName(logging.INFO)
{%- endif %}
"""Default logging level for the project."""

ci: bool = False
model_config = SettingsConfigDict(
env_prefix="{{ module_name|upper }}_",
)


#: Instance for project specific settings.
settings = Settings()
# NOTE(huxuan): `#:` style docstring is required for module attributes to satisfy both
# autodoc [1] and `check-docstring-first` in `pre-commit` [2].
# [1] https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#directive-autoattribute
# [2] https://github.com/pre-commit/pre-commit-hooks/issues/159#issuecomment-559886109

#: Instance for system level settings.
global_settings = GlobalSettings()

#: Instance for project specific settings.
settings = Settings()