Repository: apytypes/apytypes (language: python)

Issue:
Provide source distribution on pypi
I think the docs are quite clear https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives

You should always upload a source distribution and provide built distributions for the platforms your project is compatible with.


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a5dfda8ae..be21dfd16 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -42,6 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
   denominators.
 - Fix bug where single-dimensional tuple representations missed out on a comma.
 - Fix bug in comparison between floating-point infinity and fixed-point numbers.
+- Start uploading source distributions of APyTypes to PyPI on releases.
 
 ### Removed
 


Test patch:
diff --git a/.github/workflows/publish-test-pypi.yml b/.github/workflows/publish-test-pypi.yml
index b0b664544..7e94db031 100644
--- a/.github/workflows/publish-test-pypi.yml
+++ b/.github/workflows/publish-test-pypi.yml
@@ -20,7 +20,7 @@ on:
 jobs:
 
   # Wheel-building job-step using cibuildwheel
-  build:
+  build-wheel:
     name: Build wheel ${{ matrix.os }} 📦
     if: >-
       (github.event_name == 'push' && github.ref == 'refs/heads/main') ||
@@ -50,28 +50,45 @@ jobs:
 
       - uses: actions/upload-artifact@v4
         with:
-          name: apytypes-wheels-${{ matrix.os }}-${{ strategy.job-index }}
+          name: apytypes-dist-wheels-${{ matrix.os }}-${{ strategy.job-index }}
           path: ./wheelhouse/*.whl
           if-no-files-found: error
 
+  # Source-distribution building job-step
+  build-sdist:
+    name: Build source distribution
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - uses: actions/setup-python@v3
+      - name: Install Python Build
+        run: python -m pip install build
+      - name: Run Python Build
+        run: python -m build --sdist
+      - uses: actions/upload-artifact@v4
+        with:
+          name: apytypes-dist-sdist-${{ strategy.job-index }}
+          path: dist/*.tar.gz
+          if-no-files-found: error
+
   # Official publication to PyPi (on new tags)
   publish-to-pypi:
     name: Publish to PyPI 📦
     if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')  # only publish to PyPI on tag pushes
     needs:
-    - build
+    - build-wheel
+    - build-sdist
     runs-on: ubuntu-latest
     environment:
       name: pypi
       url: https://pypi.org/p/apytypes/
     permissions:
       id-token: write  # IMPORTANT: mandatory for trusted publishing
-
     steps:
-    - name: Download all the wheels
+    - name: Download all the distributions
       uses: actions/download-artifact@v4
       with:
-        pattern: apytypes-wheels-*
+        pattern: apytypes-dist-*
         path: dist
         merge-multiple: true
     - name: Publish distribution 📦 to PyPI