hugovk / pypi-tools

Command-line Python scripts to do things with PyPI
https://hugovk.github.io/pypi-tools
23 stars 2 forks source link

Add repo_checker.py #16

Closed hugovk closed 4 years ago

hugovk commented 4 years ago

Add a tool to clone repos of popular projects, and run a test command for each. Stops when found a problem.

The default command is flake8 --select YTT1 to find potential Python 3.10 problems with https://github.com/asottile/flake8-2020.

Run on top 10 projects, will stop if the test command has a non-zero exit:

python3 repo_checker.py --number 10

Same, but if there's already an existing directory for a repo, it won't test that one again:

python3 repo_checker.py --number 10 --skip-existing

Using a custom command, CLONE_DIR will be replaced with the cloned directory. Here, will do a git pull in that repo to update:

python3 repo_checker.py --number 10 --command "git -C CLONE_DIR pull"

Custom command, will run for all repos, even if dirs exist, but will skip dirs "foo" and "bar".

python3 repo_checker.py --number 10 -c "flake8 --select XYZ CLONE_DIR" --repos foo bar
hugovk commented 4 years ago

You're welcome!

repo_checker.py is something to run yourself from the command line, like the examples in https://github.com/hugovk/pypi-tools/pull/16#issue-364825811.

I've been using it like:

$ python3 repo_checker.py -s -n 360
# it skips existing dirs, and clones and checks new projects, and fails when it finds something
# I check the problem, maybe create a PR
$ python3 repo_checker.py -s -n 360
# continues from where it left off

test_repo_checker.py is to help test repo_checker.pyworks properly when developing it.

rec commented 4 years ago

Ah, sorry, I meant the .yml and .toml files! :-)

hugovk commented 4 years ago

:)

.pre-commit-config.yaml is config for https://pre-commit.com. You can either install it locally (pip install pre-commit globally, then pre-commit install in the repo) and it'll do some lint testing of the modified files when you commit them.

It's also used to run the lint tests on the CI:

https://github.com/hugovk/pypi-tools/blob/0ebdea36b7b6e3976c768b0605785a11ef59ae75/.travis.yml#L23


pyproject.toml is a config file for various tools, here for Black and isort linters.

It's becoming a new standard place for configuring things, see: