Skip to content

Commit

Permalink
Merge pull request #39 from seapagan/tweak-linting
Browse files Browse the repository at this point in the history
Tweak linting
  • Loading branch information
seapagan authored Aug 13, 2023
2 parents 2e12502 + 73b453c commit c17f681
Show file tree
Hide file tree
Showing 11 changed files with 306 additions and 215 deletions.
30 changes: 16 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,40 @@ repos:
hooks:
- id: check-yaml
args: [--unsafe]
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-toml
- id: check-merge-conflict
- id: end-of-file-fixer
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black
args: [--line-length=80]
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
args: [--max-line-length=80]
args: [--max-line-length=80, --color=auto]
additional_dependencies:
[flake8-docstrings, flake8-pyproject, flake8-type-checking]
[
flake8-pydocstyle,
flake8-pyproject,
flake8-pytest-style,
flake8-type-checking,
flake8-use-pathlib,
]
# files: ^my_appname/|^test_suite_name/
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: [--profile=black, --line-length=80]
- repo: https://github.com/jackdewinter/pymarkdown
rev: v0.9.11
rev: v0.9.12
hooks:
- id: pymarkdown
exclude: ^.github/|^docs/
args: [-d, "MD013,MD014", scan]
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
additional_dependencies: ["pydocstyle[toml]"]
exclude: __init__.py
exclude: ^.github/
# args: [-d, "MD014", scan]
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
hooks:
Expand Down
8 changes: 8 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
- add a command to the CLI template command to show the template files as a
tree, marking whether each file/folder is from the internal templates or the
user's templates.
- add some sort of 'plugin' functionality where we can specify modified/extra
files to be added to the generated project. This would also add a command line
flag (ie `--django`, `--pydantic` or `--fastapi` or whatever) to use that
plugin, and a config setting to specify using this plugin always.
- add config and CLI options to enable/disable creating a `git` repo, disable
adding `test` or `linting` packages etc (expand for any future options).
- include an optional `vscode` settings file in the generated project, optimized
for python projects. This could include recommended extensions.

## Documentation

Expand Down
1 change: 1 addition & 0 deletions docs/future-plans.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<!-- pyml disable-next-line first-line-heading -->
--8<-- "TODO.md"
2 changes: 2 additions & 0 deletions docs/license.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# License

--8<-- "LICENSE.txt"
2 changes: 1 addition & 1 deletion docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Creating a new project at /home/bathroom/test-project

