Skip to content

Commit

Permalink
chore: Update from template using cruft
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Oct 23, 2019
1 parent 1d9d94a commit 0d55c5e
Show file tree
Hide file tree
Showing 18 changed files with 531 additions and 268 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
@@ -1,6 +1,6 @@
{
"template": "https://github.com/pawamoy/cookie-poetry",
"commit": "e76abd133eebbdf329da7fd8a445e6998db7c5e8",
"commit": "97493f9f8f3ee8e2119f76431353166d50f40383",
"context": {
"cookiecutter": {
"project_name": "git-changelog",
Expand Down
57 changes: 22 additions & 35 deletions .gitlab-ci.yml
Expand Up @@ -11,57 +11,46 @@ stages:
- quality
- tests

.install-deps-template: &install-deps
before_script:
- pip install poetry
- poetry --version
- poetry config settings.virtualenvs.in-project true
- poetry install -vv

# Quality jobs

.quality-template: &quality
<<: *install-deps
image: python:3.6
stage: quality

check-black:
check-bandit:
<<: *quality
before_script:
- pip install black
script: black --check src/ tests/
script: make check-bandit

check-isort:
check-black:
<<: *quality
before_script:
- pip install isort[pyproject]
script: isort -c -rc src/ tests/
script: make check-black

check-flake8:
<<: *quality
before_script:
- pip install flake8
script: flake8 src/ tests/
script: make check-flake8

check-bandit:
check-isort:
<<: *quality
before_script:
- pip install bandit
script: bandit -r src/
script: make check-isort

check-safety:
<<: *quality
before_script:
- apt-get update
- apt-get install -y python-enchant
- pip install poetry
- poetry config settings.virtualenvs.in-project true
- rm -rf .venv
- poetry install -vv
- poetry --version
script: make check-safety

# Tests jobs

.test-template: &test
<<: *install-deps
stage: tests
before_script:
- apt-get update
- apt-get install -y python-enchant
- apt-get install -y aria2
- pip install poetry
- poetry config settings.virtualenvs.in-project true
- poetry install -vv
- poetry --version
script: poetry run pytest -v
script: make test

python3.6:
<<: *test
Expand All @@ -73,6 +62,4 @@ python3.7:

python3.8:
<<: *test
image: python:3.8-rc
allow_failure: true

image: python:3.8
65 changes: 55 additions & 10 deletions CREDITS.md
@@ -1,65 +1,110 @@
<!--
IMPORTANT:
This file is generated from the template at 'scripts/templates/CREDITS.md'.
Please update the template instead of this file.
-->

# Credits
These projects were used to build `git-changelog`. **Thank you!**

[![`python`](https://www.vectorlogo.zone/logos/python/python-ar21.svg)](https://www.python.org/) |
[`poetry`](https://poetry.eustace.io/)
[`poetry`](https://poetry.eustace.io/) |
[`cookie-poetry`](https://github.com/pawamoy/cookie-poetry)

### Direct dependencies
[`bandit`](https://bandit.readthedocs.io/en/latest/) |
[`black`](https://github.com/ambv/black) |
[`coverage`](https://github.com/nedbat/coveragepy) |
[`cruft`](None) |
[`flake8`](https://gitlab.com/pycqa/flake8) |
[`ipython`](https://ipython.org) |
[`isort`](https://github.com/timothycrosley/isort) |
[![`Jinja2`](https://www.vectorlogo.zone/logos/pocoo_jinja/pocoo_jinja-ar21.svg)](https://palletsprojects.com/p/jinja/) |
[`jinja2-cli`](https://github.com/mattrobenolt/jinja2-cli) |
[`pylint`](https://github.com/PyCQA/pylint) |
[`pytest`](https://docs.pytest.org/en/latest/) |
[`pytest-cov`](https://github.com/pytest-dev/pytest-cov) |
[`pytest-sugar`](http://pivotfinland.com/pytest-sugar/) |
[`pytest-xdist`](https://github.com/pytest-dev/pytest-xdist) |
[`recommonmark`](https://github.com/rtfd/recommonmark) |
[`safety`](https://github.com/pyupio/safety) |
[`Sphinx`](http://sphinx-doc.org/) |
[`sphinx-rtd-theme`](https://github.com/rtfd/sphinx_rtd_theme/) |
[`sphinxcontrib-spelling`](https://github.com/sphinx-contrib/spelling)
[`toml`](https://github.com/uiri/toml)

### Indirect dependencies
[`alabaster`](https://alabaster.readthedocs.io) |
[`apipkg`](https://github.com/pytest-dev/apipkg) |
[`appdirs`](http://github.com/ActiveState/appdirs) |
[`appnope`](http://github.com/minrk/appnope) |
[`arrow`](https://arrow.readthedocs.io) |
[`astroid`](https://github.com/PyCQA/astroid) |
[`atomicwrites`](https://github.com/untitaker/python-atomicwrites) |
[`attrs`](https://www.attrs.org/) |
[`Babel`](http://babel.pocoo.org/) |
[`backcall`](https://github.com/takluyver/backcall) |
[`binaryornot`](https://github.com/audreyr/binaryornot) |
[`certifi`](https://certifi.io/) |
[`chardet`](https://github.com/chardet/chardet) |
[![CommonMark](https://www.vectorlogo.zone/logos/commonmark/commonmark-ar21.svg)](https://github.com/rolandshoemaker/CommonMark-py) |
[`coverage`](https://bitbucket.org/ned/coveragepy) |
[`Click`](https://palletsprojects.com/p/click/) |
[`colorama`](https://github.com/tartley/colorama) |
[![`commonmark`](https://www.vectorlogo.zone/logos/commonmark/commonmark-ar21.svg)](https://github.com/rtfd/commonmark.py) |
[`cookiecutter`](https://github.com/audreyr/cookiecutter) |
[`dataclasses`](https://github.com/ericvsmith/dataclasses) |
[`decorator`](https://github.com/micheles/decorator) |
[`docutils`](http://docutils.sourceforge.net/) |
[`execnet`](http://codespeak.net/execnet) |
[`dparse`](https://github.com/jayfk/dparse) |
[`entrypoints`](https://github.com/takluyver/entrypoints) |
[`examples`](None) |
[`execnet`](https://execnet.readthedocs.io/en/latest/) |
[`falcon`](https://falconframework.org) |
[`future`](https://python-future.org) |
[`gitdb2`](https://github.com/gitpython-developers/gitdb) |
[`GitPython`](https://github.com/gitpython-developers/GitPython) |
[`hug`](https://github.com/hugapi/hug) |
[`idna`](https://github.com/kjd/idna) |
[`imagesize`](https://github.com/shibukawa/imagesize_py) |
[`importlib-metadata`](http://importlib-metadata.readthedocs.io/) |
[`ipython-genutils`](http://ipython.org) |
[`jedi`](https://github.com/davidhalter/jedi) |
[![jinja2](https://www.vectorlogo.zone/logos/pocoo_jinja/pocoo_jinja-ar21.svg)](http://jinja.pocoo.org/?utm_source=vectorlogozone&utm_medium=referrer) |
[`MarkupSafe`](https://www.palletsprojects.com/p/markupsafe/) |
[`jinja2-time`](https://github.com/hackebrot/jinja2-time) |
[`lazy-object-proxy`](https://github.com/ionelmc/python-lazy-object-proxy) |
[`MarkupSafe`](https://palletsprojects.com/p/markupsafe/) |
[`mccabe`](https://github.com/pycqa/mccabe) |
[`more-itertools`](https://github.com/erikrose/more-itertools) |
[`packaging`](https://github.com/pypa/packaging) |
[`parso`](https://github.com/davidhalter/parso) |
[`pbr`](https://docs.openstack.org/pbr/latest/) |
[`pexpect`](https://pexpect.readthedocs.io/) |
[`pickleshare`](https://github.com/pickleshare/pickleshare) |
[`pluggy`](https://github.com/pytest-dev/pluggy) |
[`poyo`](https://github.com/hackebrot/poyo) |
[`prompt-toolkit`](https://github.com/jonathanslenders/python-prompt-toolkit) |
[`ptyprocess`](https://github.com/pexpect/ptyprocess) |
[`py`](http://py.readthedocs.io/) |
[`pycodestyle`](https://pycodestyle.readthedocs.io/) |
[`pyenchant`](https://pythonhosted.org/pyenchant/) |
[`pydantic`](https://github.com/samuelcolvin/pydantic) |
[`pyflakes`](https://github.com/PyCQA/pyflakes) |
[`Pygments`](http://pygments.org/) |
[`pyparsing`](https://github.com/pyparsing/pyparsing/) |
[`pytest-forked`](https://github.com/pytest-dev/pytest-forked) |
[`python-dateutil`](https://dateutil.readthedocs.io) |
[`pytz`](http://pythonhosted.org/pytz) |
[`PyYAML`](https://github.com/yaml/pyyaml) |
[`requests`](http://python-requests.org) |
[`six`](https://github.com/benjaminp/six) |
[`snowballstemmer`](https://github.com/shibukawa/snowball_py) |
[`smmap2`](https://github.com/gitpython-developers/smmap) |
[`snowballstemmer`](https://github.com/snowballstem/snowball) |
[`sphinxcontrib-websupport`](http://sphinx-doc.org/) |
[`stevedore`](https://docs.openstack.org/stevedore/latest/) |
[`termcolor`](http://pypi.python.org/pypi/termcolor) |
[`traitlets`](http://ipython.org) |
[`typed-ast`](https://github.com/python/typed_ast) |
[`urllib3`](https://urllib3.readthedocs.io/) |
[`wcwidth`](https://github.com/jquast/wcwidth)
[`wcwidth`](https://github.com/jquast/wcwidth) |
[`whichcraft`](https://github.com/pydanny/whichcraft) |
[`wrapt`](https://github.com/GrahamDumpleton/wrapt) |
[`zipp`](https://github.com/jaraco/zipp)

**[More credits from the author](http://pawamoy.github.io/credits/)**

Expand Down
105 changes: 66 additions & 39 deletions Makefile
@@ -1,57 +1,41 @@
.PHONY: help
.PHONY: docs
.PHONY: test-py36
.PHONY: test-py37
.PHONY: clean
.PHONY: clean-tests
.DEFAULT_GOAL := help

help: ## Print this help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort
PY_SRC := src/ tests/ scripts/*.py docs/conf.py

readme: README.md ## Regenerate README.md.
poetry run ./scripts/gen-readme-data.py | \
poetry run jinja2 --format=json scripts/templates/README.md > README.md
.PHONY: build
build: ## Build the package wheel and sdist.
poetry build

docs: ## Build the documentation locally.
poetry run sphinx-build -E -b html docs build/docs

check: check-bandit check-black check-flake8 check-isort check-safety check-docs-spelling ## Check it all!
.PHONY: check
check: check-bandit check-black check-flake8 check-isort check-safety ## Check it all!

update-spelling-wordlist: ## Update the spelling word list.
scripts/update-spelling-wordlist.sh

check-docs-spelling: update-spelling-wordlist ## Check spelling in the documentation.
scripts/check-docs-spelling.sh
.PHONY: check-bandit
check-bandit: ## Check for security warnings in code using bandit.
poetry run bandit -r src/

.PHONY: check-black
check-black: ## Check if code is formatted nicely using black.
poetry run black --check src/ tests/ docs/conf.py

check-isort: ## Check if imports are correctly ordered using isort.
poetry run isort -c -rc src/ tests/ docs/conf.py
poetry run black --check $(PY_SRC)

.PHONY: check-flake8
check-flake8: ## Check for general warnings in code using flake8.
poetry run flake8 src/ tests/
poetry run flake8 $(PY_SRC)

check-bandit: ## Check for security warnings in code using bandit.
poetry run bandit -r src/
.PHONY: check-isort
check-isort: ## Check if imports are correctly ordered using isort.
poetry run isort -c -rc $(PY_SRC)

.PHONY: check-pylint
check-pylint: ## Check for code smells using pylint.
poetry run pylint $(PY_SRC)

.PHONY: check-safety
check-safety: ## Check for vulnerabilities in dependencies using safety.
poetry run pip freeze 2>/dev/null | \
grep -v git-changelog | \
poetry run safety check --stdin --full-report 2>/dev/null

run-black: ## Lint the code using black.
poetry run black src/ tests/ docs/conf.py

run-isort: ## Sort the imports using isort.
poetry run isort -y -rc src/ tests/ docs/conf.py

lint: run-black run-isort ## Run linting tools on the code.

clean-tests: ## Delete temporary tests files.
@rm -rf tests/tmp/* 2>/dev/null

.PHONY: clean
clean: clean-tests ## Delete temporary files.
@rm -rf build 2>/dev/null
@rm -rf dist 2>/dev/null
Expand All @@ -60,5 +44,48 @@ clean: clean-tests ## Delete temporary files.
@rm -rf .pytest_cache 2>/dev/null
@rm -rf pip-wheel-metadata 2>/dev/null

.PHONY: clean-tests
clean-tests: ## Delete temporary tests files.
@rm -rf tests/tmp/* 2>/dev/null

.PHONY: credits
credits: ## Regenerate CREDITS.md.
poetry run ./scripts/gen-credits-data.py | \
poetry run jinja2 --strict -o CREDITS.md --format=json scripts/templates/CREDITS.md -

.PHONY: docs
docs: ## Build the documentation locally.
poetry run sphinx-build -E -b html docs build/docs

.PHONY: help
help: ## Print this help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort

.PHONY: lint
lint: lint-black lint-isort ## Run linting tools on the code.

.PHONY: lint-black
lint-black: ## Lint the code using black.
poetry run black $(PY_SRC)

.PHONY: lint-isort
lint-isort: ## Sort the imports using isort.
poetry run isort -y -rc $(PY_SRC)

.PHONY: publish
publish: ## Publish the latest built version on PyPI.
poetry publish

.PHONY: setup
setup: ## Setup the development environment.
poetry install

.PHONY: readme
readme: ## Regenerate README.md.
poetry run ./scripts/gen-readme-data.py | \
poetry run jinja2 --strict -o README.md --format=json scripts/templates/README.md -

.PHONY: test
test: clean-tests ## Run the tests using pytest.
poetry run pytest -n6 2>/dev/null
poetry run pytest -n auto -k "$(K)" 2>/dev/null
-poetry run coverage html --rcfile=coverage.ini
4 changes: 4 additions & 0 deletions coverage.ini
Expand Up @@ -19,3 +19,7 @@ omit =

[coverage:html]
directory = build/coverage
extra_css = scripts/templates/coverage.css

[coverage:json]
output = build/coverage.json
19 changes: 4 additions & 15 deletions docs/conf.py
Expand Up @@ -12,14 +12,7 @@
version = release = metadata["version"]
master_doc = "index"

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.coverage",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinxcontrib.spelling",
"recommonmark",
]
extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon", "sphinx.ext.viewcode", "recommonmark"]

# Auto-documentation directives in RST files
autodoc_default_options = {"members": None, "special-members": "__init__", "exclude-members": "__weakref__"}
Expand All @@ -39,18 +32,14 @@
napoleon_use_rtype = False
napoleon_use_param = False

# Documentation in Markdown
source_suffix = [".rst"]
source_parsers = {".md": "recommonmark.parser.CommonMarkParser"}
doc_root = repository + "/tree/master/docs/"


# Documentation in Markdown
def setup(app):
app.add_config_value(
"recommonmark_config",
{
"url_resolver": lambda url: doc_root + url,
"auto_toc_tree_section": "Welcome to " + metadata["name"] + "'s documentation!",
# "url_resolver": lambda url: repository + "/tree/master/docs/" + url,
"auto_toc_tree_section": "Welcome to {}'s documentation!".format(metadata["name"])
},
True,
)
Expand Down
3 changes: 1 addition & 2 deletions docs/requirements.txt
@@ -1,5 +1,4 @@
sphinx
sphinx-rtd-theme
sphinxcontrib-spelling
toml
recommonmark
recommonmark>=0.6.0

0 comments on commit 0d55c5e

Please sign in to comment.