Skip to content

Commit

Permalink
Add daily scheduled run and minor tweaks (#17)
Browse files Browse the repository at this point in the history
- Add daily scheduled test run
- Update to new ruff config structure
- Match config style of Modernize scaffolding, drop py3.7, and add py3.12 leda#13
  • Loading branch information
yanovs authored Feb 24, 2024
1 parent cecb3ad commit 9b22783
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 36 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 5 * * *'

permissions:
contents: read
Expand Down
6 changes: 3 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
if any(arg.startswith("fix") for arg in sys.argv):
nox.options.sessions = ["fix_ruff"]
else:
nox.options.sessions = ["mypy", "pyright", "pytest", "ruff"]
nox.options.sessions = ["ruff", "mypy", "pyright", "pytest"]


def is_isolated_venv(session: nox.Session) -> bool:
Expand Down Expand Up @@ -82,16 +82,16 @@ def pytest(session: nox.Session) -> None:
def ruff(session: nox.Session) -> None:
if is_isolated_venv(session):
session.install("-e", ".[test]")
session.run("ruff", "check", "dilib")
session.run("ruff", "format", "dilib", "--check")
session.run("ruff", "check", "dilib")


@nox.session(tags=["fix"])
def fix_ruff(session: nox.Session) -> None:
if is_isolated_venv(session):
session.install("-e", ".[test]")
session.run("ruff", "check", "dilib", "--fix")
session.run("ruff", "format", "dilib")
session.run("ruff", "check", "dilib", "--fix")


@nox.session(venv_backend="none")
Expand Down
67 changes: 34 additions & 33 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,37 @@ reportPrivateImportUsage = "none"
target-version = "py38"
line-length = 79

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]

[tool.ruff.format]
# https://docs.astral.sh/ruff/formatter/
quote-style = "double"
indent-style = "space"

[tool.ruff.lint]
select = [
# https://beta.ruff.rs/docs/rules/#pyflakes-f
"F",
Expand Down Expand Up @@ -72,48 +103,18 @@ ignore = [
"ANN101", "ANN102", "ANN401",
]

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.format]
# https://docs.astral.sh/ruff/formatter/
quote-style = "double"
indent-style = "space"

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 10

[tool.ruff.isort]
[tool.ruff.lint.isort]
force-sort-within-sections = true
section-order = [
"future", "standard-library", "third-party", "first-party", "local-folder"
]
single-line-exclusions = ["collections.abc", "typing", "typing_extensions"]

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "google"

0 comments on commit 9b22783

Please sign in to comment.