From 5ca003d77d373a9466642eaa0eb6e52f4c6dcc4c Mon Sep 17 00:00:00 2001 From: Alexei Andrushievich Date: Tue, 26 Jul 2022 15:23:00 +0300 Subject: [PATCH] Looks like partially ready for first public appearence --- .pre-commit-config.yaml | 23 ++++++++- MANIFEST.in | 3 ++ Makefile | 102 ++++++++++++++++++++++++++++++++-------- setup.cfg | 49 +++++++++---------- 4 files changed, 132 insertions(+), 45 deletions(-) create mode 100644 MANIFEST.in diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d3d6ce..8b7d5e0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -71,6 +71,27 @@ repos: entry: bash -c 'PYTHONPATH="\"${PYTHONPATH}\":\"${PWD}\"" mypy' types: ["python"] pass_filenames: false + - id: check-manifest + name: check-manifest + stages: [commit] + language: system + pass_filenames: false + entry: check-manifest + types: [python] + - id: pyroma + name: pyroma + stages: [commit] + language: system + pass_filenames: false + entry: pyroma -d . + types: [python] + - id: check-wheel-contents + name: check-wheel-contents + stages: [commit] + language: system + pass_filenames: false + entry: bash -c 'make build -B && check-wheel-contents dist' + types: [python] - id: "dotenv-linter" name: "dotenv-linter" entry: "dotenv-linter" @@ -86,7 +107,7 @@ repos: stages: ["commit"] types: ["rst"] - repo: "https://github.com/pre-commit/pre-commit-hooks" - rev: "v4.1.0" + rev: "v4.3.0" hooks: - id: "check-added-large-files" args: ["--maxkb=2048"] diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..5000cad --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include pre_commit_config_shellcheck.py +recursive-exclude tests *.py +recursive-exclude tests *.yaml diff --git a/Makefile b/Makefile index d085f84..10bada6 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,52 @@ .ONESHELL: -PHONY: install test check clean bumpversion help +PHONY: install tox test bumpversion build sign check check-build check-upload upload clean coveralls release help NAME ?= pre-commit-config-shellcheck -TRASH_DIRS ?= build .mypy_cache .pytest_cache __pycache__ htmlcov -TRASH_FILES ?= .coverage coverage.xml *.pid Pipfile.lock -ENVIRONMENT ?= dev +TEST_PYPI_URL ?= https://test.pypi.org/legacy/ +TRASH_DIRS ?= build dist *.egg-info .tox .mypy_cache .pytest_cache __pycache__ htmlcov +TRASH_FILES ?= .coverage +BUILD_TYPES ?= bdist_wheel sdist +VERSION ?= `python -c "import configparser; config = configparser.ConfigParser(); config.read('setup.cfg'); print(config['metadata']['version']);"` install: - python -m pip install .[$(ENVIRONMENT)];\ + python -m pip install .[test];\ + + +tox: + tox;\ test: - pytest -v tests --cov=pre_commit_config_shellcheck $(TESTS);\ + py.test -v tests --cov=pre_commit_config_shellcheck --color=yes --instafail $(TESTS);\ + + +bumpversion: + git tag -a $(VERSION) -m "v$(VERSION)";\ + +build: + python setup.py $(BUILD_TYPES);\ + + +sign: + for package in `ls dist`; do\ + gpg -a --detach-sign dist/$${package};\ + done;\ check: - pre-commit run --all-files;\ + bash -c 'NAME="$(NAME)" pre-commit run --all-files';\ + + +check-build: + twine check dist/*;\ + + +check-upload: + twine upload --skip-existing -s --repository-url $(TEST_PYPI_URL) -u __token__ -p $${TEST_TWINE_PASSWORD} dist/*;\ + + +upload: + twine upload --skip-existing -s dist/*;\ clean: @@ -27,21 +58,52 @@ clean: done;\ -bumpversion: - git tag -a $(VERSION) -m "v$(VERSION)";\ +coveralls: + coveralls;\ + + +release: + make clean && \ + make bumpversion && \ + git co master && \ + git merge dev && \ + git co dev && \ + git push --all && \ + git push --tags && \ + make build && \ + make sign && \ + make check-build && \ + make check-upload && \ + make upload && \ + make clean;\ help: @echo " help:" @echo " Show this help." - @echo " [LOCAL DEVELOPMENT]:" - @echo " install:" - @echo " Install python requirements." - @echo " test:" - @echo " Run tests, can specify tests with 'TESTS' variable." - @echo " check:" - @echo " Perform some code checks." - @echo " clean:" - @echo " Recursively delete useless autogenerated files and directories, directories and files lists can be overridden through 'TRASH_DIRS' and 'TRASH_FILES' variables." - @echo " bumpversion:" - @echo " Tag current code revision from version file." + @echo " install:" + @echo " Install requirements." + @echo " tox:" + @echo " Run tox." + @echo " test:" + @echo " Run tests, can specify tests with 'TESTS' variable." + @echo " bumpversion:" + @echo " Tag current code revision with version." + @echo " build:" + @echo " Build python packages, can specify packages types with 'BUILD_TYPES' variable." + @echo " sign:" + @echo " Sign python packages." + @echo " check:" + @echo " Perform some code checks." + @echo " check-build:" + @echo " Run twine checks." + @echo " check-upload:" + @echo " Upload package to test PyPi using twine." + @echo " upload:" + @echo " Upload package to PyPi using twine." + @echo " clean:" + @echo " Recursively delete useless autogenerated files and directories, directories and files lists can be overriden through 'TRASH_DIRS' and 'TRASH_FILES' variables." + @echo " coveralls:" + @echo " Upload coverage report to Coveralls." + @echo " release:" + @echo " Release code." diff --git a/setup.cfg b/setup.cfg index 4a0b9ec..ae8ed5f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,10 +2,10 @@ name = pre-commit-config-shellcheck version = 0.0.0 description = Tool for shellchecking entry points in pre-commit config. -python-requires >= 3.7 -icense-file = MIT-LICENSE +python_requires >= 3.7 +license_file = MIT-LICENSE author = Anadea -author-email = python-dev@d-cod.com +author_email = python-dev@d-cod.com url = https://github.com/anadea/pre-commit-config-shellcheck classifiers = Development Status :: 5 - Production/Stable @@ -18,8 +18,8 @@ classifiers = Programming Language :: Python :: 3.10 Topic :: Utilities license = MIT -long-description = file:README.rst -long-description-content-type = text/x-rst +long_description = file:README.rst +long_description_content_type = text/x-rst keywords = pre-commit,shellcheck,config,pre-commit-config,pre-commit-shellcheck [options] @@ -31,12 +31,12 @@ install_requires = pyyaml==6.0 [options.extras_require] -dev = +test = bandit==1.7.4 black==22.6.0 bpython==0.22.1 - check-manifest==0.47 - check-wheel-contents==0.3.3 + check-manifest==0.48 + check-wheel-contents==0.3.4 coverage==6.4.2 coveralls==3.3.1 darglint==1.8.1 @@ -46,7 +46,7 @@ dev = flake8-annotations-complexity==0.0.7 flake8-annotations-coverage==0.0.6 flake8-broken-line==0.4.0 - flake8-bugbear==22.4.25 + flake8-bugbear==22.7.1 flake8-builtins==1.5.3 flake8-coding==1.3.2 flake8-cognitive-complexity==0.1.0 @@ -66,31 +66,31 @@ dev = flake8-typing-imports==1.12.0 flake8-use-fstring==1.3 flake8-variables-names==0.0.5 - flake8==3.9.2 + flake8==4.0.1 interrogate==1.5.0 isort==5.10.1 - mypy==0.961 - pep8-naming==0.12.1 + mypy==0.971 + pep8-naming==0.13.1 pip-outdated==0.5.0 - pre-commit==2.17.0 - pre-commit-hooks==4.1.0 - pylint==2.11.1 - pyroma==3.2 + pre-commit==2.20.0 + pre-commit-hooks==4.3.0 + pylint==2.14.5 + pyroma==4.0 pytest-cov==3.0.0 pytest-extra-durations==0.1.3 pytest-mock==3.8.2 pytest-instafail==0.4.2 - pytest-sugar==0.9.4 + pytest-sugar==0.9.5 pytest-timer[termcolor]==0.0.11 - pytest==6.2.5 + pytest==7.1.2 removestar==1.3.1 rstcheck==6.0.0.post1 - tox-gh-actions==2.8.1 + tox-gh-actions==2.9.1 tox-pyenv==1.1.0 - tox==3.24.4 - twine==3.6.0 - types-PyYAML==6.0.10 - wheel==0.37.0 + tox==3.25.1 + twine==4.0.1 + types-PyYAML==6.0.11 + wheel==0.37.1 yesqa==1.3.0 [mypy] @@ -143,6 +143,7 @@ ignore = tests tests.* TODO + tests/fixtures/*.yaml [isort] @@ -162,7 +163,7 @@ use_parentheses = True virtual_env = $VIRTUAL_ENV [bandit] -exclude = /.direnv,/tests +exclude = /.direnv,/tests,/.tox tests = B101,B102,B103,B104,B105,B106,B107,B108,B110,B112,B201,B301,B302,B303,B304,B305,B306,B307,B308,B309,B310,B311,B312,B313,B314,B315,B316,B317,B318,B319,B320,B321,B323,B324,B325,B401,B402,B403,B404,B405,B406,B407,B408,B409,B410,B411,B412,B413,B501,B502,B503,B504,B505,B506,B507,B601,B602,B603,B604,B605,B606,B607,B608,B609,B610,B611,B701,B702,B703