Skip to content

Commit

Permalink
Migrate to pipenv and direnv, added makefile for deploys
Browse files Browse the repository at this point in the history
  • Loading branch information
nficano committed Mar 29, 2020
1 parent aad2dad commit 6b238a4
Show file tree
Hide file tree
Showing 7 changed files with 659 additions and 58 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
layout pipenv
81 changes: 58 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,62 @@
- repo: https://github.com/pre-commit/pre-commit-hooks
sha: v0.9.5
repos:
- repo: 'https://github.com/pre-commit/pre-commit-hooks'
rev: v2.4.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: flake8
additional_dependencies:
- flake8-docstrings
- flake8-mutable
- flake8-type-annotations
- flake8-eradicate
- flake8-bugbear
name: 'Check for Python style guideline violations'
- 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.6
- 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: v1.4.4
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'
64 changes: 41 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,37 +1,55 @@
help:
@echo "clean - remove all build, test, coverage and Python artifacts"
@echo "lint - check style with flake8"
@echo "release - package and upload a release"
@echo "install - install the package to the active Python's site-packages"
dev:
pipenv install --dev

clean: clean-build clean-pyc clean-merge
deploy-patch: requirements bumpversion-patch sdist bdist wheels upload clean

deploy-minor: requirements bumpversion-minor sdist bdist wheels upload clean

deploy-major: requirements bumpversion-major sdist bdist wheels upload clean

requirements:
pipenv_to_requirements

sdist: requirements
python setup.py sdist

bdist: requirements
python setup.py bdist

wheels: requirements
python setup.py bdist_wheel

clean: clean-build clean-pyc

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 bdist_wheel upload

clean-build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
find . -name '*.DS_Store' -exec rm -f {} +

clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

clean-merge:
find . -name '*.orig' -exec rm -f {} +

lint:
flake8 python-lambda tests

release: clean
python setup.py sdist upload
python setup.py bdist_wheel upload

install: clean
python setup.py install

test:
py.test tests/ --cov aws_lambda --cov-report term-missing

find . -name '.pytest_cache' -exec rm -fr {} +
30 changes: 30 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
twine = "*"
ipython = "*"
flake8 = "*"
black = "*"
bumpversion = "*"
pipenv-to-requirements = "*"
wheel = "*"

[packages]
boto3 = "==1.4.4"
botocore = "==1.5.62"
click = "==6.6"
docutils = "==0.12"
jmespath = "==0.9.0"
pyaml = "==15.8.2"
python-dateutil = "==2.5.3"
six = "==1.10.0"
PyYAML = "==5.1"

[requires]
python_version = "3.8"

[pipenv]
allow_prereleases = true
Loading

0 comments on commit 6b238a4

Please sign in to comment.