Skip to content

Commit

Permalink
24.11.0 (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
spacemanspiff2007 authored Nov 22, 2024
1 parent b7ce0fa commit a92eaff
Show file tree
Hide file tree
Showing 391 changed files with 4,908 additions and 3,461 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
with:
ref: master

- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.12'

- name: Install setuptools
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
- uses: pre-commit/[email protected]


Expand All @@ -20,7 +20,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
Expand Down
19 changes: 16 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-ast
- id: check-builtin-literals
Expand All @@ -15,14 +15,27 @@ repos:


- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0
rev: v0.8.0
hooks:
- id: ruff
name: ruff unused imports
# F401 [*] {name} imported but unused
args: [ "--select", "F401,I001", "--extend-exclude", "__init__.py", "--fix"]

- id: ruff
# I001 [*] Import block is un-sorted or un-formatted
# UP035 [*] Import from {target} instead: {names}
# Q000 [*] Double quote found but single quotes preferred
# Q001 [*] Double quote multiline found but single quotes preferred
args: [ "--select", "I001,UP035,Q000,Q001", "--fix"]
args: [ "--select", "UP035,Q000,Q001", "--fix"]


- repo: https://github.com/JelleZijlstra/autotyping
rev: 24.9.0
hooks:
- id: autotyping
types: [python]
args: [--safe]


- repo: https://github.com/pre-commit/pygrep-hooks
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ formats: all
build:
os: ubuntu-22.04
tools:
python: "3.10"
python: "3.12"
apt_packages:
- graphviz

Expand Down
126 changes: 81 additions & 45 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -1,77 +1,113 @@

line-length = 120
indent-width = 4
line-length = 120

target-version = "py38"
src = ["src", "test"]

target-version = "py310"

extend-exclude = [
"__init__.py",
"src/__test_*.py"
src = [
"src",
"tests"
]
extend-exclude = ["src/__test_*.py"]


[lint]
select = [
"E", "W", # https://docs.astral.sh/ruff/rules/#pycodestyle-e-w
"I", # https://docs.astral.sh/ruff/rules/#isort-i
"UP", # https://docs.astral.sh/ruff/rules/#pyupgrade-up

"A", # https://docs.astral.sh/ruff/rules/#flake8-builtins-a
"ASYNC", # https://docs.astral.sh/ruff/rules/#flake8-async-async
"C4", # https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
"EM", # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
"FIX", # https://docs.astral.sh/ruff/rules/#flake8-fixme-fix
"INP", # https://docs.astral.sh/ruff/rules/#flake8-no-pep420-inp
"ISC", # https://docs.astral.sh/ruff/rules/#flake8-implicit-str-concat-isc
"PIE", # https://docs.astral.sh/ruff/rules/#flake8-pie-pie
"PT", # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
"PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
"RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret
"SIM", # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
"SLOT", # https://docs.astral.sh/ruff/rules/#flake8-slots-slot
"T10", # https://docs.astral.sh/ruff/rules/#flake8-debugger-t10
"TCH", # https://docs.astral.sh/ruff/rules/#flake8-type-checking-tch
"TD", # https://docs.astral.sh/ruff/rules/#flake8-todos-td

"TRY", # https://docs.astral.sh/ruff/rules/#tryceratops-try
"FLY", # https://docs.astral.sh/ruff/rules/#flynt-fly
"PERF", # https://docs.astral.sh/ruff/rules/#perflint-perf
"RUF", # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf

# "PL", # https://docs.astral.sh/ruff/rules/#pylint-pl
# "FURB", # https://docs.astral.sh/ruff/rules/#refurb-furb
]
select = ["ALL"]

ignore = [
"D", # https://docs.astral.sh/ruff/rules/#pydocstyle-d
"T20", # https://docs.astral.sh/ruff/rules/#flake8-print-t20
"DTZ", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
"SLF", # https://docs.astral.sh/ruff/rules/#flake8-self-slf

"RET501", # https://docs.astral.sh/ruff/rules/unnecessary-return-none/#unnecessary-return-none-ret501
"TRY400", # https://docs.astral.sh/ruff/rules/error-instead-of-exception/

"A003", # https://docs.astral.sh/ruff/rules/builtin-attribute-shadowing/
# https://docs.astral.sh/ruff/rules/#flake8-builtins-a
"A003", # Python builtin is shadowed by class attribute {name} from {row}

# https://docs.astral.sh/ruff/rules/#pyflakes-f
"F401", # {name} imported but unused; consider using importlib.util.find_spec to test for availability

# https://docs.astral.sh/ruff/rules/#flake8-bandit-s
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes

# https://docs.astral.sh/ruff/rules/#pyupgrade-up
"UP038", # Use X | Y in {} call instead of (X, Y)

# https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
"ANN101", # Missing type annotation for {name} in method
"ANN102", # Missing type annotation for {name} in classmethod
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {name}

# https://docs.astral.sh/ruff/rules/#flake8-blind-except-ble
"BLE001", # Do not catch blind exception: {name}

# https://docs.astral.sh/ruff/rules/#flake8-raise-rse
"RSE102", # Unnecessary parentheses on raised exception

# https://docs.astral.sh/ruff/rules/#flake8-commas-com
"COM812", # Trailing comma missing
"COM819", # Trailing comma prohibited

# https://docs.astral.sh/ruff/rules/#warning-w_1
"PLW0603", # Using the global statement to update {name} is discouraged

# https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
"G004", # Logging statement uses f-string

# https://docs.astral.sh/ruff/rules/#refactor-r
"PLR1711", # Useless return statement at end of function

# https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
"RUF005", # Consider {expression} instead of concatenation

# https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
"PT007", # Wrong values type in @pytest.mark.parametrize expected {values} of {row}
]


[format]
# Use single quotes for non-triple-quoted strings.
quote-style = "single"


# https://docs.astral.sh/ruff/settings/#lintflake8-quotes
[lint.flake8-quotes]
inline-quotes = "single"
inline-quotes = "single"
multiline-quotes = "single"


[lint.flake8-builtins]
builtins-ignorelist = ["id", "input"]


# https://docs.astral.sh/ruff/settings/#lintisort
[lint.isort]
lines-after-imports = 2 # https://docs.astral.sh/ruff/settings/#lint_isort_lines-after-imports


[lint.per-file-ignores]
"docs/conf.py" = ["INP001", "A001"]
"docs/conf.py" = [
"INP001", # File `conf.py` is part of an implicit namespace package. Add an `__init__.py`.
"A001", # Variable `copyright` is shadowing a Python builtin
"PTH118", # `os.path.join()` should be replaced by `Path` with `/` operator
"PTH100", # `os.path.abspath()` should be replaced by `Path.resolve()`
]

"setup.py" = ["PTH123"]

"run/**" = ["INP001"]

"tests/*" = [
"ANN", # https://docs.astral.sh/ruff/rules/#flake8-annotations-ann

[lint.isort]
# https://docs.astral.sh/ruff/settings/#isort-lines-after-imports
lines-after-imports = 2
# https://docs.astral.sh/ruff/rules/#flake8-bandit-s
"S101", # Use of assert detected

# https://docs.astral.sh/ruff/rules/#refactor-r
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
"PLR0913", # Too many arguments in function definition ({c_args} > {max_args})
]

"interface_*.py" = [
"F401" # F401 [*] {name} imported but unused
]
2 changes: 1 addition & 1 deletion docs/advanced_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Example
# depends on:
# - rules/rule_file.py
# reloads on:
# - params/param_file.yml
# - param/param_file.yml
import HABApp
...
Expand Down
65 changes: 3 additions & 62 deletions docs/class_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,70 +26,11 @@ ItemNoChangeWatch
:member-order: groupwise


Scheduler
======================================


OneTimeJob
""""""""""""""""""""""""""""""""""""""

.. autoclass:: HABApp.rule.scheduler.jobs.OneTimeJob
:members:
:inherited-members:
:member-order: groupwise

CountdownJob
""""""""""""""""""""""""""""""""""""""

.. autoclass:: HABApp.rule.scheduler.jobs.CountdownJob
:members:
:inherited-members:
:member-order: groupwise

ReoccurringJob
""""""""""""""""""""""""""""""""""""""

.. autoclass:: HABApp.rule.scheduler.jobs.ReoccurringJob
:members:
:inherited-members:
:member-order: groupwise

DayOfWeekJob
""""""""""""""""""""""""""""""""""""""

.. autoclass:: HABApp.rule.scheduler.jobs.DayOfWeekJob
:members:
:inherited-members:
:member-order: groupwise

DawnJob
""""""""""""""""""""""""""""""""""""""

.. autoclass:: HABApp.rule.scheduler.jobs.DawnJob
:members:
:inherited-members:
:member-order: groupwise

SunriseJob
""""""""""""""""""""""""""""""""""""""

.. autoclass:: HABApp.rule.scheduler.jobs.SunriseJob
:members:
:inherited-members:
:member-order: groupwise

SunsetJob
""""""""""""""""""""""""""""""""""""""

.. autoclass:: HABApp.rule.scheduler.jobs.SunsetJob
:members:
:inherited-members:
:member-order: groupwise

DuskJob
""""""""""""""""""""""""""""""""""""""
InstantView
======================================

.. autoclass:: HABApp.rule.scheduler.jobs.DuskJob
.. autoclass:: HABApp.core.lib.InstantView
:members:
:inherited-members:
:member-order: groupwise
16 changes: 8 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
logger_lvl = logging.DEBUG if IS_RTD_BUILD or IS_CI else logging.INFO # set level to DEBUG for CI


def log(msg: str):
def log(msg: str) -> None:
sphinx_logger.log(logger_lvl, f'[POST] {msg:s}')


Expand Down Expand Up @@ -87,7 +87,7 @@ def log(msg: str):
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = {'.rst': 'restructuredtext'}

# The master toctree document.
master_doc = 'index'
Expand Down Expand Up @@ -123,7 +123,6 @@ def log(msg: str):
'canonical_url': '',
# 'analytics_id': 'UA-XXXXXXX-1', # Provided by Google in your dashboard
'logo_only': False,
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': False,
# 'vcs_pageview_mode': '',
Expand Down Expand Up @@ -233,7 +232,7 @@ def log(msg: str):

nitpick_ignore_regex = [
(re.compile(r'py:data|py:class'), re.compile(r'typing\..+')),
(re.compile(r'py:class'), re.compile(r'(?:datetime|pendulum|aiohttp|pathlib)\..+'))
(re.compile(r'py:class'), re.compile(r'(?:datetime|aiohttp|pathlib)\..+'))
]

# -- Extension configuration -------------------------------------------------
Expand Down Expand Up @@ -295,7 +294,7 @@ def replace_node_contents(node: Node):
replacement = TYPE_REPLACEMENTS.get(node_text)

# https://www.sphinx-doc.org/en/master/extdev/nodes.html
if isinstance(node, desc_signature) and node.attributes.get('fullname', '').endswith('Item'):
if isinstance(node, desc_signature) and node.attributes.get('fullname', '').endswith(('Item', 'JobControl')):
log(f'Removing constructor signature of {", ".join(node.attributes["ids"])}')
assert len(node.children) == 3
signature_node = node.children[2]
Expand Down Expand Up @@ -323,22 +322,23 @@ def replace_node_contents(node: Node):
return matched_nodes


def transform_desc(app, domain, objtype: str, contentnode):
def transform_desc(app, domain, objtype: str, contentnode) -> None:
# if objtype != 'pydantic_field':
# return None

replace_node_contents(node=contentnode.parent)


def setup(app):
def setup(app) -> None:
app.connect('object-description-transform', transform_desc)


# -- Options for intersphinx -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html
if IS_RTD_BUILD:
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None)
'python': ('https://docs.python.org/3', None),
'whenever': ('https://whenever.readthedocs.io/en/stable', None)
}

# Don't show warnings for missing python references since these are created via intersphinx during the RTD build
Expand Down
Loading

0 comments on commit a92eaff

Please sign in to comment.