Skip to content

Commit 67648b3

Browse files
authored
Merge pull request #71 from jacebrowning/release/v3.1
Release v3.1
2 parents 39cfb6c + e245993 commit 67648b3

30 files changed

+1414
-276
lines changed

.appveyor.yml

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ environment:
66
PYTHON_MINOR: 6
77
- PYTHON_MAJOR: 3
88
PYTHON_MINOR: 7
9+
- PYTHON_MAJOR: 3
10+
PYTHON_MINOR: 8
911

1012
cache:
1113
- .venv -> poetry.lock

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*.egg-info
44
__pycache__
55
.ipynb_checkpoints
6+
setup.py
67

78
# Temporary OS files
89
Icon*

.pylint.ini

+4
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ disable=
127127
wildcard-import,
128128
unused-wildcard-import,
129129
singleton-comparison,
130+
bad-continuation,
130131
global-statement,
132+
import-error,
133+
no-name-in-module,
134+
ungrouped-imports,
131135

132136
# Enable the message, report, category or checker with the given id(s). You can
133137
# either give multiple identifier separated by comma (,) or put this option

.python-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
3.7.5
1+
3.8.2
22
2.7.14

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ language: python
44
python:
55
- 3.6
66
- 3.7
7+
- 3.8
78

89
cache:
910
pip: true

.verchew.ini

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ version = GNU Make
66
[Python 2]
77

88
cli = python2
9-
version = Python 2.7
9+
version = 2.7
1010

1111
[Python 3]
1212

1313
cli = python3
14-
version = Python 3
14+
version = 3
1515

1616
[Poetry]
1717

1818
cli = poetry
19-
version = 1.0 || 0.12
19+
version = 1
2020

2121
[Graphviz]
2222

CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 3.1 (2020-04-18)
2+
3+
- Added support for unicode characters in Python 3.8.
4+
- Added `--vendor PATH` command to download the program for offline use.
5+
- Updated `--quiet` output to include actual program versions.
6+
17
# 3.0.2 (2020-01-06)
28

39
- Removed type annotations to continue supporting legacy Python.
@@ -86,4 +92,4 @@
8692

8793
# 0.1 (2016-10-17)
8894

89-
- Initial release.
95+
- Initial release.

CONTRIBUTING.md

+14
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ The CI server will report overall build status:
6767
$ make ci
6868
```
6969

70+
# Demo Tasks
71+
72+
Run the program:
73+
74+
```text
75+
$ make run
76+
````
77+
78+
Launch an IPython session:
79+
80+
```text
81+
$ make ipython
82+
```
83+
7084
# Release Tasks
7185

7286
Release to PyPI:

Makefile

+15-15
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ VIRTUAL_ENV ?= .venv
1717
all: install
1818

1919
.PHONY: ci
20-
ci: check test ## Run all tasks that determine CI status
20+
ci: format check test mkdocs ## Run all tasks that determine CI status
2121

2222
.PHONY: watch
2323
watch: install .clean-test ## Continuously run all CI tasks when files chanage
@@ -27,25 +27,25 @@ watch: install .clean-test ## Continuously run all CI tasks when files chanage
2727
run: install
2828
poetry run python $(PACKAGE)/__main__.py
2929

30-
.PHONY: demo ## Run the example
31-
demo:
32-
cd examples && make doctor
30+
.PHONY: ipython ## Launch an IPython session
31+
ipython: install
32+
poetry run ipython --ipython-dir=notebooks
3333

34-
# SYSTEM DEPENDENCIES ##########################################################
34+
# SYSTEM DEPENDENCIES #########################################################
3535

3636
.PHONY: doctor
3737
doctor: ## Confirm system dependencies are available
38-
verchew/script.py
38+
bin/verchew
3939

40-
# PROJECT DEPENDENCIES #########################################################
40+
# PROJECT DEPENDENCIES ########################################################
4141

4242
DEPENDENCIES := $(VIRTUAL_ENV)/.poetry-$(shell bin/checksum pyproject.toml poetry.lock)
4343

4444
.PHONY: install
4545
install: $(DEPENDENCIES) .cache
4646

