Skip to content

Commit d910763

Browse files
committed
init
0 parents  commit d910763

17 files changed

+1357
-0
lines changed

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[Makefile]
12+
indent_style = tab
13+
indent_size = 4
14+
end_of_line = lf
15+
charset = utf-8
16+
trim_trailing_whitespace = true
17+
insert_final_newline = true

.gitattributes

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Basic .gitattributes for a python repo.
2+
3+
# Source files
4+
# ============
5+
*.pxd text
6+
*.py text
7+
*.py3 text
8+
*.pyw text
9+
*.pyx text
10+
11+
# Binary files
12+
# ============
13+
*.db binary
14+
*.p binary
15+
*.pkl binary
16+
*.pyc binary
17+
*.pyd binary
18+
*.pyo binary
19+
20+
# Note: .db, .p, and .pkl files are associated
21+
# with the python modules ``pickle``, ``dbm.*``,
22+
# ``shelve``, ``marshal``, ``anydbm``, & ``bsddb``
23+
# (among others).

.gitignore

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
MANIFEST
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
.hypothesis/
48+
.pytest_cache/
49+
50+
# Translations
51+
*.mo
52+
*.pot
53+
54+
# Django stuff:
55+
*.log
56+
local_settings.py
57+
db.sqlite3
58+
59+
# Flask stuff:
60+
instance/
61+
.webassets-cache
62+
63+
# Scrapy stuff:
64+
.scrapy
65+
66+
# Sphinx documentation
67+
docs/_build/
68+
69+
# PyBuilder
70+
target/
71+
72+
# Jupyter Notebook
73+
.ipynb_checkpoints
74+
75+
# pyenv
76+
.python-version
77+
78+
# celery beat schedule file
79+
celerybeat-schedule
80+
81+
# SageMath parsed files
82+
*.sage.py
83+
84+
# Environments
85+
.env
86+
.venv
87+
env/
88+
venv/
89+
ENV/
90+
env.bak/
91+
venv.bak/
92+
93+
# Spyder project settings
94+
.spyderproject
95+
.spyproject
96+
97+
# Rope project settings
98+
.ropeproject
99+
100+
# mkdocs documentation
101+
/site
102+
103+
# mypy
104+
.mypy_cache/
105+
106+
# line_profiler
107+
*.prof
108+
*.lprof
109+
110+
# memory_profiler
111+
mprofile*
112+
113+
# node deps
114+
node_modules
115+
npm*.log
116+
yarn*.log
117+

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: python
2+
python:
3+
- "2.7"
4+
- "3.6"
5+
install: make install-ci
6+
script: make test-ci
7+
notifications:
8+
email: false

MIT-LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2019 Jonas Grimfelt <[email protected]>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

