Skip to content

Commit

Permalink
ENH: move style tools config to pyproject.toml (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgepiloto authored Apr 8, 2022
1 parent aa5ad71 commit 6c7bbc1
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 38 deletions.
8 changes: 0 additions & 8 deletions .coveragerc

This file was deleted.

15 changes: 0 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,11 @@ repos:
rev: 22.3.0
hooks:
- id: black
args: [
--force-exclude, src/ansys/templates/python,
--line-length, "100",
src, tests
]

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
exclude: ^src/ansys/templates/pypkg/
args: [
--profile, black,
--force-sort-within-sections,
--line-length, "100",
--section-default, THIRDPARTY,
--skip-glob, src/ansys/templates/python/*,
--filter-files,
tests, doc
]

- repo: https://gitlab.com/PyCQA/flake8
rev: 4.0.1
Expand Down
20 changes: 20 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,23 @@ ansys-templates = "ansys.templates.cli:main"

[project.urls]
Source = "https://github.com/pyansys/pyansys-template"

[tool.black]
force-exclude = ["src/ansys/templates/python"]
line-length = "100"

[tool.isort]
profile = "black"
force_sort_within_sections = true
line_length = "100"
default_section = "THIRDPARTY"
skip_glob = ["src/ansys/templates/python/*"]
filter_files = "true"
src_paths = ["doc", "src", "tests"]

[tool.coverage.run]
source = ["ansys/templates"]
omit = ["ansys/templates/python/*"]

[tool.coverage.report]
show_missing = true
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ def main():
setup_file = project_path / "setup.py"
setup_file.unlink()

# Remove .coveragerc as its content is specified in the pyproject.toml
coveragerc_file = project_path / ".coveragerc"
coveragerc_file.unlink()

# Move all requirements files into a requirements/ directory
os.mkdir(project_path / "requirements")
requirements_files = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,16 @@ repos:
rev: 22.3.0
hooks:
- id: black
args: [
--line-length, "{{ cookiecutter.__max_linelength }}",
src, tests
]

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
args: [
--profile, black,
--force-sort-within-sections,
--line-length, "{{ cookiecutter.__max_linelength }}",
--section-default, THIRDPARTY,
src, tests, doc
]

- repo: https://gitlab.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
args: [src, tests, doc]

- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
Expand All @@ -37,5 +25,3 @@ repos:
hooks:
- id: pydocstyle
additional_dependencies: [toml]
args: ["--match-dir='^(src)'"]
exclude: "^(tests/)"
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,23 @@ packages = [
[tool.poetry.dependencies]
python = ">={{ cookiecutter.__requires_python }},<4.0"
importlib-metadata = {version = "^4.0", python = "<3.8"}
{% endif -%}
{% endif %}
[tool.black]
line-length = {{ cookiecutter.__max_linelength }}

[tool.isort]
profile = "black"
force_sort_within_sections = true
line_length = {{ cookiecutter.__max_linelength }}
default_section = "THIRDPARTY"
src_paths = ["doc", "src", "tests"]

[tool.pydocstyle]
match-dir = "^(src)"
exclude = "^(tests/)"

[tool.coverage.run]
source = ["ansys.{{ cookiecutter.__product_name_slug }}"]

[tool.coverage.report]
show_missing = true

0 comments on commit 6c7bbc1

Please sign in to comment.