Name of the Application? (Test Project):
Package Name? (Use '-' for standalone script) (test_project):
Description of the Application?: An amazing Bigly test project. better than you've ever seen before!
Description of the Application?: An amazing Bigly test project.
Author Name? (Orange Tango):
Author Email? ([email protected]):
Application License? [None/Apache2/BSD3/BSD2/GPL2/GPL3/LGPL/MIT/MPL2/CDDL/EPL2] (MIT):
Expand Down
5 changes: 3 additions & 2 deletions docs/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ then the script name, for example:
$ poe pre
```

You can define your own, but there are 7 specific ones provided with the script.
You can define your own, but there are 8 specific ones provided with the script.

- `pre` : Run `pre-commit run --all-files`
- `pylint`: Run Pylint on all Python files in the project.
- `mypy` = Run MyPy type-checker on all Python files in the project.
- `flake8` = Run Flake8 linter on all Python files in the project.
- `black` = Run Black code formatter on all Python files in the project.
- `try` = Run Tryceratops linter on all Python files in the project.
- `markdown` = Run pymarkdown on all markdown files in the project.

- `lint` = Runs pylint, mypy, flake8 and black in sequence
- `lint` = Runs black, flake8, mypy, try, and pylint in sequence

These are defined in the `pyproject.toml` file in the `[tool.poe.tasks]`
section. Take a look at this file if you want to add or remove tasks.
408 changes: 234 additions & 174 deletions poetry.lock

Large diffs are not rendered by default.

31 changes: 17 additions & 14 deletions py_maker/template/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,40 @@ repos:
hooks:
- id: check-yaml
args: [--unsafe]
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-toml
- id: check-merge-conflict
- id: end-of-file-fixer
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black
args: [--line-length=80]
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
args: [--max-line-length=80]
additional_dependencies: [flake8-docstrings, flake8-pyproject]
args: [--max-line-length=80, --color=auto]
additional_dependencies:
[
flake8-pydocstyle,
flake8-pyproject,
flake8-pytest-style,
flake8-type-checking,
flake8-use-pathlib,
]
# files: ^my_appname/|^test_suite_name/
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: [--profile=black, --line-length=80]
- repo: https://github.com/jackdewinter/pymarkdown
rev: v0.9.11
rev: v0.9.12
hooks:
- id: pymarkdown
exclude: ^.github/|^docs/
args: [-d, "MD013,MD014", scan]
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
additional_dependencies: ["pydocstyle[toml]"]
exclude: __init__.py
exclude: ^.github/
# args: [-d, "MD014", scan]
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
hooks:
Expand Down
10 changes: 7 additions & 3 deletions py_maker/template/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ build-backend = "poetry.core.masonry.api"
# Configure dev dependencies you can add or remove as needed
[tool.poetry.group.dev.dependencies]
# linting, type-checking and security checks
linting, type-checking and security checks
bandit = { extras = ["toml"], version = "^1.7.5" }
black = "^23.7.0"
flake8 = "^6.0.0"
flake8-docstrings = "^1.7.0"
flake8-pydocstyle = "^0.2.2"
flake8-pyproject = "^1.2.3"
flake8-pytest-style = "^1.7.2"
flake8-type-checking = "^2.4.1"
Expand All @@ -45,6 +45,7 @@ pylint-pytest = "^1.1.2"
pep8-naming = "^0.13.3"
pre-commit = "^3.3.3"
pydocstyle = "^6.3.0"
pymarkdownlnt = "^0.9.12"
mypy = "^1.4.1"
tryceratops = "^2.3.2"
Expand All @@ -71,6 +72,7 @@ mypy = "mypy **/*.py"
flake8 = "flake8 **/*.py"
black = "black **/*.py"
try = "tryceratops **/*.py"
markdown = "pymarkdown scan **/*.md"
lint = ["black", "flake8", "pylint", "mypy", "try"]
# configure assorted tools and linters
Expand Down Expand Up @@ -98,7 +100,6 @@ exclude = ["__init__.py", ".git"]
extend-ignore=["E203", "W503"]
extend-select = ["TC", "TC1", "TRY"]
docstring-convention = "google"
type-checking-pydantic-enabled = true
classmethod-decorators = ["classmethod", "validator"]
[tool.bandit]
Expand Down Expand Up @@ -126,3 +127,6 @@ mock_use_standalone_module = true
[tool.coverage.run]
# source = []
omit = ["*/tests/*"]
[tool.pymarkdown]
plugins.md014.enabled = false
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ build-backend = "poetry.core.masonry.api"
bandit = { extras = ["toml"], version = "^1.7.5" }
black = "^23.7.0"
flake8 = "^6.0.0"
flake8-docstrings = "^1.7.0"
flake8-pydocstyle = "^0.2.2"
flake8-pyproject = "^1.2.3"
flake8-pytest-style = "^1.7.2"
flake8-type-checking = "^2.4.1"
Expand All @@ -65,6 +65,7 @@ pylint-pytest = "^1.1.2"
pep8-naming = "^0.13.3"
pre-commit = "^3.3.3"
pydocstyle = "^6.3.0"
pymarkdownlnt = "^0.9.12"
mypy = "^1.4.1"
tryceratops = "^2.3.2"

Expand Down Expand Up @@ -102,6 +103,7 @@ mypy = "mypy **/*.py"
flake8 = "flake8 **/*.py"
black = "black **/*.py"
try = "tryceratops **/*.py"
markdown = "pymarkdown scan **/*.md"
lint = ["black", "flake8", "mypy", "try", "pylint"]

"docs:publish" = "mkdocs gh-deploy"
Expand Down Expand Up @@ -162,3 +164,6 @@ mock_use_standalone_module = true
[tool.coverage.run]
# source = []
omit = ["*/tests/*"]

[tool.pymarkdown]
plugins.md014.enabled = false
17 changes: 11 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
annotated-types==0.5.0 ; python_version >= "3.9" and python_version < "4.0"
application-properties==0.8.1 ; python_version >= "3.9" and python_version < "4.0"
astroid==2.15.6 ; python_version >= "3.9" and python_version < "4.0"
babel==2.12.1 ; python_version >= "3.9" and python_version < "4.0"
bandit[toml]==1.7.5 ; python_version >= "3.9" and python_version < "4.0"
black==23.7.0 ; python_version >= "3.9" and python_version < "4.0"
certifi==2023.7.22 ; python_version >= "3.9" and python_version < "4.0"
cfgv==3.3.1 ; python_version >= "3.9" and python_version < "4.0"
cfgv==3.4.0 ; python_version >= "3.9" and python_version < "4.0"
charset-normalizer==3.2.0 ; python_version >= "3.9" and python_version < "4.0"
classify-imports==4.2.0 ; python_version >= "3.9" and python_version < "4.0"
click==8.1.6 ; python_version >= "3.9" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.9" and python_version < "4.0"
coverage[toml]==7.2.7 ; python_version >= "3.9" and python_version < "4.0"
columnar==1.4.1 ; python_version >= "3.9" and python_version < "4.0"
coverage[toml]==7.3.0 ; python_version >= "3.9" and python_version < "4.0"
csscompressor==0.9.5 ; python_version >= "3.9" and python_version < "4.0"
dill==0.3.7 ; python_version >= "3.9" and python_version < "4.0"
distlib==0.3.7 ; python_version >= "3.9" and python_version < "4.0"
exceptiongroup==1.1.2 ; python_version >= "3.9" and python_version < "3.11"
execnet==2.0.2 ; python_version >= "3.9" and python_version < "4.0"
faker==19.3.0 ; python_version >= "3.9" and python_version < "4.0"
filelock==3.12.2 ; python_version >= "3.9" and python_version < "4.0"
flake8-docstrings==1.7.0 ; python_version >= "3.9" and python_version < "4.0"
flake8-plugin-utils==1.3.3 ; python_version >= "3.9" and python_version < "4.0"
flake8-pydocstyle==0.2.2 ; python_version >= "3.9" and python_version < "4.0"
flake8-pyproject==1.2.3 ; python_version >= "3.9" and python_version < "4.0"
flake8-pytest-style==1.7.2 ; python_version >= "3.9" and python_version < "4.0"
flake8-type-checking==2.4.1 ; python_version >= "3.9" and python_version < "4.0"
Expand Down Expand Up @@ -52,7 +54,7 @@ mkdocs==1.5.2 ; python_version >= "3.9" and python_version < "4.0"
mkdocstrings==0.22.0 ; python_version >= "3.9" and python_version < "4.0"
mock==5.1.0 ; python_version >= "3.9" and python_version < "4.0"
mypy-extensions==1.0.0 ; python_version >= "3.9" and python_version < "4.0"
mypy==1.4.1 ; python_version >= "3.9" and python_version < "4.0"
mypy==1.5.0 ; python_version >= "3.9" and python_version < "4.0"
nodeenv==1.8.0 ; python_version >= "3.9" and python_version < "4.0"
packaging==23.1 ; python_version >= "3.9" and python_version < "4.0"
pastel==0.2.1 ; python_version >= "3.9" and python_version < "4.0"
Expand All @@ -73,6 +75,7 @@ pylint-plugin-utils==0.8.2 ; python_version >= "3.9" and python_version < "4.0"
pylint-pydantic==0.2.4 ; python_version >= "3.9" and python_version < "4.0"
pylint-pytest==1.1.2 ; python_version >= "3.9" and python_version < "4.0"
pylint==2.17.5 ; python_version >= "3.9" and python_version < "4.0"
pymarkdownlnt==0.9.12 ; python_version >= "3.9" and python_version < "4.0"
pymdown-extensions==10.1 ; python_version >= "3.9" and python_version < "4.0"
pytest-asyncio==0.21.1 ; python_version >= "3.9" and python_version < "4.0"
pytest-cov==4.1.0 ; python_version >= "3.9" and python_version < "4.0"
Expand All @@ -86,7 +89,7 @@ python-dateutil==2.8.2 ; python_version >= "3.9" and python_version < "4.0"
pytz==2023.3 ; python_version >= "3.9" and python_version < "4.0"
pyyaml-env-tag==0.1 ; python_version >= "3.9" and python_version < "4.0"
pyyaml==6.0.1 ; python_version >= "3.9" and python_version < "4.0"
regex==2023.6.3 ; python_version >= "3.9" and python_version < "4.0"
regex==2023.8.8 ; python_version >= "3.9" and python_version < "4.0"
requests==2.31.0 ; python_version >= "3.9" and python_version < "4.0"
rich==13.5.2 ; python_version >= "3.9" and python_version < "4.0"
rtoml==0.9.0 ; python_version >= "3.9" and python_version < "4.0"
Expand All @@ -100,11 +103,13 @@ termcolor==2.3.0 ; python_version >= "3.9" and python_version < "4.0"
toml==0.10.2 ; python_version >= "3.9" and python_version < "4.0"
tomli==2.0.1 ; python_version >= "3.9" and python_version < "4.0"
tomlkit==0.12.1 ; python_version >= "3.9" and python_version < "4.0"
toolz==0.12.0 ; python_version >= "3.9" and python_version < "4.0"
tryceratops==2.3.2 ; python_version >= "3.9" and python_version < "4.0"
typer[all]==0.9.0 ; python_version >= "3.9" and python_version < "4.0"
typing-extensions==4.7.1 ; python_version >= "3.9" and python_version < "4.0"
urllib3==2.0.4 ; python_version >= "3.9" and python_version < "4.0"
virtualenv==20.24.2 ; python_version >= "3.9" and python_version < "4.0"
virtualenv==20.24.3 ; python_version >= "3.9" and python_version < "4.0"
watchdog==3.0.0 ; python_version >= "3.9" and python_version < "4.0"
wcwidth==0.2.6 ; python_version >= "3.9" and python_version < "4.0"
wrapt==1.15.0 ; python_version >= "3.9" and python_version < "4.0"
zipp==3.16.2 ; python_version >= "3.9" and python_version < "3.10"

0 comments on commit c17f681

Please sign in to comment.