4747
$(DEPENDENCIES): poetry.lock
48-
@ poetry config virtualenvs.in-project true || poetry config settings.virtualenvs.in-project true
48+
@ poetry config virtualenvs.in-project true
4949
poetry install
5050
@ touch $@
5151

@@ -62,8 +62,8 @@ endif
6262

6363
.PHONY: format
6464
format: install
65-
poetry run isort $(PACKAGES) --recursive --apply
66-
poetry run black $(PACKAGES)
65+
poetry run isort $(PACKAGES) notebooks --recursive --apply
66+
poetry run black $(PACKAGES) notebooks
6767
@ echo
6868

6969
.PHONY: check
@@ -81,8 +81,8 @@ RANDOM_SEED ?= $(shell date +%s)
8181
FAILURES := .cache/v/cache/lastfailed
8282

8383
PYTEST_OPTIONS := --random --random-seed=$(RANDOM_SEED)
84-
ifdef DISABLE_COVERAGE
85-
PYTEST_OPTIONS += --no-cov --disable-warnings
84+
ifndef DISABLE_COVERAGE
85+
PYTEST_OPTIONS += --cov=$(PACKAGE)
8686
endif
8787
PYTEST_RERUN_OPTIONS := --last-failed --exitfirst
8888

@@ -131,9 +131,9 @@ $(MKDOCS_INDEX): docs/requirements.txt mkdocs.yml docs/*.md
131131
@ cd docs/about && ln -sf ../../LICENSE.md license.md
132132
poetry run mkdocs build --clean --strict
133133

134-
# Workaround: https://github.com/rtfd/readthedocs.org/issues/5090
135134
docs/requirements.txt: poetry.lock
136135
@ poetry run pip freeze -qqq | grep mkdocs > $@
136+
@ poetry run pip freeze -qqq | grep Pygments >> $@
137137

138138
.PHONY: uml
139139
uml: install docs/*.png
@@ -142,8 +142,8 @@ docs/*.png: $(MODULES)
142142
- mv -f classes_$(PACKAGE).png docs/classes.png
143143
- mv -f packages_$(PACKAGE).png docs/packages.png
144144

145-
.PHONY: mkdocs-live
146-
mkdocs-live: mkdocs
145+
.PHONY: mkdocs-serve
146+
mkdocs-serve: mkdocs
147147
eval "sleep 3; bin/open http://127.0.0.1:8000" &
148148
poetry run mkdocs serve
149149

README.md

+12-6
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,20 @@ When onboarding new team members, ensuring their computer has everything needed
1515

1616
## Requirements
1717

18-
* Python 2.7+ or Python 3.3+
18+
- Python 2.7+ or Python 3.3+
1919

2020
## Installation
2121

22-
Install `verchew` globally with pip:
22+
Install `verchew` globally with [pipx](https://pipxproject.github.io/pipx/installation/) (or pip):
2323

2424
```text
25-
$ pip install verchew
25+
$ pipx install verchew
26+
```
27+
28+
or add it to your [Poetry](https://poetry.eustace.io/) project:
29+
30+
```text
31+
$ poetry add verchew
2632
```
2733

2834
or embedded the script in your project using [this guide](https://verchew.readthedocs.io/en/latest/cli/vendoring/).
@@ -78,7 +84,7 @@ Checking for Newer Working Program...
7884
$ working-program --version
7985
1.2.3
8086
✘ EXPECTED: 4.1 || 4.2
81-
MESSAGE: Version 4.x is required to get the special features.
87+
MESSAGE: Version 4.x is required to get the special features.
8288
8389
Checking for Broken Program...
8490
@@ -90,13 +96,13 @@ Checking for Optional Missing Program...
9096
9197
$ missing-program --version
9298
sh: command not found: missing-program
93-
EXPECTED: 1.2.3
99+
EXPECTED (OPTIONAL): 1.2.3
94100
95101
Checking for Missing Program...
96102
97103
$ missing-program --version
98104
sh: command not found: missing-program
99105
✘ EXPECTED: 1.2.3
100106
101-
Results: ✔ ✘ ✘
107+
Results: ✔ ✘ ✘
102108
```

bin/checksum

+8-5
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ import sys
66

77

88
def run(paths):
9-
hash_md5 = hashlib.md5()
9+
sha = hashlib.sha1()
1010

1111
for path in paths:
12-
with open(path, 'rb') as f:
13-
for chunk in iter(lambda: f.read(4096), b''):
14-
hash_md5.update(chunk)
12+
try:
13+
with open(path, 'rb') as f:
14+
for chunk in iter(lambda: f.read(4096), b''):
15+
sha.update(chunk)
16+
except IOError:
17+
sha.update(path.encode())
1518

16-
print(hash_md5.hexdigest())
19+
print(sha.hexdigest())
1720

1821

1922
if __name__ == '__main__':

bin/update

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
import os
5+
import importlib
6+
import tempfile
7+
import shutil
8+
import subprocess
9+
import sys
10+
11+
CWD = os.getcwd()
12+
TMP = tempfile.gettempdir()
13+
CONFIG = {
14+
"full_name": "Jace Browning",
15+
"email": "jacebrowning@gmail.com",
16+
"github_username": "jacebrowning",
17+
"github_repo": "verchew",
18+
"default_branch": "develop",
19+
"project_name": "verchew",
20+
"package_name": "verchew",
21+
"project_short_description": "System dependency version checker.",
22+
"python_major_version": 3,
23+
"python_minor_version": 6,
24+
}
25+
26+
27+
def install(package='cookiecutter'):
28+
try:
29+
importlib.import_module(package)
30+
except ImportError:
31+
print("Installing cookiecutter")
32+
subprocess.check_call([sys.executable, '-m', 'pip', 'install', package])
33+
34+
35+
def run():
36+
print("Generating project")
37+
38+
from cookiecutter.main import cookiecutter
39+
40+
os.chdir(TMP)
41+
cookiecutter(
42+
'https://github.com/jacebrowning/template-python.git',
43+
no_input=True,
44+
overwrite_if_exists=True,
45+
extra_context=CONFIG,
46+
)
47+
48+
49+
def copy():
50+
for filename in [
51+
'.appveyor.yml',
52+
'.coveragerc',
53+
'.gitattributes',
54+
'.gitignore',
55+
'.isort.cfg',
56+
'.mypy.ini',
57+
'.pydocstyle.ini',
58+
'.pylint.ini',
59+
'.scrutinizer.yml',
60+
'.travis.yml',
61+
'.verchew.ini',
62+
'CONTRIBUTING.md',
63+
'Makefile',
64+
os.path.join('bin', 'checksum'),
65+
os.path.join('bin', 'open'),
66+
os.path.join('bin', 'update'),
67+
os.path.join('bin', 'verchew'),
68+
'pytest.ini',
69+
'scent.py',
70+
]:
71+
src = os.path.join(TMP, CONFIG['project_name'], filename)
72+
dst = os.path.join(CWD, filename)
73+
print("Updating " + filename)
74+
shutil.copy(src, dst)
75+
76+
77+
if __name__ == '__main__':
78+
install()
79+
run()
80+
copy()

bin/verchew

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
verchew/script.py

docs/cli/configuration.md

+16-6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
Any of the following can be used as the `verchew` configuration filename:
44

5-
* `.verchew.ini`
6-
* `verchew.ini`
7-
* `.verchew`
8-
* `.verchewrc`
9-
5+
- `.verchew.ini`
6+
- `verchew.ini`
7+
- `.verchew`
8+
- `.verchewrc`
9+
1010
# Version Arguments
1111

1212
If one of your system dependencies uses an argument other than `--version` to display its version information, this can be changed in the configuration file using the `cli_version_arg` setting:
@@ -25,7 +25,7 @@ If the program lacks a specific argument to display its version, but contains ve
2525
[7-Zip]
2626

2727
cli = 7z
28-
cli_version_arg =
28+
cli_version_arg =
2929
version = 16
3030
```
3131

@@ -40,6 +40,16 @@ cli = python
4040
version = Python 2 || Python 3
4141
```
4242

43+
# Any Version
44+
45+
If the version of a system dependency is not important to your project, leave out the `version` setting to simply check for the existence of that program:
46+
47+
```ini
48+
[Hugo]
49+
50+
cli = hugo
51+
```
52+
4353
# Optional Programs
4454

4555
If one of your system dependencies is optional and you only want to show a warning for incompatible versions, include the `optional` setting:

0 commit comments

Comments
 (0)