Skip to content

Commit a2274b4

Browse files
committed
Add pyproject.toml and pypi publish workflow
1 parent e0481e9 commit a2274b4

File tree

5 files changed

+102
-2
lines changed

5 files changed

+102
-2
lines changed

.github/workflows/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build and publish a release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- v**
8+
9+
jobs:
10+
pypi-deploy:
11+
runs-on: ubuntu-latest
12+
13+
environment: release
14+
permissions:
15+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.11'
23+
cache: 'pip'
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install hatch
28+
- name: Build package
29+
run: hatch build
30+
- name: Publish package distributions to PyPI
31+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ releases
88
demo
99
*config.ini
1010
InteractiveHtmlBom/web/user*
11+
dist/

InteractiveHtmlBom/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def callback(_):
4444

4545

4646
if (not os.environ.get('INTERACTIVE_HTML_BOM_CLI_MODE', False) and
47-
os.path.basename(sys.argv[0]) != 'generate_interactive_bom.py'):
47+
not os.path.basename(sys.argv[0]).startswith('generate_interactive_bom')):
4848
from .ecad.kicad import InteractiveHtmlBomPlugin
4949

5050
plugin = InteractiveHtmlBomPlugin()

InteractiveHtmlBom/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import subprocess
44

55

6-
LAST_TAG = 'v2.8.0'
6+
LAST_TAG = 'v2.8.1'
77

88

99
def _get_git_version():

pyproject.toml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "InteractiveHtmlBom"
7+
dynamic = ["version"]
8+
description = 'Generate Interactive Html BOM for your electronics projects'
9+
readme = "README.md"
10+
requires-python = ">=3.8"
11+
license = "MIT"
12+
keywords = ["ibom", "KiCad", "Eagle", "EasyEDA"]
13+
authors = [{ name = "qu1ck", email = "[email protected]" }]
14+
classifiers = [
15+
"Development Status :: 5 - Production/Stable",
16+
"Programming Language :: Python :: 3",
17+
"License :: OSI Approved :: MIT License",
18+
"Operating System :: OS Independent",
19+
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
20+
"Topic :: Utilities",
21+
]
22+
dependencies = [
23+
"wxpython>=4.0",
24+
"jsonschema>=4.1",
25+
]
26+
27+
[project.scripts]
28+
generate_interactive_bom = "InteractiveHtmlBom.generate_interactive_bom:main"
29+
30+
[project.urls]
31+
Documentation = "https://github.com/openscopeproject/InteractiveHtmlBom/wiki"
32+
Issues = "https://github.com/openscopeproject/InteractiveHtmlBom/issues"
33+
Source = "https://github.com/openscopeproject/InteractiveHtmlBom"
34+
35+
[tool.hatch.version]
36+
path = "InteractiveHtmlBom/version.py"
37+
pattern = "LAST_TAG = 'v(?P<version>[^']+)'"
38+
39+
[tool.hatch.envs.default]
40+
dependencies = ["coverage[toml]>=6.5", "pytest"]
41+
[tool.hatch.envs.default.scripts]
42+
test = "pytest {args:tests}"
43+
test-cov = "coverage run -m pytest {args:tests}"
44+
cov-report = ["- coverage combine", "coverage report"]
45+
cov = ["test-cov", "cov-report"]
46+
47+
[[tool.hatch.envs.all.matrix]]
48+
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
49+
50+
[tool.hatch.envs.types]
51+
dependencies = ["mypy>=1.0.0"]
52+
[tool.hatch.envs.types.scripts]
53+
check = "mypy --install-types --non-interactive {args:InteractiveHtmlBom}"
54+
55+
[tool.coverage.run]
56+
source_pkgs = ["InteractiveHtmlBom", "tests"]
57+
branch = true
58+
parallel = true
59+
omit = ["src/InteractiveHtmlBom/__about__.py"]
60+
61+
[tool.coverage.paths]
62+
InteractiveHtmlBom = [
63+
"InteractiveHtmlBom",
64+
]
65+
tests = ["tests", "*/InteractiveHtmlBom/tests"]
66+
67+
[tool.coverage.report]
68+
exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]

0 commit comments

Comments
 (0)