Makefile

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
2+
# =========================================
3+
# meta
4+
# --------------------------------------
5+
6+
NAME := "mybad"
7+
BRANCH := $(shell git for-each-ref --format='%(objectname) %(refname:short)' refs/heads | awk "/^$$(git rev-parse HEAD)/ {print \$$2}")
8+
HASH := $(shell git rev-parse HEAD)
9+
DATETIME := $(shell date | sed 's/ /./g')
10+
11+
12+
# =========================================
13+
# default
14+
# --------------------------------------
15+
16+
all: test
17+
18+
19+
# =========================================
20+
# clean
21+
# --------------------------------------
22+
23+
.PHONY: clean
24+
clean:
25+
CLEAR_PATTERNS='*.pyc __pycache__ build dist *.egg-info .eggs .tox'; \
26+
for PATTERN in $$CLEAR_PATTERNS; do \
27+
echo "rm -rf \$$(find $$PWD -name $$PATTERN)"; \
28+
rm -rf $$(find $$PWD -name $$PATTERN); \
29+
done
30+
31+
32+
# =========================================
33+
# install (pip)
34+
# --------------------------------------
35+
36+
.PHONY: install
37+
install:
38+
PYTHON_USER_FLAG=$(shell python -c "import sys; print('' if hasattr(sys, 'real_prefix') or hasattr(sys, 'base_prefix') else '--user')") && \
39+
pip install $(PYTHON_USER_FLAG) -r requirements.txt
40+
41+
.PHONY: install-ci
42+
install-ci:
43+
PYTHON_USER_FLAG=$(shell python -c "import sys; print('' if hasattr(sys, 'real_prefix') or hasattr(sys, 'base_prefix') else '--user')") && \
44+
pip install $(PYTHON_USER_FLAG) -U setuptools setuptools-git tox tox-travis && \
45+
pip install $(PYTHON_USER_FLAG) -r requirements.txt
46+
47+
48+
# =========================================
49+
# build + release (pip)
50+
# --------------------------------------
51+
52+
.PHONY: build
53+
build:
54+
rm -rf ./dist && \
55+
PYTHON_USER_FLAG=$(shell python -c "import sys; print('' if hasattr(sys, 'real_prefix') or hasattr(sys, 'base_prefix') else '--user')") && \
56+
python -m pip install $(PYTHON_USER_FLAG) --upgrade setuptools wheel && \
57+
python setup.py sdist bdist_wheel
58+
59+
.PHONY: dist
60+
dist: build
61+
python -m pip install $(PYTHON_USER_FLAG) --upgrade twine && \
62+
twine upload dist/*
63+
64+
.PHONY: dist-dev
65+
dist-dev: build
66+
python -m pip install $(PYTHON_USER_FLAG) --upgrade twine && \
67+
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
68+
69+
70+
# =========================================
71+
# test
72+
# --------------------------------------
73+
74+
.PHONY: test
75+
test: test-python2 test-python3
76+
77+
test-python2: clean env2
78+
eval "$$(pyenv init -)" && \
79+
eval "$$(pyenv virtualenv-init -)" && \
80+
pyenv activate $(NAME)-python2 && \
81+
python ./$(NAME)/tests
82+
83+
test-python3: clean env3
84+
eval "$$(pyenv init -)" && \
85+
eval "$$(pyenv virtualenv-init -)" && \
86+
pyenv activate $(NAME)-python3 && \
87+
python ./$(NAME)/tests
88+
89+
.PHONY: test-tox
90+
test-tox:
91+
tox
92+
93+
.PHONY: test-ci
94+
test-ci: test-tox
95+
96+
.PHONY: testimport
97+
testimport:
98+
pip uninstall -y $(NAME) && \
99+
pip install -U . && \
100+
python -c "import $(NAME); print('$(NAME)', $(NAME))" && \
101+
echo "OK"
102+
103+
104+
# =========================================
105+
# environment (pyenv)
106+
# --------------------------------------
107+
108+
.PHONY: env-install
109+
env-install:
110+
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
111+
112+
.PHONY: env-install-osx
113+
env-install-osx:
114+
brew install pyenv pyenv-virtualenv
115+
116+
.PHONY: env-install-linux
117+
env-install-linux:
118+
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
119+
120+
.PHONY: env-create
121+
env-create: env-create-python2 env-create-python3
122+
123+
.PHONY: env-create-python2
124+
env-create-python2:
125+
eval "$$(pyenv init -)" && \
126+
eval "$$(pyenv virtualenv-init -)" && \
127+
pyenv virtualenv -f $(PYTHON_2_VERSION) $(NAME)-python2 && \
128+
pyenv activate $(NAME)-python2 && \
129+
pip install --upgrade pip && \
130+
pip install -U -r requirements.txt && \
131+
pyenv versions | grep --color=always $(NAME)-python
132+
133+
.PHONY: env-create-python3
134+
env-create-python3:
135+
eval "$$(pyenv init -)" && \
136+
eval "$$(pyenv virtualenv-init -)" && \
137+
pyenv virtualenv -f $(PYTHON_3_VERSION) $(NAME)-python3 && \
138+
pyenv activate $(NAME)-python3 && \
139+
pip install --upgrade pip && \
140+
pip install -U -r requirements.txt && \
141+
pyenv versions | grep --color=always $(NAME)-python
142+
143+
.PHONY: env-destroy
144+
env-destroy: env-destroy-python2 env-destroy-python3
145+
146+
.PHONY: env-destroy-python2
147+
env-destroy-python2:
148+
eval "$$(pyenv init -)" && \
149+
eval "$$(pyenv virtualenv-init -)" && \
150+
pyenv shell system && \
151+
pyenv uninstall -f $(NAME)-python2 && \
152+
pyenv versions | grep --color=always $(NAME)-python
153+
154+
.PHONY: env-destroy-python3
155+
env-destroy-python3:
156+
eval "$$(pyenv init -)" && \
157+
eval "$$(pyenv virtualenv-init -)" && \
158+
pyenv shell system && \
159+
pyenv uninstall -f $(NAME)-python3 && \
160+
pyenv versions | grep --color=always $(NAME)-python
161+
162+
.PHONY: env-reset
163+
env-reset:
164+
pyenv shell system
165+
166+
.PHONY: env
167+
env: env3
168+
169+
.PHONY: env2
170+
env2:
171+
eval "$$(pyenv init -)" && \
172+
eval "$$(pyenv virtualenv-init -)" && \
173+
pyenv activate $(NAME)-python2 && \
174+
pyenv versions | grep --color=always $(NAME)-python
175+
176+
.PHONY: env3
177+
env3:
178+
eval "$$(pyenv init -)" && \
179+
eval "$$(pyenv virtualenv-init -)" && \
180+
pyenv activate $(NAME)-python3 && \
181+
pyenv versions | grep --color=always $(NAME)-python
182+

0 commit comments

Comments
 (0)