Skip to content

Commit 12a5a38

Browse files
committed
refactor(build): migrate to setuptools
1 parent 93ec93c commit 12a5a38

File tree

8 files changed

+49
-32
lines changed

8 files changed

+49
-32
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ __pycache__
44
.venv-bash/
55
.venv-pwsh/
66
.DS_Store
7+
build/
78
dist/
9+
punit/
10+
*.egg-info/
811
docs/_build/
9-
poetry.lock
1012
*.xml
1113
*.html

pyproject.toml

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,39 @@
1-
[tool.poetry]
1+
[project]
22
name = "pUnit"
33
version = "0.0.0"
44
description = "A modernized unit-test framework for Python."
5-
authors = ["Shaun Wilson <mrshaunwilson@msn.com>"]
6-
license = "MIT"
5+
keywords = ["test", "unittest", "unit-test"]
6+
authors = [
7+
{ name="Shaun Wilson", email="mrshaunwilson@msn.com" }
8+
]
79
readme = "README.md"
10+
requires-python = ">=3.12"
811
classifiers = [
12+
"License :: OSI Approved :: MIT License",
913
"Operating System :: OS Independent",
1014
"Programming Language :: Python :: 3.12",
1115
"Programming Language :: Python :: 3.13",
12-
"Topic :: Software Development :: Libraries :: Python Modules"
13-
]
14-
exclude = [
15-
"sys",
16-
"tests"
17-
]
18-
packages = [
19-
{ include = "**/*.py", from = "src", to = "punit", format = ["sdist", "wheel"] }
16+
"Topic :: Software Development :: Libraries :: Python Modules",
17+
"Intended Audience :: Developers"
2018
]
2119

22-
[tool.poetry.urls]
23-
documentation = "https://github.com/wilson0x4d/punit/docs"
24-
homepage = "https://github.com/wilson0x4d/punit"
25-
repository = "https://github.com/wilson0x4d/punit.git"
26-
27-
[tool.poetry.dependencies]
28-
python = "^3.12"
20+
[project.urls]
21+
Documentation = "https://github.com/wilson0x4d/punit/docs"
22+
Homepage = "https://github.com/wilson0x4d/punit"
23+
Repository = "https://github.com/wilson0x4d/punit.git"
2924

25+
[project.scripts]
26+
punit = "punit:__main__.main"
3027

3128
[build-system]
32-
requires = ["poetry-core"]
33-
build-backend = "poetry.core.masonry.api"
29+
requires = ["setuptools"]
30+
build-backend = "setuptools.build_meta"
31+
32+
[tool.setuptools.packages.find]
33+
exclude = [
34+
"docs",
35+
"src",
36+
"src.*",
37+
"tests",
38+
"tests.*"
39+
]

requirements-dev.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-r requirements.txt
2+
build
3+
setuptools
4+
twine

requirements.txt

Whitespace-only changes.

src/__main__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from .reports import HtmlReportGenerator, JUnitReportGenerator
88
from .runner import *
99

10-
async def main():
10+
async def async_main():
1111
ts = time.time()
1212
cli = CommandLineInterface.parse()
1313
if cli.help:
@@ -48,4 +48,8 @@ async def main():
4848
if failureCount > 0:
4949
exit(119)
5050

51-
asyncio.run(main())
51+
def main():
52+
asyncio.run(async_main())
53+
54+
if (__name__ == '__main__'):
55+
main()

sys/init-venv.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,5 @@ else
1414
fi
1515
$PYPATH -m venv --prompt "pUnit" .venv-bash
1616
source .venv-bash/bin/activate
17-
pip install poetry
18-
if [ -e pyproject.toml ]; then
19-
poetry install --no-root
20-
fi
17+
pip install -r requirements-dev.txt
2118
deactivate

sys/publish-packages.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,12 @@ set -eo pipefail
66
source .venv-bash/bin/activate
77
sed "s/0.0.0/$SEMVER/g" --in-place pyproject.toml
88
sed "s/0.0.0/$SEMVER/g" --in-place src/__init__.py
9-
poetry build
10-
poetry publish --repository=$PYPI_REPO
9+
if [ -d ./punit ]; then
10+
rm ./punit
11+
fi
12+
rm -rf build/
13+
rm -rf dist/
14+
rm -rf *.egg-info/
15+
ln -s ./src ./punit
16+
python3 -m build
17+
#python3 -m twine upload --repository $PYPI_REPO dist/*

sys/with-venv.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,3 @@ source ~/.bashrc
1616
export PS1='\$ '
1717
echo -n -e "\033]0;pUnit\007"
1818
source .venv-bash/bin/activate
19-
if [ -e pyproject.toml ]; then
20-
poetry shell
21-
fi

0 commit comments

Comments
 (0)