Skip to content

Commit

Permalink
Update readme, precommit config, and makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
nficano committed Jul 17, 2020
1 parent 8c59837 commit 5c83b18
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 193 deletions.
73 changes: 50 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,54 @@
- repo: https://github.com/pre-commit/pre-commit-hooks
sha: v0.9.5
repos:
- repo: 'https://github.com/pre-commit/pre-commit-hooks'
rev: v3.1.0
hooks:
- id: autopep8-wrapper
- id: check-ast
- id: check-case-conflict
- id: check-merge-conflict
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: flake8
- id: requirements-txt-fixer
- id: trailing-whitespace
- id: fix-encoding-pragma
- id: debug-statements
- repo: https://github.com/asottile/reorder_python_imports
sha: v0.3.5
- id: pretty-format-json
name: 'Pretty format JSON'
args:
- '--no-sort-keys'
- '--autofix'
- '--indent=2'
- id: trailing-whitespace
name: 'Fix trailing whitespace'
exclude: setup.cfg
- id: end-of-file-fixer
name: 'Fix missing EOF'
exclude: setup.cfg
- id: check-executables-have-shebangs
name: 'Check exeutables for shebangs'
- id: check-merge-conflict
name: 'Check for merge conflict fragments'
- id: check-case-conflict
name: 'Check for filesystem character case conflicts'
- id: detect-private-key
name: 'Check for cleartext private keys stored'
- id: check-json
name: 'Validate JSON'
- id: check-ast
name: 'Check Python abstract syntax tree'
- repo: 'https://github.com/asottile/reorder_python_imports'
rev: v1.8.0
hooks:
- id: reorder-python-imports
language_version: python3.7
- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
sha: v1.1.0
- id: reorder-python-imports
name: 'Reorder Python imports'
- repo: 'https://github.com/pre-commit/mirrors-autopep8'
rev: ''
hooks:
- id: python-safety-dependencies-check
- repo: https://github.com/asottile/add-trailing-comma
sha: v0.6.4
- id: autopep8
name: 'Pretty format Python'
args:
- '--in-place'
- '--aggressive'
- '--aggressive'
- '--experimental'
- '--remove-all-unused-imports'
- '--ignore-init-module-imports'
- '--remove-unused-variable'
- repo: https://github.com/psf/black
rev: stable
hooks:
- id: add-trailing-comma
- id: black
name: 'Ruthlessly format Python'
language_version: python3.7
args:
- '--line-length=79'
72 changes: 39 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,49 @@
dev:
pipenv install --dev

pipenv:
pip install pipenv
pipenv install --dev

deploy-patch: clean requirements bumpversion-patch upload clean

deploy-minor: clean requirements bumpversion-minor upload clean

deploy-major: clean requirements bumpversion-major upload clean

requirements:
pipenv_to_requirements

bumpversion-patch:
bumpversion patch
git push
git push --tags

bumpversion-minor:
bumpversion minor
git push
git push --tags

bumpversion-major:
bumpversion major
git push
git push --tags

upload:
python setup.py sdist bdist_wheel
twine upload dist/*

help:
@echo "clean - remove all build, test, coverage and Python artifacts"
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "install - install the package to the active Python's site-packages"

pipenv:
ci:
pip install pipenv
pipenv install --dev

test:
pipenv run flake8 pytube/
pipenv run flake8 tests/
pipenv run black pytube --check
pipenv run black tests --check
pipenv run mypy pytube
pipenv run pytest --cov-report term-missing --cov=pytube

ci: pipenv test
pipenv install --dev --skip-lock
pipenv run flake8
pipenv run pytest --cov-report term-missing --cov=humps

clean: clean-build clean-pyc

Expand All @@ -33,27 +60,6 @@ clean-pyc:
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
find . -name '.pytest_cache' -exec rm -fr {} +
find . -name '.mypy_cache' -exec rm -fr {} +

install: clean
python setup.py install

package: clean
pipenv run python setup.py sdist bdist_wheel

upload:
twine upload dist/*

tag:
git diff-index --quiet HEAD -- # checks for unstaged/uncomitted files
git tag "v`pipenv run python pytube/version.py`"
git push --tags

check-master:
if [[ `git rev-parse --abbrev-ref HEAD` != "master" ]]; then exit 1; fi

pull:
git pull

release: check-master pull clean test tag package upload
Loading

0 comments on commit 5c83b18

Please sign in to comment.