Skip to content

Commit 6919115

Browse files
committed
fix: build process
1 parent 747c336 commit 6919115

File tree

4 files changed

+43
-61
lines changed

4 files changed

+43
-61
lines changed

.github/workflows/python-publish.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ jobs:
4646
build-and-publish:
4747
needs: test
4848
runs-on: ubuntu-latest
49-
# Only run this job on release creation or tag push
5049
if: github.event_name == 'release' || startsWith(github.ref, 'refs/tags/v')
5150

5251
steps:
@@ -60,53 +59,54 @@ jobs:
6059
- name: Install dependencies
6160
run: |
6261
python -m pip install --upgrade pip
63-
pip install build twine
64-
pip install -e .
62+
pip install -e .[dev]
6563
6664
- name: Generate models
6765
run: |
6866
python scripts/generate_models.py
67+
echo "Generated $(find msgspec_schemaorg/models -type f -name "*.py" | wc -l) model files"
6968
7069
- name: Build package
7170
run: |
71+
# Build the package
7272
python -m build
73+
74+
# Verify package contents
75+
echo "Verifying package contents..."
76+
77+
# Check source distribution
78+
mkdir -p /tmp/check-sdist
79+
tar -xf dist/*.tar.gz -C /tmp/check-sdist
80+
MODEL_COUNT=$(find /tmp/check-sdist -name "*.py" | grep models | wc -l)
81+
echo "Source distribution contains $MODEL_COUNT model files"
82+
if [ "$MODEL_COUNT" -lt 900 ]; then
83+
echo "ERROR: Not enough model files in source distribution"
84+
exit 1
85+
fi
86+
87+
# Install and verify the wheel
88+
pip install dist/*.whl
89+
python -c "import msgspec_schemaorg.models; count = len(msgspec_schemaorg.models.__all__); print(f'Wheel contains {count} importable models'); assert count > 900, 'Not enough models'"
7390
74-
- name: Upload package distributions
91+
- name: Upload distributions
7592
uses: actions/upload-artifact@v4
7693
with:
7794
name: python-package-distributions
7895
path: dist/
7996

8097
- name: Publish to PyPI
81-
if: github.event_name == 'release' || startsWith(github.ref, 'refs/tags/v')
8298
uses: pypa/gh-action-pypi-publish@release/v1
8399
with:
84-
user: __token__
85100
password: ${{ secrets.PYPI_API_TOKEN }}
86101
skip-existing: true
87102

88-
- name: Sign the dists with Sigstore
103+
- name: Sign with Sigstore
89104
uses: sigstore/gh-action-sigstore-python@v3.0.0
90105
with:
91-
inputs: >-
92-
./dist/*.tar.gz
93-
./dist/*.whl
106+
inputs: ./dist/*.tar.gz ./dist/*.whl
94107

95-
- name: Create GitHub Release
96-
env:
97-
GITHUB_TOKEN: ${{ github.token }}
98-
run: >-
99-
gh release create
100-
"$GITHUB_REF_NAME"
101-
--repo "$GITHUB_REPOSITORY"
102-
--notes "This release was automatically created by the GitHub Actions workflow."
103-
- name: Upload artifact signatures to GitHub Release
108+
- name: Upload to GitHub Release
104109
env:
105110
GITHUB_TOKEN: ${{ github.token }}
106-
# Upload to GitHub Release using the `gh` CLI.
107-
# `dist/` contains the built packages, and the
108-
# sigstore-produced signatures and certificates.
109-
run: >-
110-
gh release upload
111-
"$GITHUB_REF_NAME" dist/**
112-
--repo "$GITHUB_REPOSITORY"
111+
run: |
112+
gh release upload "$GITHUB_REF_NAME" dist/** --repo "$GITHUB_REPOSITORY"

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
recursive-include msgspec_schemaorg/models *.py
1+
recursive-include msgspec_schemaorg *.py
2+
recursive-include scripts *.py
23
include README.md
34
include LICENSE

pyproject.toml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
2-
requires = ["hatchling"]
3-
build-backend = "hatchling.build"
2+
requires = ["setuptools>=61.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "msgspec-schemaorg"
@@ -22,9 +22,20 @@ dependencies = [
2222
"requests>=2.28.0",
2323
]
2424

25+
[project.scripts]
26+
msgspec-schemaorg-generate = "msgspec_schemaorg.cli:generate_models_command"
27+
2528
[project.urls]
2629
"Homepage" = "https://github.com/mikewolfd/msgspec-schemaorg"
2730
"Bug Tracker" = "https://github.com/mikewolfd/msgspec-schemaorg/issues"
2831

29-
[tool.hatch.build.targets.wheel]
30-
packages = ["msgspec_schemaorg"]
32+
[project.optional-dependencies]
33+
dev = [
34+
"build",
35+
"twine",
36+
"pytest"
37+
]
38+
39+
[tool.setuptools]
40+
packages = ["msgspec_schemaorg"]
41+
include-package-data = true

setup.py

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

0 commit comments

Comments
 (0)