Skip to content

Commit

Permalink
Integrate gh-pre tool in mk
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Jun 18, 2024
1 parent 7d5a38e commit c73f0f5
Show file tree
Hide file tree
Showing 16 changed files with 350 additions and 26 deletions.
4 changes: 1 addition & 3 deletions .config/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
coverage==7.5.3
cryptography==42.0.8
cssselect2==0.7.0
defusedxml==0.7.1
diskcache==5.6.3
Expand All @@ -35,7 +34,6 @@ iniconfig==2.0.0
jaraco-classes==3.4.0
jaraco-context==5.3.0
jaraco-functools==4.0.1
jeepney==0.8.0
jinja2==3.1.4
keyring==25.2.1
markdown==3.6
Expand Down Expand Up @@ -79,7 +77,6 @@ requests==2.32.3
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==13.7.1
secretstorage==3.3.3
shellingham==1.5.4
six==1.16.0
smmap==5.0.1
Expand All @@ -90,6 +87,7 @@ tomli==2.0.1 ; python_version < "3.11"
tox==4.15.1
twine==5.1.0
typer==0.12.3
typer-config==1.4.0
typing-extensions==4.12.2
urllib3==2.2.2
virtualenv==20.26.2
Expand Down
4 changes: 4 additions & 0 deletions .config/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ PYTHONPYCACHEPREFIX
REQPASS
Sbarnea
Sorin
autohide
autorefs
basepython
cairosvg
cidrblock
clib
codenotify
codespell
Expand Down Expand Up @@ -59,9 +61,11 @@ showconfig
showlocals
ssbarnea
superfences
tablerender
taskfile
taskfiles
testenv
timeago
toxenv
toxinidir
typer
Expand Down
2 changes: 2 additions & 0 deletions .config/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ gitpython>=3.1.26
packaging>=22 # pytest, tox, build
pip>=21.0.1 # py_package
pluggy>=1.5.0 # typer and pytest indirect
pyyaml>=5.1
rich>=10.11.0 # typer indirect
setuptools # py_package due to running setup.py
shellingham>=1.5.4
subprocess-tee>=0.4.1
tomli>=2.0.1 ; python_version < "3.11" # tox
twine>=3.4.1 # py_package
typer-config>=1.4.0
typer>=0.12.2 # completion tests will fail with older
6 changes: 3 additions & 3 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ The only supported version is the latest release.

## Reporting a Vulnerability

