Skip to content

Commit 1532b7f

Browse files
committed
Packaging: Sync from boilerplate.
1 parent 1022dec commit 1532b7f

File tree

8 files changed

+46
-36
lines changed

8 files changed

+46
-36
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
- name: Install Dependencies
3030
run: |
31-
make build-deps
31+
make dev-deps
3232
3333
- name: Build Packages
3434
run: |

.github/workflows/qa.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
- name: Install Dependencies
2323
run: |
24-
make test-deps
24+
make dev-deps
2525
2626
- name: Run Quality Assurance
2727
run: |

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
- name: Install Dependencies
2727
run: |
28-
make test-deps
28+
make dev-deps
2929
3030
- name: Run Tests
3131
run: |

Makefile

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
1-
LIBRARY_NAME="ioexpander"
2-
LIBRARY_VERSION=$(shell grep __version__ ${LIBRARY_NAME}/__init__.py | awk -F" = " '{print substr($$2,2,length($$2)-2)}' | awk -F"." '{print $$1"."$$2"."$$3}')
1+
LIBRARY_NAME := $(shell hatch project metadata name 2> /dev/null)
2+
LIBRARY_VERSION := $(shell hatch version 2> /dev/null)
33

44
.PHONY: usage install uninstall check pytest qa build-deps check tag wheel sdist clean dist testdeploy deploy
55
usage:
6+
ifdef LIBRARY_NAME
67
@echo "Library: ${LIBRARY_NAME}"
78
@echo "Version: ${LIBRARY_VERSION}\n"
9+
else
10+
@echo "WARNING: You should 'make dev-deps'\n"
11+
endif
812
@echo "Usage: make <target>, where target is one of:\n"
913
@echo "install: install the library locally from source"
1014
@echo "uninstall: uninstall the local library"
11-
@echo "build-deps: install essential python build dependencies"
12-
@echo "test-deps: install essential python test dependencies"
15+
@echo "dev-deps: install Python dev dependencies"
1316
@echo "check: perform basic integrity checks on the codebase"
1417
@echo "qa: run linting and package QA"
15-
@echo "pytest: run python test fixtures"
16-
@echo "wheel: build python .whl files for distribution"
17-
@echo "sdist: build python source distribution"
18-
@echo "clean: clean python build and dist directories"
19-
@echo "dist: build all python distribution files"
20-
@echo "testdeploy: build all and deploy to test PyPi"
21-
@echo "deploy: build all and deploy to PyPi"
22-
@echo "tag: tag the repository with the current version"
18+
@echo "pytest: run Python test fixtures"
19+
@echo "clean: clean Python build and dist directories"
20+
@echo "build: build Python distribution files"
21+
@echo "testdeploy: build and upload to test PyPi"
22+
@echo "deploy: build and upload to PyPi"
23+
@echo "tag: tag the repository with the current version\n"
2324

2425
install:
2526
./install.sh --unstable
2627

2728
uninstall:
2829
./uninstall.sh
2930

30-
build-deps:
31-
python3 -m pip install build
32-
33-
test-deps:
34-
python3 -m pip install tox
31+
dev-deps:
32+
python3 -m pip install -r requirements-dev.txt
3533
sudo apt install dos2unix
3634

3735
check:
@@ -49,20 +47,14 @@ nopost:
4947
tag:
5048
git tag -a "v${LIBRARY_VERSION}" -m "Version ${LIBRARY_VERSION}"
5149

52-
wheel: check
53-
python3 -m build --wheel
54-
55-
sdist: check
56-
python3 -m build --sdist
50+
build: check
51+
@hatch build
5752

5853
clean:
5954
-rm -r dist
6055

61-
dist: clean wheel sdist
62-
ls dist
63-
64-
testdeploy: dist
56+
testdeploy: build
6557
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
6658

67-
deploy: nopost dist
59+
deploy: nopost build
6860
twine upload dist/*

check.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# This script handles some basic QA checks on the source
44

55
NOPOST=$1
6-
LIBRARY_NAME="ioexpander"
7-
LIBRARY_VERSION=`grep __version__ $LIBRARY_NAME/__init__.py | awk -F" = " '{print substr($2,2,length($2)-2)}' | awk -F "." '{print $1"."$2"."$3}'`
8-
POST_VERSION=`grep __version__ $LIBRARY_NAME/__init__.py | awk -F" = " '{print substr($2,2,length($2)-2)}' | awk -F "." '{print substr($4,0,length($4))}'`
6+
LIBRARY_NAME=`hatch project metadata name`
7+
LIBRARY_VERSION=`hatch version | awk -F "." '{print $1"."$2"."$3}'`
8+
POST_VERSION=`hatch version | awk -F "." '{print substr($4,0,length($4))}'`
99

1010
success() {
1111
echo -e "$(tput setaf 2)$1$(tput sgr0)"
@@ -36,6 +36,7 @@ while [[ $# -gt 0 ]]; do
3636
esac
3737
done
3838

39+
inform "Checking $LIBRARY_NAME $LIBRARY_VERSION\n"
3940

4041
inform "Checking for trailing whitespace..."
4142
grep -IUrn --color "[[:blank:]]$" --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=PKG-INFO

pyproject.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,13 @@ include = [
5454
"LICENSE"
5555
]
5656

57-
[tool.hatch.build.targets.dist]
57+
[tool.hatch.build.targets.sdist]
5858
include = [
59-
"/examples"
59+
"*"
60+
]
61+
exclude = [
62+
".*",
63+
"dist"
6064
]
6165

6266
[tool.hatch.metadata.hooks.fancy-pypi-readme]
@@ -91,6 +95,9 @@ skip = """
9195
./dist.\
9296
"""
9397

98+
[tool.isort]
99+
line_length = 220
100+
94101
[tool.check-manifest]
95102
ignore = [
96103
'.stickler.yml',

requirements-dev.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
check-manifest
2+
ruff
3+
codespell
4+
isort
5+
twine
6+
hatch
7+
hatch-fancy-pypi-readme
8+
tox

tox.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
envlist = py,qa
33
skip_missing_interpreters = True
44
isolated_build = true
5-
minversion = 3.3.0
5+
minversion = 4.0.0
66

77
[testenv]
88
commands =
@@ -19,12 +19,14 @@ commands =
1919
check-manifest
2020
python -m build --no-isolation
2121
python -m twine check dist/*
22+
isort --check .
2223
ruff --format=github .
2324
codespell .
2425
deps =
2526
check-manifest
2627
ruff
2728
codespell
29+
isort
2830
twine
2931
build
3032
hatch

0 commit comments

Comments
 (0)