Skip to content

Commit

Permalink
style: added toml-sort pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
martibosch committed Dec 10, 2024
1 parent 75907a9 commit 8cddb40
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 98 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ repos:
- mdformat-gfm
- mdformat-black

- repo: https://github.com/pappasam/toml-sort
rev: v0.24.2
hooks:
- id: toml-sort-fix
args: ["--in-place"]

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
Expand Down
194 changes: 96 additions & 98 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,71 @@ version = "3.0.1"
description = "Computing landscape metrics in the Python ecosystem."
readme = "README.md"
authors = [
{ name = "Martí Bosch", email = "[email protected]" },
{name = "Martí Bosch", email = "[email protected]"}
]
license = { text = "GPL-3.0" }
license = {text = "GPL-3.0"}
classifiers = [
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13"
]
requires-python = ">=3.9"
dependencies = [
"dask",
"geopandas",
"matplotlib >= 2.2",
"numpy >= 1.15",
"pandas >= 0.23",
"rasterio >= 1.0.0",
"scipy >= 1.0.0",
"dask",
"geopandas",
"matplotlib >= 2.2",
"numpy >= 1.15",
"pandas >= 0.23",
"rasterio >= 1.0.0",
"scipy >= 1.0.0"
]

[project.urls]
Repository = "https://github.com/martibosch/pylandstats"

[project.optional-dependencies]
test = ["coverage[toml]", "pytest", "pytest-cov", "ruff"]
dev = ["build", "commitizen", "nox", "pre-commit", "pip", "toml", "twine"]
doc = ["m2r2", "myst-nb", "pydata-sphinx-theme", "sphinx"]

# [tool.setuptools]
# ext-modules = [
# {name="adjacency", sources=["pylandstats/adjacency.pyx"]}
# ]
[project.urls]
Repository = "https://github.com/martibosch/pylandstats"

[tool.setuptools.packages.find]
include = ["pylandstats", "pylandstats.*"]
[tool.cibuildwheel]
build = ["cp39-*", "cp310-*", "cp311-*", "cp312-*", "cp313-*"]
skip = "*-musllinux_i686"

[tool.codespell]
ignore-words-list = "te"
skip = "CHANGELOG.md"

[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "v$version"
version_provider = "pep621"
version_files = [
"pylandstats/__init__.py",
"pyproject.toml:version"
]

[tool.coverage.report]
exclude_lines = [
"if self.debug:",
"pragma: no cover",
"raise NotImplementedError",
"except ModuleNotFoundError",
"except ImportError"
]
ignore_errors = true
omit = ["tests/*", "docs/conf.py"]

[tool.coverage.run]
source = ["pylandstats"]

[tool.pytest.ini_options]
addopts = ["--import-mode=importlib"]

[tool.ruff]
line-length = 88
Expand All @@ -57,106 +83,78 @@ docstring-code-format = true
[tool.ruff.lint]
select = ["D", "E", "F", "I"]

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

[tool.ruff.lint.isort]
known-first-party = ["pylandstats"]

[tool.ruff.lint.per-file-ignores]
"**/__init__.py" = ["F403"]
"pylandstats/landscape.py" = ["D401"] # for metric docstrings
"pylandstats/landscape.py" = ["D401"] # for metric docstrings
"tests/test_pylandstats.py" = ["D"]

[tool.coverage.run]
source = ["pylandstats"]

[tool.coverage.report]
exclude_lines = [
"if self.debug:",
"pragma: no cover",
"raise NotImplementedError",
"except ModuleNotFoundError",
"except ImportError",
]
ignore_errors = true
omit = ["tests/*", "docs/conf.py"]

[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "v$version"
version_provider = "pep621"
version_files = [
"pylandstats/__init__.py",
"pyproject.toml:version"
]


[tool.cibuildwheel]
build = ["cp39-*", "cp310-*", "cp311-*", "cp312-*", "cp313-*"]
skip = "*-musllinux_i686"

[tool.codespell]
ignore-words-list = "te"
skip = "CHANGELOG.md"
[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.pytest.ini_options]
addopts = ["--import-mode=importlib"]
[tool.setuptools.packages.find]
include = ["pylandstats", "pylandstats.*"]

[tool.tox]
env_list = [
"lint",
"py39",
"py310",
"py311",
"py312",
"py313",
"lint",
"py39",
"py310",
"py311",
"py312",
"py313"
]
requires = [
"tox>=4.19",
"tox>=4.19"
]

[tool.tox.gh.python]
"3.13" = ["3.13", "lint"]
"3.12" = ["3.12"]
"3.11" = ["3.11"]
"3.10" = ["3.10"]
"3.9" = ["3.9"]
[tool.tox.env.lint]
commands = [
[
["python", "-m", "build"],
["sphinx-build", "docs", "docs/_build"],
["twine", "check", "dist/*"]
]
]
extras = [
"dev",
"doc",
"test"
]
whitelist_externals = [
"build",
"sphinx-build",
"twine"
]

[tool.tox.env_run_base]
commands = [[
commands = [
[
"pytest",
"-s",
"--cov=pylandstats",
"--cov-append",
"--cov-report=xml",
"--cov-report",
"term-missing",
"tests",
]]
"tests"
]
]
conda_deps = [
"gdal>=3.3",
"gdal>=3.3"
]
extras = [
"test",
"test"
]
whitelist_externals = [
"pytest",
"pytest"
]

[tool.tox.env.lint]
commands = [[
["python", "-m", "build"],
["sphinx-build", "docs", "docs/_build"],
["twine", "check", "dist/*"],
]]
extras = [
"dev",
"doc",
"test",
]
whitelist_externals = [
"build",
"sphinx-build",
"twine",
]
[tool.tox.gh.python]
"3.13" = ["3.13", "lint"]
"3.12" = ["3.12"]
"3.11" = ["3.11"]
"3.10" = ["3.10"]
"3.9" = ["3.9"]

0 comments on commit 8cddb40

Please sign in to comment.