Skip to content

Commit a381e9f

Browse files
authored
Bootstrap (#1)
1 parent c6b1e09 commit a381e9f

20 files changed

+818
-0
lines changed

.circleci/config.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
version: 2.1
2+
3+
orbs:
4+
codecov: codecov/[email protected]
5+
6+
jobs:
7+
build:
8+
docker:
9+
- image: cimg/python:3.10.0
10+
environment:
11+
PIPENV_VENV_IN_PROJECT: true
12+
resource_class: medium
13+
steps:
14+
- checkout
15+
- restore_cache:
16+
keys:
17+
- pipenv-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
18+
- pipenv-{{ .Branch }}-
19+
- pipenv-
20+
- run: pipenv sync --dev
21+
- save_cache:
22+
key: pipenv-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
23+
paths:
24+
- .venv
25+
- run: pipenv run ./lint.sh
26+
- run: pipenv run pytest
27+
- codecov/upload:
28+
file: coverage.xml
29+
- run: pipenv run ./build.sh
30+
- run: pip install dist/*
31+
- run: if [[ -z "${CIRCLE_TAG}" ]]; then circleci-agent step halt; fi
32+
- run: pipenv run twine upload dist/*
33+
34+
workflows:
35+
default:
36+
jobs:
37+
- build:
38+
filters:
39+
branches:
40+
only: /.*/
41+
tags:
42+
only: /.*/

.flake8

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
exclude = .venv,dist
3+
ignore = E501, W503
4+
max-line-length = 88

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.coverage
2+
changedifferently.egg-info
3+
coverage.xml
4+
dist
5+
htmlcov

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cSpell.words": [
3+
"changedifferently"
4+
]
5+
}

.yamllint.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
extends: default
2+
3+
ignore: |
4+
.venv
5+
6+
rules:
7+
document-start: disable
8+
line-length:
9+
max: 88

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include changedifferently/version/VERSION

Pipfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
8+
[dev-packages]
9+
black = "==21.9b0"
10+
flake8 = "*"
11+
isort = "*"
12+
mypy = "*"
13+
pytest = "*"
14+
pytest-cov = "*"
15+
twine = "*"
16+
shellcheck-py = "*"
17+
yamllint = "*"
18+
19+
[requires]
20+
python_version = "3.10"

Pipfile.lock

+611
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/env bash
2+
3+
set -euo pipefail
4+
5+
if [[ -n ${1:-} ]]; then
6+
version=${1}
7+
elif [[ -n ${CIRCLE_TAG:-} ]]; then
8+
version=${CIRCLE_TAG}
9+
else
10+
version="-1.-1.-1"
11+
fi
12+
13+
echo "${version}" > changedifferently/version/VERSION
14+
rm -rf dist
15+
python setup.py bdist_wheel
16+
rm -rf build

changedifferently/__init__.py

Whitespace-only changes.

changedifferently/py.typed

Whitespace-only changes.

changedifferently/version/VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-1.-1.-1

changedifferently/version/__init__.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import importlib.resources as pkg_resources
2+
3+
4+
def get_version() -> str:
5+
"""Gets the package version."""
6+
with pkg_resources.open_text(__package__, "VERSION") as t:
7+
return t.readline().strip()

changedifferently/version/py.typed

Whitespace-only changes.

lint.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/env bash
2+
set -euo pipefail
3+
4+
find . -name "*.sh" -not -path "*/.venv/*" -exec shellcheck -o all --severity style -x {} +
5+
6+
yamllint --strict .
7+
8+
if [ "${CI:=}" == "true" ]; then
9+
isort . --check-only --diff
10+
else
11+
isort .
12+
fi
13+
14+
if [ "${CI:=}" == "true" ]; then
15+
black . --check --diff
16+
else
17+
black .
18+
fi
19+
20+
flake8 .
21+
mypy changedifferently
22+
mypy tests

mypy.ini

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[mypy]
2+
pretty = True
3+
strict = True

pyproject.toml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[tool.black]
2+
exclude = '.venv'
3+
4+
[tool.isort]
5+
profile = 'black'
6+
skip = '.venv'
7+
8+
[tool.pytest.ini_options]
9+
addopts = '--cov=changedifferently --cov-branch --cov-report=html --cov-report=term-missing:skip-covered --cov-report=xml --no-cov-on-fail'
10+
log_cli = 1
11+
testpaths = 'tests'

setup.py

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
from pathlib import Path
2+
3+
from setuptools import setup # pyright: reportMissingTypeStubs=false
4+
5+
from changedifferently.version import get_version
6+
7+
readme_path = Path(__file__).parent / "README.md"
8+
9+
with open(readme_path, encoding="utf-8") as f:
10+
long_description = f.read()
11+
12+
classifiers = [
13+
"Environment :: Console",
14+
"License :: OSI Approved :: MIT License",
15+
"Natural Language :: English",
16+
"Programming Language :: Python :: 3 :: Only",
17+
"Programming Language :: Python :: 3.8",
18+
"Programming Language :: Python :: 3.9",
19+
"Programming Language :: Python :: 3.10",
20+
"Topic :: Utilities",
21+
"Typing :: Typed",
22+
]
23+
24+
version = get_version()
25+
26+
if "a" in version:
27+
classifiers.append("Development Status :: 3 - Alpha")
28+
elif "b" in version:
29+
classifiers.append("Development Status :: 4 - Beta")
30+
else:
31+
classifiers.append("Development Status :: 5 - Production/Stable")
32+
33+
classifiers.sort()
34+
35+
setup(
36+
author="Cariad Eccleston",
37+
author_email="[email protected]",
38+
classifiers=classifiers,
39+
description="Visualises the changes described by an Amazon Web Services CloudFormation change set",
40+
include_package_data=True,
41+
license="MIT",
42+
long_description=long_description,
43+
long_description_content_type="text/markdown",
44+
name="changedifferently",
45+
packages=[
46+
"changedifferently",
47+
"changedifferently.version",
48+
],
49+
package_data={
50+
"changedifferently": ["py.typed"],
51+
"changedifferently.version": ["py.typed"],
52+
},
53+
python_requires=">=3.8",
54+
url="https://github.com/cariad/changedifferently",
55+
version=version,
56+
)

tests/__init__.py

Whitespace-only changes.

tests/test_version.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from changedifferently.version import get_version
2+
3+
4+
def test_get_version() -> None:
5+
assert get_version() == "-1.-1.-1"

0 commit comments

Comments
 (0)