Skip to content

Commit 6b238a4

Browse files
committed
Migrate to pipenv and direnv, added makefile for deploys
1 parent aad2dad commit 6b238a4

File tree

7 files changed

+659
-58
lines changed

7 files changed

+659
-58
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
layout pipenv

.pre-commit-config.yaml

Lines changed: 58 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,62 @@
1-
- repo: https://github.com/pre-commit/pre-commit-hooks
2-
sha: v0.9.5
1+
repos:
2+
- repo: 'https://github.com/pre-commit/pre-commit-hooks'
3+
rev: v2.4.0
34
hooks:
4-
- id: autopep8-wrapper
5-
- id: check-ast
6-
- id: check-case-conflict
7-
- id: check-merge-conflict
8-
- id: double-quote-string-fixer
9-
- id: end-of-file-fixer
10-
- id: flake8
11-
- id: requirements-txt-fixer
12-
- id: trailing-whitespace
13-
- id: fix-encoding-pragma
14-
- id: debug-statements
15-
- repo: https://github.com/asottile/reorder_python_imports
16-
sha: v0.3.5
5+
- id: pretty-format-json
6+
name: 'Pretty format JSON'
7+
args:
8+
- '--no-sort-keys'
9+
- '--autofix'
10+
- '--indent=2'
11+
- id: trailing-whitespace
12+
name: 'Fix trailing whitespace'
13+
exclude: setup.cfg
14+
- id: end-of-file-fixer
15+
name: 'Fix missing EOF'
16+
exclude: setup.cfg
17+
- id: check-executables-have-shebangs
18+
name: 'Check exeutables for shebangs'
19+
- id: check-merge-conflict
20+
name: 'Check for merge conflict fragments'
21+
- id: check-case-conflict
22+
name: 'Check for filesystem character case conflicts'
23+
- id: detect-private-key
24+
name: 'Check for cleartext private keys stored'
25+
- id: flake8
26+
additional_dependencies:
27+
- flake8-docstrings
28+
- flake8-mutable
29+
- flake8-type-annotations
30+
- flake8-eradicate
31+
- flake8-bugbear
32+
name: 'Check for Python style guideline violations'
33+
- id: check-json
34+
name: 'Validate JSON'
35+
- id: check-ast
36+
name: 'Check Python abstract syntax tree'
37+
- repo: 'https://github.com/asottile/reorder_python_imports'
38+
rev: v1.8.0
1739
hooks:
18-
- id: reorder-python-imports
19-
language_version: python3.6
20-
- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
21-
sha: v1.1.0
40+
- id: reorder-python-imports
41+
name: 'Reorder Python imports'
42+
- repo: 'https://github.com/pre-commit/mirrors-autopep8'
43+
rev: v1.4.4
2244
hooks:
23-
- id: python-safety-dependencies-check
24-
- repo: https://github.com/asottile/add-trailing-comma
25-
sha: v0.6.4
45+
- id: autopep8
46+
name: 'Pretty format Python'
47+
args:
48+
- '--in-place'
49+
- '--aggressive'
50+
- '--aggressive'
51+
- '--experimental'
52+
- '--remove-all-unused-imports'
53+
- '--ignore-init-module-imports'
54+
- '--remove-unused-variable'
55+
- repo: https://github.com/psf/black
56+
rev: stable
2657
hooks:
27-
- id: add-trailing-comma
58+
- id: black
59+
name: 'Ruthlessly format Python'
60+
language_version: python3.7
61+
args:
62+
- '--line-length=79'

Makefile

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,55 @@
1-
help:
2-
@echo "clean - remove all build, test, coverage and Python artifacts"
3-
@echo "lint - check style with flake8"
4-
@echo "release - package and upload a release"
5-
@echo "install - install the package to the active Python's site-packages"
1+
dev:
2+
pipenv install --dev
63

7-
clean: clean-build clean-pyc clean-merge
4+
deploy-patch: requirements bumpversion-patch sdist bdist wheels upload clean
5+
6+
deploy-minor: requirements bumpversion-minor sdist bdist wheels upload clean
7+
8+
deploy-major: requirements bumpversion-major sdist bdist wheels upload clean
9+
10+
requirements:
11+
pipenv_to_requirements
12+
13+
sdist: requirements
14+
python setup.py sdist
15+
16+
bdist: requirements
17+
python setup.py bdist
18+
19+
wheels: requirements
20+
python setup.py bdist_wheel
21+
22+
clean: clean-build clean-pyc
23+
24+
bumpversion-patch:
25+
bumpversion patch
26+
git push
27+
git push --tags
28+
29+
bumpversion-minor:
30+
bumpversion minor
31+
git push
32+
git push --tags
33+
34+
bumpversion-major:
35+
bumpversion major
36+
git push
37+
git push --tags
38+
39+
upload:
40+
python setup.py sdist bdist bdist_wheel upload
841

942
clean-build:
1043
rm -fr build/
1144
rm -fr dist/
1245
rm -fr .eggs/
1346
find . -name '*.egg-info' -exec rm -fr {} +
1447
find . -name '*.egg' -exec rm -f {} +
48+
find . -name '*.DS_Store' -exec rm -f {} +
1549

1650
clean-pyc:
1751
find . -name '*.pyc' -exec rm -f {} +
1852
find . -name '*.pyo' -exec rm -f {} +
1953
find . -name '*~' -exec rm -f {} +
2054
find . -name '__pycache__' -exec rm -fr {} +
21-
22-
clean-merge:
23-
find . -name '*.orig' -exec rm -f {} +
24-
25-
lint:
26-
flake8 python-lambda tests
27-
28-
release: clean
29-
python setup.py sdist upload
30-
python setup.py bdist_wheel upload
31-
32-
install: clean
33-
python setup.py install
34-
35-
test:
36-
py.test tests/ --cov aws_lambda --cov-report term-missing
37-
55+
find . -name '.pytest_cache' -exec rm -fr {} +

Pipfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[[source]]
2+
name = "pypi"
3+
url = "https://pypi.org/simple"
4+
verify_ssl = true
5+
6+
[dev-packages]
7+
twine = "*"
8+
ipython = "*"
9+
flake8 = "*"
10+
black = "*"
11+
bumpversion = "*"
12+
pipenv-to-requirements = "*"
13+
wheel = "*"
14+
15+
[packages]
16+
boto3 = "==1.4.4"
17+
botocore = "==1.5.62"
18+
click = "==6.6"
19+
docutils = "==0.12"
20+
jmespath = "==0.9.0"
21+
pyaml = "==15.8.2"
22+
python-dateutil = "==2.5.3"
23+
six = "==1.10.0"
24+
PyYAML = "==5.1"
25+
26+
[requires]
27+
python_version = "3.8"
28+
29+
[pipenv]
30+
allow_prereleases = true

0 commit comments

Comments
 (0)