Skip to content

Commit

Permalink
update setuptools and use stricter linting
Browse files Browse the repository at this point in the history
  • Loading branch information
eringrant committed Nov 14, 2023
1 parent 2e38362 commit 37d4e69
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
18 changes: 14 additions & 4 deletions TODO_package_name/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
"""Module-wide constants for `TODO_package_name`."""
# ruff: noqa: N999
import TODO_package_name
import os
from pathlib import Path

import TODO_package_name

__version__ = "0.0.1"

# Module-wide path constants as in
# https://stackoverflow.com/a/59597733.

__package_path = os.path.split(TODO_package_name.__path__[0])[0]
DATA_DIR = os.path.join(__package_path, "data")
TMP_DIR = os.path.join("/tmp", "TODO_package_name")
os.makedirs(TMP_DIR, exist_ok=True)
DATA_DIR = Path(__package_path, "data")
# TODO(eringrant): Rethink tmpdir.
TMP_DIR = Path("/tmp", "TODO_package_name") # noqa: S108
Path.mkdir(TMP_DIR, parents=True, exist_ok=True)

scratch_home = os.environ.get("SCRATCH_HOME")
SCRATCH_DIR = (
Path(scratch_home, "TODO_package_name") if scratch_home is not None else TMP_DIR
)
Path.mkdir(SCRATCH_DIR, parents=True, exist_ok=True)

del TODO_package_name
del os
Expand Down
20 changes: 17 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=42"]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[tool.black]
Expand All @@ -24,8 +24,22 @@ exclude = '''
target-version = 'py311'

# Rule sets.
select = ["D", "E", "F", "N", "UP"]
ignore = []
select = ["ALL"]
ignore = [
# Allow `TODO`s.
"TD003",
"FIX002",
# Allow many argument parameters.
"PLR0913",
# Allow long functions.
"PLR0915",
# Allow magic values.
"PLR2004",
# Allow `typing.Any`.
"ANN401",
# Allow f-strings in `logging`.
"G004",
]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
Expand Down

0 comments on commit 37d4e69

Please sign in to comment.