Skip to content

Commit

Permalink
Merge pull request #71 from jacebrowning/release/v3.1
Browse files Browse the repository at this point in the history
Release v3.1
  • Loading branch information
jacebrowning authored Apr 18, 2020
2 parents 39cfb6c + e245993 commit 67648b3
Show file tree
Hide file tree
Showing 30 changed files with 1,414 additions and 276 deletions.
2 changes: 2 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ environment:
PYTHON_MINOR: 6
- PYTHON_MAJOR: 3
PYTHON_MINOR: 7
- PYTHON_MAJOR: 3
PYTHON_MINOR: 8

cache:
- .venv -> poetry.lock
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*.egg-info
__pycache__
.ipynb_checkpoints
setup.py

# Temporary OS files
Icon*
Expand Down
4 changes: 4 additions & 0 deletions .pylint.ini
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ disable=
wildcard-import,
unused-wildcard-import,
singleton-comparison,
bad-continuation,
global-statement,
import-error,
no-name-in-module,
ungrouped-imports,

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
3.7.5
3.8.2
2.7.14
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ language: python
python:
- 3.6
- 3.7
- 3.8

cache:
pip: true
Expand Down
6 changes: 3 additions & 3 deletions .verchew.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ version = GNU Make
[Python 2]

cli = python2
version = Python 2.7
version = 2.7

[Python 3]

cli = python3
version = Python 3
version = 3

[Poetry]

cli = poetry
version = 1.0 || 0.12
version = 1

[Graphviz]

Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 3.1 (2020-04-18)

- Added support for unicode characters in Python 3.8.
- Added `--vendor PATH` command to download the program for offline use.
- Updated `--quiet` output to include actual program versions.

# 3.0.2 (2020-01-06)

- Removed type annotations to continue supporting legacy Python.
Expand Down Expand Up @@ -86,4 +92,4 @@

# 0.1 (2016-10-17)

- Initial release.
- Initial release.
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ The CI server will report overall build status:
$ make ci
```

# Demo Tasks

Run the program:

```text
$ make run
````
Launch an IPython session:
```text
$ make ipython
```

# Release Tasks

Release to PyPI:
Expand Down
30 changes: 15 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ VIRTUAL_ENV ?= .venv
all: install

.PHONY: ci
ci: check test ## Run all tasks that determine CI status
ci: format check test mkdocs ## Run all tasks that determine CI status

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

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

# SYSTEM DEPENDENCIES ##########################################################
# SYSTEM DEPENDENCIES #########################################################

.PHONY: doctor
doctor: ## Confirm system dependencies are available
verchew/script.py
bin/verchew

# PROJECT DEPENDENCIES #########################################################
# PROJECT DEPENDENCIES ########################################################

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

.PHONY: install
install: $(DEPENDENCIES) .cache

$(DEPENDENCIES): poetry.lock
@ poetry config virtualenvs.in-project true || poetry config settings.virtualenvs.in-project true
@ poetry config virtualenvs.in-project true
poetry install
@ touch $@

Expand All @@ -62,8 +62,8 @@ endif

.PHONY: format
format: install
poetry run isort $(PACKAGES) --recursive --apply
poetry run black $(PACKAGES)
poetry run isort $(PACKAGES) notebooks --recursive --apply
poetry run black $(PACKAGES) notebooks
@ echo

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

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

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

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

