Skip to content

Commit

Permalink
Merge pull request #296 from jacebrowning/update-tooling
Browse files Browse the repository at this point in the history
Update tooling
  • Loading branch information
jacebrowning committed Mar 26, 2023
2 parents 21914f0 + b024333 commit 6581556
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 43 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Temporary Python files
*.pyc
setup.py
*.egg-info/
__pycache__/
.ipynb_checkpoints/
setup.py
pip-wheel-metadata/

# Temporary OS files
Expand Down Expand Up @@ -36,6 +36,7 @@ tmp/
/.coverage.*
/htmlcov/
/prof/
coverage.xml

# Build and release directories
/build/
Expand Down
3 changes: 2 additions & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
python 3.11.1
python 3.11.2
poetry 1.4.1
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dist: focal
dist: jammy

language: python
python:
Expand All @@ -13,7 +13,7 @@ cache:
- ${VIRTUAL_ENV}

before_install:
- curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -
- curl -sSL https://install.python-poetry.org | python3 -
- make doctor

install:
Expand Down
4 changes: 2 additions & 2 deletions .verchew.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version = GNU Make
[Python]

cli = python
version = 3.8 || 3.9 || 3.10 || 3.11
version = 3

[Poetry]

Expand All @@ -17,6 +17,6 @@ version = 1

cli = dot
cli_version_arg = -V
version = 2
version = 7
optional = true
message = This is only needed to generate UML diagrams for documentation.
16 changes: 9 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
### Requirements

* Make:
* macOS: `$ xcode-select --install`
* Linux: [https://www.gnu.org/software/make](https://www.gnu.org/software/make)
* Windows: [https://mingw.org/download/installer](https://mingw.org/download/installer)
* Python: `$ asdf install`
* Poetry: [https://poetry.eustace.io/docs/#installation](https://poetry.eustace.io/docs/#installation)
- macOS: `$ xcode-select --install`
- Linux: [https://www.gnu.org](https://www.gnu.org/software/make)
- Windows: `$ choco install make` [https://chocolatey.org](https://chocolatey.org/install)
* Python: `$ asdf install` (https://asdf-vm.com)[https://asdf-vm.com/guide/getting-started.html]
* Poetry: [https://python-poetry.org](https://python-poetry.org/docs/#installation)
* Graphviz:
* macOS: `$ brew install graphviz`
* Linux: [https://graphviz.org/download](https://graphviz.org/download/)
Expand All @@ -18,6 +18,7 @@
To confirm these system dependencies are configured correctly:

```text
$ make bootstrap
$ make doctor
```

Expand Down Expand Up @@ -61,12 +62,13 @@ $ make dev

> In order to have OS X notifications, `brew install terminal-notifier`.
## Continuous Integration
### Continuous Integration

The CI server will report overall build status:

```text
$ make ci
$ make all
```
```
## Release Tasks
Expand Down
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MODULES := $(wildcard $(PACKAGE)/*.py)
# MAIN TASKS ##################################################################

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

.PHONY: dev
dev: install ## Continuously run all CI tasks when files chanage
Expand All @@ -21,20 +21,27 @@ demo: install

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

.PHONY: boostrap
boostrap: ## Attempt to install system dependencies
asdf plugin add python || asdf plugin update python
asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git || asdf plugin update poetry
asdf install

.PHONY: doctor
doctor: ## Confirm system dependencies are available
bin/verchew --exit-code
doctor: ## Confirm system dependencies are available
bin/verchew

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

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

.PHONY: install
install: $(DEPENDENCIES) .cache
install: $(DEPENDENCIES) .cache ## Install project dependencies

$(DEPENDENCIES): poetry.lock
@ poetry config virtualenvs.in-project true || poetry config settings.virtualenvs.in-project true
@ rm -rf $(VIRTUAL_ENV)/.poetry-*
@ poetry config virtualenvs.in-project true
poetry install
@ touch $@

Expand Down
42 changes: 22 additions & 20 deletions bin/update
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import shutil
import subprocess
import sys


CWD = os.getcwd()
TMP = tempfile.gettempdir()
CONFIG = {
Expand All @@ -25,12 +26,12 @@ CONFIG = {
}


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


def run():
Expand All @@ -40,7 +41,7 @@ def run():

os.chdir(TMP)
cookiecutter(
'https://github.com/jacebrowning/template-python.git',
"https://github.com/jacebrowning/template-python.git",
no_input=True,
overwrite_if_exists=True,
extra_context=CONFIG,
Expand All @@ -49,30 +50,31 @@ def run():

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


if __name__ == '__main__':
if __name__ == "__main__":
install()
run()
copy()
10 changes: 5 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6581556

Please sign in to comment.