Skip to content

Commit

Permalink
Add pyproject.toml and pypi publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
qu1ck committed Dec 16, 2023
1 parent e0481e9 commit 3d13424
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build and publish a release

on:
workflow_dispatch:
push:
tags:
- v**

jobs:
pypi-deploy:
runs-on: ubuntu-latest

environment: release
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch
- name: Build package
run: hatch build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ releases
demo
*config.ini
InteractiveHtmlBom/web/user*
dist/
2 changes: 1 addition & 1 deletion InteractiveHtmlBom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def callback(_):


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

plugin = InteractiveHtmlBomPlugin()
Expand Down
2 changes: 1 addition & 1 deletion InteractiveHtmlBom/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import subprocess


LAST_TAG = 'v2.8.0'
LAST_TAG = 'v2.8.1'


def _get_git_version():
Expand Down
68 changes: 68 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "InteractiveHtmlBom"
dynamic = ["version"]
description = 'Generate Interactive Html BOM for your electronics projects'
readme = "README.md"
requires-python = ">=3.8"
license = "MIT"
keywords = ["ibom", "KiCad", "Eagle", "EasyEDA"]
authors = [{ name = "qu1ck", email = "anlutsenko@gmail.com" }]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
"Topic :: Utilities",
]
dependencies = [
"wxpython>=4.0",
"jsonschema>=4.1",
]

[project.scripts]
generate_interactive_bom = "InteractiveHtmlBom.generate_interactive_bom:main"

[project.urls]
Documentation = "https://github.com/openscopeproject/InteractiveHtmlBom/wiki"
Issues = "https://github.com/openscopeproject/InteractiveHtmlBom/issues"
Source = "https://github.com/openscopeproject/InteractiveHtmlBom"

[tool.hatch.version]
path = "InteractiveHtmlBom/version.py"
pattern = "LAST_TAG = 'v(?P<version>[^']+)'"

[tool.hatch.envs.default]
dependencies = ["coverage[toml]>=6.5", "pytest"]
[tool.hatch.envs.default.scripts]
test = "pytest {args:tests}"
test-cov = "coverage run -m pytest {args:tests}"
cov-report = ["- coverage combine", "coverage report"]
cov = ["test-cov", "cov-report"]

[[tool.hatch.envs.all.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]

[tool.hatch.envs.types]
dependencies = ["mypy>=1.0.0"]
[tool.hatch.envs.types.scripts]
check = "mypy --install-types --non-interactive {args:InteractiveHtmlBom}"

[tool.coverage.run]
source_pkgs = ["InteractiveHtmlBom", "tests"]
branch = true
parallel = true
omit = ["src/InteractiveHtmlBom/__about__.py"]

[tool.coverage.paths]
InteractiveHtmlBom = [
"InteractiveHtmlBom",
]
tests = ["tests", "*/InteractiveHtmlBom/tests"]

[tool.coverage.report]
exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]

0 comments on commit 3d13424

Please sign in to comment.