Use [github reporting](https://github.com/pycontribs/mk/security) if you
found any security vulnerability that is better to not have a public bug raised
right away.
Use [github reporting](https://github.com/pycontribs/mk/security) if you found
any security vulnerability that is better to not have a public bug raised right
away.
2 changes: 2 additions & 0 deletions .github/lower-constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ gitpython==3.1.26
packaging==22
pip==23.2 # py_package (before installation might fail, including with tox)
pluggy==1.5.0
pyyaml==5.1
rich==10.11.0 # typer indirect
setuptools # py_package due to running setup.py
shellingham==1.5.4
subprocess-tee==0.4.1
tomli >= 2.0.1 ; python_version < "3.11" # tox v4
twine==3.4.1 # py_package
typer-config==1.4.0
typer==0.12.2
2 changes: 1 addition & 1 deletion .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
env:
# Number of expected test passes, safety measure for accidental skip of
# tests. Update value if you add/remove tests.
PYTEST_REQPASS: 7
PYTEST_REQPASS: 8
steps:
- uses: actions/checkout@v4
with:
Expand Down
8 changes: 5 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ repos:
args:
- --fix
- --exit-non-zero-on-fix
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
- repo: https://github.com/pycontribs/mirrors-prettier
rev: v3.3.2
hooks:
- id: prettier
always_run: true
Expand Down Expand Up @@ -76,19 +76,21 @@ repos:
- packaging
- rich
- subprocess-tee
- typer-config
- typer>=0.12.2
- repo: https://github.com/pycqa/pylint
rev: v3.2.3
hooks:
- id: pylint
additional_dependencies:
- gitpython
- click-help-colors
- diskcache
- gitpython
- importlib-metadata
- pytest
- rich
- subprocess-tee
- typer-config
- typer>=0.12.2
- repo: https://github.com/jazzband/pip-tools
rev: 7.4.1
Expand Down
21 changes: 21 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
proseWrap: always
jsonRecursiveSort: true # prettier-plugin-sort-json
tabWidth: 2
useTabs: false
overrides:
- files:
- "*.md"
options:
# compatibility with markdownlint
proseWrap: always
printWidth: 80
- files:
- "*.yaml"
- "*.yml"
options:
# compatibility with yamllint
proseWrap: preserve
# https://github.com/prettier/prettier/issues/15141
# plugins:
# - prettier-plugin-sort-json
14 changes: 7 additions & 7 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Documentation of mk tool

`mk` is a CLI tool that aims to ease contribution and maintenance for projects
by hiding repository implementation details from the casual contributor. With it,
you can contribute without having to know all the build and testing tools that
the project team already uses, which often have strange requirements.
by hiding repository implementation details from the casual contributor. With
it, you can contribute without having to know all the build and testing tools
that the project team already uses, which often have strange requirements.

![mk-command-line-screenshot](images/mk-social-preview.png)

Expand All @@ -22,8 +22,8 @@ repository and expose their commands.
`mk` is inspired by tools such [make][make], [waf][waf], [taskfile][taskfile],
[tox][tox], [nox][nox], [npm][npm], [yarn][yarn] and [pre-commit][pre-commit],
but **it does not aim to replace them**. Instead, it aims to provide a unified
interface for calling them that is friendly even for those that never used
these tools.
interface for calling them that is friendly even for those that never used these
tools.

## Installation

Expand Down Expand Up @@ -102,8 +102,8 @@ status or that the testing did not leave untracked files.
unknown. (#20)
- Configuration file where additional actions can be added. (#21)
- Dependencies between commands. While some tools support dependencies, many do
not. You should be able to declare that a specific command will run only
after another one already passed. (#22)
not. You should be able to declare that a specific command will run only after
another one already passed. (#22)
- Ability to generate CI/CD pipelines so the user would spend less time writing
non-portable configurations. (#23)

Expand Down
77 changes: 77 additions & 0 deletions docs/multirepo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Multi-repo actions

Since June 2024, `mk` project adopted the multi-repository commands from [pre]
project. The list of repositories is loaded from `~/.config/mk/mk.yml` that has
a format like below:

```yaml title="~/.config/mk/mk.yml"
repos:
gh_org/gh_repo1: {}
gh_org/gh_repo2: {}
```
You can use a symlink to store this file in a different location.
This feature is enabled only when all the below requirements are met:
- [gh] command is installed
- The config file is present on on disk
<!-- markdownlint-disable MD046 -->
!!! note
This feature is experimental and how it works might change between
each new release, including command names and configuration file format.
You are welcome to give your feedback about how we can make it more useful
and flexible for most people.
## PRs
This command lists non-draft open pull requests on all repositories, listed by
their age, with PR numbers being clickable hyperlinks.
```bash
$ mk prs
ansible/tox-ansible 28 minutes ago Exclude *-py3.10-dev. #336
ansible/vscode-ansible 2 hours ago Update the segment s #1375
ansible-community/molecule-plugins 16 hours ago [pre-commit.ci] pre-c #238
ansible/ansible-content-actions 2 days ago Install tox-ansible #14
ansible/vscode-ansible 3 days ago Bump @types/vscode f #1351
```

## Drafts

This command lists draft releases on all your repositories, so you would know
which projects need to be released next.

```bash
$ mk drafts
🟢 ansible/ansible-compat has no draft release.
🟢 ansible/ansible-creator has an empty draft release.
🟠 ansible/ansible-dev-environment draft release v24.4.4 created 35 days ago:

## Bugfixes
- Add some tests (#160) @cidrblock

🟠 ansible/ansible-dev-tools draft release v24.6.0 created 27 days ago:

## Enhancements
- Bump tox-ansible from 24.6.0 to 24.6.14 in /.config (#267)
- Encapsulate community-ansible-dev-tools container building (#255) @ssbarnea
- Add lock extra to allow reproducible installation (#254) @ssbarnea
```
## Alerts
This command displays open security alerts on your repositories.
```bash
$ mk alerts
https://github.com/ansible/ansible-dev-tools/security/dependabot/18
https://github.com/ansible/ansible-lint/security/dependabot/36
https://github.com/ansible/vscode-ansible/security/dependabot/28
```
[pre]: https://github.com/pycontribs/gh-pre
[gh]: https://cli.github.com/
30 changes: 23 additions & 7 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ site_name: mk tool documentation
site_url: https://mk.readthedocs.io/
repo_url: https://github.com/pycontribs/mk
edit_uri: blob/main/docs/
copyright: Copyright © 2021-2023 Sorin Sbarnea
copyright: Copyright © Sorin Sbarnea
docs_dir: docs
strict: true

Expand All @@ -17,13 +17,27 @@ theme:
favicon: images/favicon.ico
features:
- announce.dismiss
- content.code.copy
- content.action.edit
- content.action.view
- content.code.annotate
- content.code.copy
- content.tabs.link
- content.tooltips
- header.autohide
- navigation.expand
- navigation.sections
- navigation.instant
- navigation.footer
- navigation.indexes
- navigation.instant
- navigation.path
- navigation.prune
- navigation.sections
- navigation.tabs
- navigation.tabs.sticky
- navigation.top
- navigation.tracking
- search.highlight
- search.share
- search.suggest
- toc.integrate
palette:
# https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/#primary-color
Expand Down Expand Up @@ -60,10 +74,12 @@ plugins:
- autorefs
- markdown-exec
- search
- social
- tags
- material/social
- material/tags
# https://github.com/manuzhang/mkdocs-htmlproofer-plugin
- htmlproofer
- htmlproofer:
raise_error_excludes:
404: ["https://github.com/*/security/*"]

markdown_extensions:
- admonition
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ keywords = ["mk"]

[project.scripts]
mk = "mk.__main__:cli"
pre = "mk.pre:app"

[project.entry-points."mk_tools"]
ansible = "mk.tools.ansible:AnsibleTool"
Expand All @@ -52,6 +53,7 @@ shell = "mk.tools.shell:ShellTool"
taskfile = "mk.tools.taskfile:TaskfileTool"
tox = "mk.tools.tox:ToxTool"
nox = "mk.tools.nox:NoxTool"
pre = "mk.tools.pre:PreTool"

[project.urls]
homepage = "https://github.com/pycontribs/mk"
Expand Down Expand Up @@ -140,10 +142,10 @@ lint.ignore = [
]
lint.select = ["ALL"]

[tool.ruff.flake8-pytest-style]
[tool.ruff.lint.flake8-pytest-style]
parametrize-values-type = "tuple"

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

[tool.ruff.lint.per-file-ignores]
Expand Down
Loading

0 comments on commit c73f0f5

Please sign in to comment.