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
14 changes: 1 addition & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ repos:
rev: 5.0.4
hooks:
- id: flake8
args: ["--config", "tox.ini"]
additional_dependencies:
- flake8-docstrings
- flake8-colors
Expand All @@ -97,6 +96,7 @@ repos:
- pycodestyle
- pyflakes
- flake8-rst-docstrings
- flake8-pyproject
- flake8-use-fstring

# Check for known security vulnerabilities:
Expand All @@ -107,18 +107,6 @@ repos:
args: ["-c", "pyproject.toml"]
additional_dependencies: ["bandit[toml]"]

# # Use type annotations to check types
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v0.990
# hooks:
# - id: mypy
# additional_dependencies:
# - pytest
# - types-jinja2
# - types-setuptools
## - pandas-stubs
# args: ["--strict"]

# Check for errors in restructuredtext (.rst) files under the doc hierarchy
- repo: https://github.com/PyCQA/doc8
rev: v1.0.0
Expand Down
2 changes: 2 additions & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ What's New?
facility has storage, storage can be charged by the constrained excess.
* Added ``compare_hist`` argument to :meth:`.DispatchModel.plot_period` which creates
panel plot showing both historical dispatch and redispatch for the period.
* Cleanup of configuration and packaging files. Contents of ``setup.cfg`` and
``tox.ini`` moved to ``pyproject.toml``.

Bug Fixes
^^^^^^^^^
Expand Down
212 changes: 190 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,146 @@
requires = ["setuptools<66", "setuptools_scm[toml]>=3.5.0"]
build-backend = "setuptools.build_meta"

[project]
name = "rmi.dispatch"
description = "A simple and efficient dispatch model."
license = {file = "LICENSE.txt"}
readme = "README.rst"
dynamic = ["version"]
classifiers = [
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
]
requires-python = ">=3.10,<3.11"
dependencies = [
"bottleneck >= 1.3,<1.3.6",
"numba >= 0.55.1,<0.57",
"numexpr >= 2.8, <2.8.4",
"numpy >= 1.18.5,<2",
"pandas >= 1.4,< 1.6",
"pandera ~= 0.12",
"pyarrow>=7, <11",
"rmi.etoolbox @ git+https://github.com/rmi-electricity/etoolbox.git",
]

[project.optional-dependencies]
dev = [
"black[jupyter] >= 22,<23",
"isort>=5.0,<5.11",
"tox>=3.20,<3.28",
]
doc = [
"doc8>=0.9,<1.1",
"furo>=2022.4.7",
"sphinx>=4,!=5.1.0,<5.3.1",
"sphinx-autoapi>=1.8,<2.1",
"sphinx-issues>=1.2,<3.1",
"sphinx-autodoc-typehints>1.19,<=1.19.5",
"sphinxcontrib-mermaid>0.7,<=0.7.1",
]
tests = [
"bandit>=1.6,<1.8",
"coverage>=5.3,<6.6",
"doc8>=0.9,<1.1",
"flake8>=4.0,<5.1",
"flake8-builtins>=1.5,<2.1",
"flake8-docstrings>=1.5,<1.7",
"flake8-pyproject>1.0,<=1.2",
"flake8-rst-docstrings>=0.2,<0.3",
"flake8-use-fstring>=1.0,<1.5",
"mccabe>=0.6,<0.8",
"mypy>=0.942,<0.991",
"pep8-naming>=0.12,<0.14",
"pre-commit>=2.9,<2.21",
"pydocstyle>=5.1,<6.2",
"pytest>=6.2,<7.3",
"pytest-console-scripts>=1.1,<1.4",
"pytest-cov>=2.10,<4.1",
"rstcheck[sphinx,toml]>=5.0,<6.2",
"tox>=3.20,<3.28",
]
viz = [
"plotly>5.10,<=5.11",
"kaleido>0.2,<=0.2.1",
]

[tool.setuptools_scm]
write_to = "src/dispatch/_version.py"

[tool.black]
line-length = 88
target-version = ["py39", "py310", "py311"]
include = "\\.pyi?$"
[tool.setuptools]
package-dir = {"" = "src"}

[tool.isort]
profile = "black"
known_first_party = ["dispatch"]
[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.dynamic]
version = {attr = "dispatch._version.__version__"}

