Skip to content

Commit d9ee05f

Browse files
committed
Fix #75 -- Update packaging and CI to PEP518
Close #74
1 parent f7160a6 commit d9ee05f

File tree

11 files changed

+250
-51
lines changed

11 files changed

+250
-51
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# http://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 4
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
charset = utf-8
11+
end_of_line = lf
12+
max_line_length = 88
13+
14+
[*.{json,yml,yaml,toml}]
15+
indent_size = 2
16+
17+
[LICENSE]
18+
insert_final_newline = false

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
- package-ecosystem: github-actions
8+
directory: "/"
9+
schedule:
10+
interval: weekly

.github/workflows/ci.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- 3.x
7+
pull_request:
8+
9+
jobs:
10+
11+
lint:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
lint-command:
16+
- bandit -r . -x ./tests
17+
- black --check --diff .
18+
- flake8 .
19+
- isort --check-only --diff .
20+
- pydocstyle .
21+
steps:
22+
- uses: actions/checkout@v3
23+
- uses: actions/setup-python@v4
24+
with:
25+
python-version: "3.x"
26+
cache: 'pip'
27+
cache-dependency-path: 'linter-requirements.txt'
28+
- run: python -m pip install -r linter-requirements.txt
29+
- run: ${{ matrix.lint-command }}
30+
31+
docs:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v2
35+
- uses: actions/setup-python@v3
36+
with:
37+
python-version: 3.11
38+
- run: sudo apt-get install -y graphviz
39+
- run: python -m pip install -e '.[docs]'
40+
- run: python -m sphinx -W -b html docs docs/_build
41+
42+
dist:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v3
46+
- uses: actions/setup-python@v4
47+
with:
48+
python-version: "3.x"
49+
- run: python -m pip install --upgrade pip build wheel twine
50+
- run: python -m build --sdist --wheel
51+
- run: python -m twine check dist/*
52+
- uses: actions/upload-artifact@v3
53+
with:
54+
path: dist/*
55+
56+
pytest:
57+
needs:
58+
- lint
59+
strategy:
60+
matrix:
61+
os:
62+
- ubuntu-latest
63+
- windows-latest
64+
- macos-latest
65+
python-version:
66+
- 3.7
67+
- 3.8
68+
- 3.9
69+
runs-on: ${{ matrix.os }}
70+
steps:
71+
- uses: actions/checkout@v3
72+
- uses: actions/setup-python@v4
73+
with:
74+
python-version: ${{ matrix.python-version }}
75+
- run: python -m pip install .[test]
76+
- run: python -m pytest
77+
- uses: codecov/codecov-action@v3

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
9+
PyPi:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-python@v4
14+
with:
15+
python-version: 3.x
16+
- run: python -m pip install --upgrade pip build wheel twine
17+
- run: python -m build --sdist --wheel
18+
- run: python -m twine upload dist/*
19+
env:
20+
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
21+
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ dist/
88
include/
99
lib/
1010
docs/_build/
11+
.coverage
12+
13+
# packaging
14+
measurement/_version.py

.readthedocs.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
version: 2
6+
7+
build:
8+
os: ubuntu-20.04
9+
tools:
10+
python: "3.11"
11+
apt_packages:
12+
- graphviz
13+
14+
sphinx:
15+
configuration: docs/conf.py
16+
17+
python:
18+
install:
19+
- method: pip
20+
path: .
21+
extra_requirements:
22+
- docs

linter-requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
bandit==1.7.4
2+
black==22.10.0
3+
flake8==5.0.4
4+
isort==5.10.1
5+
pydocstyle[toml]==6.1.1

measurement/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""Easily use and manipulate unit-aware measurements in Python."""
2+
3+
from . import _version
4+
5+
__version__ = _version.version
6+
VERSION = _version.version_tuple

pyproject.toml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
[build-system]
2+
requires = ["flit_core>=3.2", "flit_scm", "wheel"]
3+
build-backend = "flit_scm:buildapi"
4+
5+
[project]
6+
name = "measurement"
7+
authors = [
8+
{ name = "Adam Coddington", email = "[email protected]" },
9+
{ name = "Johannes Maron", email = "[email protected]" }
10+
]
11+
readme = "README.rst"
12+
license = { file = "LICENSE" }
13+
dynamic = ["version", "description"]
14+
classifiers = [
15+
"Development Status :: 5 - Production/Stable",
16+
"Intended Audience :: Developers",
17+
"License :: OSI Approved :: MIT License",
18+
"Operating System :: OS Independent",
19+
"Programming Language :: JavaScript",
20+
"Programming Language :: Python",
21+
"Programming Language :: Python :: 3",
22+
"Programming Language :: Python :: 3.7",
23+
"Programming Language :: Python :: 3.8",
24+
"Programming Language :: Python :: 3.9",
25+
"Programming Language :: Python :: 3 :: Only",
26+
"Topic :: Software Development",
27+
"Topic :: Utilities",
28+
"Topic :: Scientific/Engineering",
29+
"Topic :: Scientific/Engineering :: Astronomy",
30+
"Topic :: Scientific/Engineering :: Atmospheric Science",
31+
"Topic :: Scientific/Engineering :: Chemistry",
32+
"Topic :: Scientific/Engineering :: GIS",
33+
"Topic :: Scientific/Engineering :: Mathematics",
34+
"Topic :: Scientific/Engineering :: Physics",
35+
"Topic :: Software Development :: Localization",
36+
]
37+
keywords = [
38+
"measurement",
39+
]
40+
requires-python = ">=3.7"
41+
dependencies = []
42+
43+
[project.optional-dependencies]
44+
test = [
45+
"pytest",
46+
"pytest-cov",
47+
]
48+
docs = [
49+
"sphinx",
50+
"python-docs-theme",
51+
]
52+
53+
[project.urls]
54+
Project-URL = "http://github.com/coddingtonbear/python-measurement"
55+
56+
[tool.flit.module]
57+
name = "measurement"
58+
59+
[tool.setuptools_scm]
60+
write_to = "measurement/_version.py"
61+
62+
[tool.pytest.ini_options]
63+
minversion = "6.0"
64+
addopts = "--doctest-glob=*.rst --doctest-modules --cov=measurement"
65+
testpaths = [
66+
"tests",
67+
]
68+
69+
[tool.coverage.report]
70+
show_missing = true
71+
72+
[tool.isort]
73+
atomic = true
74+
line_length = 88
75+
known_first_party = "measurement, tests"
76+
include_trailing_comma = true
77+
default_section = "THIRDPARTY"
78+
combine_as_imports = true
79+
80+
[tool.pydocstyle]
81+
add_ignore = "D1"
82+
match_dir = "(?!tests|env|docs|\\.).*"
83+
match = "(?!setup).*.py"

setup.cfg

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,4 @@
1-
[metadata]
2-
name = measurement
3-
author = Adam Coddington
4-
author_email = [email protected]
5-
description = Easily use and manipulate unit-aware measurements in Python
6-
long_description = file: README.rst
7-
url = http://github.com/coddingtonbear/python-measurement
8-
license = MIT
9-
license_file = LICENSE
10-
classifier =
11-
Development Status :: 5 - Production/Stable
12-
Intended Audience :: Developers
13-
License :: OSI Approved :: MIT License
14-
Operating System :: OS Independent
15-
Programming Language :: Python
16-
Programming Language :: Python :: 2
17-
Programming Language :: Python :: 3
18-
Topic :: Utilities
19-
keywords =
20-
measurement
21-
22-
[options]
23-
packages = find:
24-
include_package_data = True
25-
install_requires =
26-
sympy>=0.7.3
27-
setup_requires =
28-
setuptools_scm
29-
sphinx
30-
pytest-runner
31-
tests_require =
32-
pytest
33-
34-
[options.packages.find]
35-
exclude =
36-
tests
37-
38-
[bdist_wheel]
39-
universal = 1
40-
41-
[aliases]
42-
test = pytest
43-
44-
[build_sphinx]
45-
source-dir = docs
46-
build-dir = docs/_build
1+
[flake8]
2+
max-line-length=88
3+
select = C,E,F,W,B,B950
4+
ignore = E203, E501, W503, E731

0 commit comments

Comments
 (0)