Skip to content

Commit fb3f0c9

Browse files
authored
Merge pull request #34 from timrid/feature/pyproject-toml
Switch to `pyproject.toml` and trusted publishing
2 parents fe19de7 + 0710384 commit fb3f0c9

6 files changed

Lines changed: 126 additions & 91 deletions

File tree

.github/workflows/main.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,30 @@ jobs:
6262
- name: Run pyright
6363
run: |
6464
pyright
65+
66+
create_wheel_and_sdist:
67+
runs-on: ubuntu-latest
68+
69+
steps:
70+
- uses: actions/checkout@v3
71+
72+
- name: Set up Python
73+
uses: actions/setup-python@v4
74+
with:
75+
python-version: '3.13'
76+
architecture: x64
77+
78+
- name: Install dependencies
79+
run: |
80+
python -m pip install --upgrade pip
81+
pip install wheel build
82+
83+
- name: Build wheel and sdist
84+
run: |
85+
python -m build
86+
87+
- name: Upload wheel and sdist as artifact
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: Package-Distributions-construct-typing
91+
path: dist/
Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
1-
# This workflows will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
41
name: Upload Python Package
52

63
on:
74
release:
85
types: [created]
96

107
jobs:
11-
deploy:
8+
create_wheel_and_sdist:
9+
name: create_wheel_and_sdist
10+
uses: ./.github/workflows/main.yml
11+
with:
12+
attest-package: "true"
1213

14+
deploy:
15+
depends-on: create_wheel_and_sdist
1316
runs-on: ubuntu-latest
17+
18+
environment: pypi
19+
permissions:
20+
id-token: write. # IMPORTANT: this permission is mandatory for Trusted Publishing
1421

1522
steps:
16-
- uses: actions/checkout@v2
17-
- name: Set up Python
18-
uses: actions/setup-python@v2
23+
- uses: actions/checkout@v3
24+
25+
- name: Download artifacts
26+
uses: actions/download-artifact@v4
1927
with:
20-
python-version: '3.x'
21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install setuptools wheel twine
25-
- name: Build and publish
26-
env:
27-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
28-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
29-
run: |
30-
python setup.py sdist bdist_wheel
31-
twine upload dist/*
28+
name: Package-Distributions-construct-typing
29+
path: ./dist
30+
31+
- name: Publish package distributions to PyPI
32+
uses: pypa/gh-action-pypi-publish@release/v1

mypy.ini

Lines changed: 0 additions & 3 deletions
This file was deleted.

pyproject.toml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
2+
[build-system]
3+
requires = ["setuptools >= 75.8.0"]
4+
build-backend = "setuptools.build_meta"
5+
6+
[project]
7+
name="construct-typing"
8+
dynamic = ["version"]
9+
license = { file = "LICENSE" }
10+
description="Extension for the python package 'construct' that adds typing features"
11+
readme = "README.md"
12+
authors=[{ name = "Tim Riddermann" }]
13+
requires-python = ">=3.9"
14+
dependencies = [
15+
"construct==2.10.70",
16+
"typing_extensions>=4.6.0"
17+
]
18+
keywords = [
19+
"construct",
20+
"kaitai",
21+
"declarative",
22+
"data structure",
23+
"struct",
24+
"binary",
25+
"symmetric",
26+
"parser",
27+
"builder",
28+
"parsing",
29+
"building",
30+
"pack",
31+
"unpack",
32+
"packer",
33+
"unpacker",
34+
"bitstring",
35+
"bytestring",
36+
"annotation",
37+
"type hint",
38+
"typing",
39+
"typed",
40+
"bitstruct",
41+
"PEP 561",
42+
]
43+
classifiers = [
44+
"Development Status :: 3 - Alpha",
45+
"License :: OSI Approved :: MIT License",
46+
"Intended Audience :: Developers",
47+
"Topic :: Software Development :: Libraries :: Python Modules",
48+
"Topic :: Software Development :: Build Tools",
49+
"Topic :: Software Development :: Code Generators",
50+
"Programming Language :: Python :: 3",
51+
"Programming Language :: Python :: 3.9",
52+
"Programming Language :: Python :: 3.10",
53+
"Programming Language :: Python :: 3.11",
54+
"Programming Language :: Python :: 3.12",
55+
"Programming Language :: Python :: 3.13",
56+
"Programming Language :: Python :: Implementation :: CPython",
57+
"Typing :: Typed",
58+
]
59+
60+
[project.urls]
61+
"Homepage" = "https://github.com/timrid/construct-typing"
62+
"Bug Reports" = "https://github.com/timrid/construct-typing/issues"
63+
64+
[tool.setuptools]
65+
packages=[
66+
"construct-stubs",
67+
"construct-stubs.lib",
68+
"construct_typed"
69+
]
70+
71+
[tool.setuptools.dynamic]
72+
version = {attr = "construct_typed.version.version_string"}
73+
74+
[tool.mypy]
75+
strict = true
76+
warn_unused_ignores = false

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ black
99
isort
1010
mypy
1111
cryptography
12+
build
13+
setuptools
14+
wheel

setup.py

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)