[tool.bandit]
exclude_dirs = ["tests"]
skips = ["B101"]

[tool.mypy]
python_version = "3.10"
warn_return_any = true
warn_unused_configs = true
plugins = "numpy.typing.mypy_plugin"
[tool.black]
line-length = 88
target-version = ["py39", "py310", "py311"]
include = "\\.pyi?$"

[[tool.mypy.overrides]]
module = [
"numpy.*",
"pandas.*",
"numba.*"
[tool.doc8]
max-line-length = 88
ignore-path = "docs/_build"

[tool.flake8]
extend-ignore = [
# * W503, W504: Line break before / after binary operator.
"W503", "W504",
"D401", # * D401: Imperative mood.
"E501", # * E501: Overlong line
"E203", # * E203: Space before ':' (black recommends to ignore)
# * RST201,RST203,RST301: Google docstrings aren't RST until after being processed by
# Napoleon. See https://github.com/peterjc/flake8-rst-docstrings/issues/17
"RST201", "RST203", "RST301",
"D105",
"C901" # We have a backlog of complex functions being skipped with noqa: C901
]
max-complexity = 10
inline-quotes = "double"
max-line-length = 88
docstring-convention = "google"
# Files and directories that should not be subject to linting
extend-exclude = [
".env_tox",
".eggs",
"build",
]
rst-roles =[
"attr",
"class",
"doc",
"func",
"meth",
"mod",
"obj",
"py:const",
"ref",
"user",
]
rst-directives =[
"envvar",
"exception",
]
ignore_missing_imports = true
percent-greedy = 2
format-greedy = 2
per-file-ignores = [
"__init__.py:F401"
]

[tool.isort]
profile = "black"
known_first_party = ["dispatch"]

[tool.pytest.ini_options]
testpaths = ["."]
Expand All @@ -45,12 +156,69 @@ filterwarnings = [
"ignore:Creating a LegacyVersion:DeprecationWarning:pkg_resources[.*]",
]

[tool.doc8]
max-line-length = 88
ignore-path = "docs/_build"

[tool.rstcheck]
report_level = "WARNING"
ignore_roles = ["pr", "issue", "user", "include"]
ignore_messages = '(Hyperlink target .* is not referenced\.$|Duplicate implicit target name:|An `AttributeError` error occured.*)'
ignore_directives = ["bibliography", "todo", "include"]

[tool.tox]
legacy_tox_ini = """
[tox]
envlist =
linters
docs
tests
isolated_build = True

[testenv]
extras =
tests
doc
viz
allowlist_externals =
bash
coverage
sphinx-build
skip_install = false
covargs = --cov={envsitepackagesdir}/dispatch --cov-append --cov-report=lcov:coverage.info
covreport = coverage report --sort=cover

[testenv:linters]
description = Run the pre-commit, flake8, rstcheck, doc8 and bandit linters.
commands =
pre-commit run --all-files --show-diff-on-failure python-no-eval
pre-commit run --all-files --show-diff-on-failure python-no-log-warn
pre-commit run --all-files --show-diff-on-failure python-check-blanket-noqa
pre-commit run --all-files --show-diff-on-failure check-merge-conflict
pre-commit run --all-files --show-diff-on-failure check-yaml
pre-commit run --all-files --show-diff-on-failure check-case-conflict
pre-commit run --all-files --show-diff-on-failure debug-statements
pre-commit run --all-files --show-diff-on-failure name-tests-test
bandit -c pyproject.toml -r src/dispatch/
flake8
bash -c 'rm -rf docs/_build'
doc8 docs/ README.rst
rstcheck --config pyproject.toml --recursive ./

[testenv:docs]
description = Build the HTML docs from scratch using Sphinx.
commands =
bash -c 'rm -rf docs/_build'
sphinx-build -b html docs docs/_build

[testenv:tests]
description = Run all tests & generate test coverage.
recreate = true
commands =
coverage erase
pytest {posargs} {[testenv]covargs} --doctest-modules {envsitepackagesdir}/dispatch tests
{[testenv]covreport}

[testenv:build]
description = Prepare Python source and binary packages for release.
basepython = python3
commands =
bash -c 'rm -rf build/* dist/*'
python -m build --sdist --wheel
"""
85 changes: 0 additions & 85 deletions setup.cfg

This file was deleted.

Loading