Skip to content

Commit

Permalink
Migrated some invoke tasks to python-tools-scripts
Browse files Browse the repository at this point in the history
* `tasks/docs.py` -> `tools/precommit/docs.py`
* `tasks/docstrings.py` -> `tools/precommit/docstrings.py`

Refs saltstack#64374

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
  • Loading branch information
s0undt3ch committed Nov 22, 2023
1 parent e0f6bb5 commit ee29f06
Show file tree
Hide file tree
Showing 6 changed files with 259 additions and 284 deletions.
113 changes: 48 additions & 65 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ repos:
- pre-commit
- changelog
- pre-commit-checks
additional_dependencies:
- boto3==1.21.46
- pyyaml==6.0.1
- jinja2==3.1.2
- packaging==23.0
- virustotal3==1.0.8

- id: tools
alias: generate-workflows
name: Generate GitHub Workflow Templates
Expand All @@ -70,12 +65,7 @@ repos:
- pre-commit
- workflows
- generate-workflows
additional_dependencies:
- boto3==1.21.46
- pyyaml==6.0.1
- jinja2==3.1.2
- packaging==23.0
- virustotal3==1.0.8

- id: tools
alias: actionlint
name: Lint GitHub Actions Workflows
Expand All @@ -86,18 +76,51 @@ repos:
- pre-commit
- workflows
- actionlint
additional_dependencies:
- boto3==1.21.46
- pyyaml==6.0.1
- jinja2==3.1.2
- packaging==23.0
- virustotal3==1.0.8

- id: tools
alias: check-docs
name: Check Docs
files: ^(salt/.*\.py|doc/ref/.*\.rst)$
args:
- pre-commit
- docs
- check

- id: tools
alias: check-docstrings
name: Check docstrings
files: salt/.*\.py$
exclude: >
(?x)^(
templates/.*|
salt/ext/.*|
)$
args:
- pre-commit
- docstrings
- check

- id: tools
alias: check-known-missing-docstrings
name: Check Known Missing Docstrings
stages: [manual]
files: salt/.*\.py$
exclude: >
(?x)^(
templates/.*|
salt/ext/.*|
)$
args:
- pre-commit
- docstrings
- check

# ----- Packaging Requirements ------------------------------------------------------------------------------------>

- repo: https://github.com/saltstack/pip-tools-compile-impersonate
rev: "4.8"
hooks:

# ----- Packaging Requirements ------------------------------------------------------------------------------------>
- id: pip-tools-compile
alias: compile-pkg-linux-3.7-zmq-requirements
name: Linux Packaging Py3.7 ZeroMQ Requirements
Expand Down Expand Up @@ -1205,24 +1228,6 @@ repos:
# <---- Security ---------------------------------------------------------------------------------------------------

# ----- Pre-Commit ------------------------------------------------------------------------------------------------>
- repo: https://github.com/saltstack/invoke-pre-commit
rev: v1.9.0
hooks:
- id: invoke
alias: check-docs
name: Check Docs
files: ^(salt/.*\.py|doc/ref/.*\.rst)$
args:
- docs.check
additional_dependencies:
- blessings==1.7
- pyyaml==6.0.1
- distro==1.7.0
- jinja2==3.0.3
- msgpack==1.0.3
- packaging
- looseversion

- repo: https://github.com/saltstack/invoke-pre-commit
rev: v1.9.0
hooks:
Expand All @@ -1242,9 +1247,6 @@ repos:
- packaging
- looseversion

- repo: https://github.com/saltstack/invoke-pre-commit
rev: v1.9.0
hooks:
- id: invoke
alias: loader-check-virtual
name: Check loader modules __virtual__
Expand All @@ -1265,29 +1267,6 @@ repos:
- packaging
- looseversion

- repo: https://github.com/saltstack/invoke-pre-commit
rev: v1.9.0
hooks:
- id: invoke
alias: check-docstrings
name: Check docstrings
files: salt/.*\.py$
exclude: >
(?x)^(
templates/.*|
salt/ext/.*|
)$
args:
- docstrings.check
additional_dependencies:
- blessings==1.7
- pyyaml==6.0.1
- distro==1.7.0
- jinja2==3.0.3
- msgpack==1.0.3
- packaging
- looseversion

- repo: https://github.com/saltstack/invoke-pre-commit
rev: v1.9.0
hooks:
Expand All @@ -1314,13 +1293,17 @@ repos:
- looseversion

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.0.0
rev: v1.3.0
hooks:
- id: mypy
alias: mypy-tools
name: Run mypy against tools
files: ^tools/.*\.py$
#args: [--strict]
exclude: >
(?x)^(
templates/.*|
salt/.*|
)$
additional_dependencies:
- attrs
- rich
Expand Down
4 changes: 4 additions & 0 deletions changelog/64374.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Migrated some [`invoke`](https://www.pyinvoke.org/) tasks to [`python-tools-scripts`](https://github.com/s0undt3ch/python-tools-scripts).

* `tasks/docs.py` -> `tools/precommit/docs.py`
* `tasks/docstrings.py` -> `tools/precommit/docstrings.py`
14 changes: 13 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,22 @@ owner = root
group = root

[mypy]
packages = tools
exclude = (?x)(
salt
| tests
).*\.py
implicit_optional = True
show_error_codes = True
warn_return_any = True
warn_unused_configs = True

[mypy.tools]
[mypy-tools.*]
ignore_missing_imports = True

[mypy-tools.precommit.docstrings]
follow_imports = silent

[mypy-salt.*]
follow_imports = silent
ignore_missing_imports = True
4 changes: 3 additions & 1 deletion tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@
ptscripts.register_tools_module("tools.precommit")
ptscripts.register_tools_module("tools.precommit.changelog")
ptscripts.register_tools_module("tools.precommit.workflows")
ptscripts.register_tools_module("tools.precommit.docs")
ptscripts.register_tools_module("tools.precommit.docstrings")
ptscripts.register_tools_module("tools.release", venv_config=RELEASE_VENV_CONFIG)
ptscripts.register_tools_module("tools.testsuite")
ptscripts.register_tools_module("tools.testsuite.download")
ptscripts.register_tools_module("tools.release", venv_config=RELEASE_VENV_CONFIG)
ptscripts.register_tools_module("tools.vm")

for name in ("boto3", "botocore", "urllib3"):
Expand Down
Loading

0 comments on commit ee29f06

Please sign in to comment.