.PHONY: uml
uml: install docs/*.png
Expand All @@ -142,8 +142,8 @@ docs/*.png: $(MODULES)
- mv -f classes_$(PACKAGE).png docs/classes.png
- mv -f packages_$(PACKAGE).png docs/packages.png

.PHONY: mkdocs-live
mkdocs-live: mkdocs
.PHONY: mkdocs-serve
mkdocs-serve: mkdocs
eval "sleep 3; bin/open http://127.0.0.1:8000" &
poetry run mkdocs serve

Expand Down
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@ When onboarding new team members, ensuring their computer has everything needed

## Requirements

* Python 2.7+ or Python 3.3+
- Python 2.7+ or Python 3.3+

## Installation

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

```text
$ pip install verchew
$ pipx install verchew
```

or add it to your [Poetry](https://poetry.eustace.io/) project:

```text
$ poetry add verchew
```

or embedded the script in your project using [this guide](https://verchew.readthedocs.io/en/latest/cli/vendoring/).
Expand Down Expand Up @@ -78,7 +84,7 @@ Checking for Newer Working Program...
$ working-program --version
1.2.3
✘ EXPECTED: 4.1 || 4.2
MESSAGE: Version 4.x is required to get the special features.
MESSAGE: Version 4.x is required to get the special features.
Checking for Broken Program...
Expand All @@ -90,13 +96,13 @@ Checking for Optional Missing Program...
$ missing-program --version
sh: command not found: missing-program
EXPECTED: 1.2.3
EXPECTED (OPTIONAL): 1.2.3
Checking for Missing Program...
$ missing-program --version
sh: command not found: missing-program
✘ EXPECTED: 1.2.3
Results: ✔ ✘ ✘
Results: ✔ ✘ ✘
```
13 changes: 8 additions & 5 deletions bin/checksum
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ import sys


def run(paths):
hash_md5 = hashlib.md5()
sha = hashlib.sha1()

for path in paths:
with open(path, 'rb') as f:
for chunk in iter(lambda: f.read(4096), b''):
hash_md5.update(chunk)
try:
with open(path, 'rb') as f:
for chunk in iter(lambda: f.read(4096), b''):
sha.update(chunk)
except IOError:
sha.update(path.encode())

print(hash_md5.hexdigest())
print(sha.hexdigest())


if __name__ == '__main__':
Expand Down
80 changes: 80 additions & 0 deletions bin/update
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import importlib
import tempfile
import shutil
import subprocess
import sys

CWD = os.getcwd()
TMP = tempfile.gettempdir()
CONFIG = {
"full_name": "Jace Browning",
"email": "[email protected]",
"github_username": "jacebrowning",
"github_repo": "verchew",
"default_branch": "develop",
"project_name": "verchew",
"package_name": "verchew",
"project_short_description": "System dependency version checker.",
"python_major_version": 3,
"python_minor_version": 6,
}


def install(package='cookiecutter'):
try:
importlib.import_module(package)
except ImportError:
print("Installing cookiecutter")
subprocess.check_call([sys.executable, '-m', 'pip', 'install', package])


def run():
print("Generating project")

from cookiecutter.main import cookiecutter

os.chdir(TMP)
cookiecutter(
'https://github.com/jacebrowning/template-python.git',
no_input=True,
overwrite_if_exists=True,
extra_context=CONFIG,
)


def copy():
for filename in [
'.appveyor.yml',
'.coveragerc',
'.gitattributes',
'.gitignore',
'.isort.cfg',
'.mypy.ini',
'.pydocstyle.ini',
'.pylint.ini',
'.scrutinizer.yml',
'.travis.yml',
'.verchew.ini',
'CONTRIBUTING.md',
'Makefile',
os.path.join('bin', 'checksum'),
os.path.join('bin', 'open'),
os.path.join('bin', 'update'),
os.path.join('bin', 'verchew'),
'pytest.ini',
'scent.py',
]:
src = os.path.join(TMP, CONFIG['project_name'], filename)
dst = os.path.join(CWD, filename)
print("Updating " + filename)
shutil.copy(src, dst)


if __name__ == '__main__':
install()
run()
copy()
3 changes: 3 additions & 0 deletions bin/verchew
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

verchew/script.py
22 changes: 16 additions & 6 deletions docs/cli/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

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

* `.verchew.ini`
* `verchew.ini`
* `.verchew`
* `.verchewrc`
- `.verchew.ini`
- `verchew.ini`
- `.verchew`
- `.verchewrc`

# Version Arguments

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:
Expand All @@ -25,7 +25,7 @@ If the program lacks a specific argument to display its version, but contains ve
[7-Zip]

cli = 7z
cli_version_arg =
cli_version_arg =
version = 16
```

Expand All @@ -40,6 +40,16 @@ cli = python
version = Python 2 || Python 3
```

# Any Version

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:

```ini
[Hugo]

cli = hugo
```

# Optional Programs

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

0 comments on commit 67648b3

Please sign in to comment.