-
Hi, I'm using GitHub Actions with cibuildwheel to build and publish my Python package, but I'd like to exclude the Python source code files (.py files) from the generated wheel files to protect the source code. Here’s my current workflow file: name: Publish Package
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install cibuildwheel twine cython
- name: Build wheels with cibuildwheel
env:
CIBW_BUILD: "cp311-*"
run: |
cibuildwheel --output-dir dist
- name: Publish to PyPI
if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch'
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*
The wheels build successfully and are published to PyPI, but they still contain the Thank you ! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
You are using very old versions of GitHub Actions. setup-python is on v5, for example. I'd also recommend the PyPA action for uploading instead of manually using twine (and using trusted publishers instead of tokens or especially username/password). Anyway, controlling what files go into your wheel is done by the backend. What backend are you using? Also, usually, you want both See https://learn.scientific-python.org/development/guides/. |
Beta Was this translation helpful? Give feedback.
-
Fixed setting |
Beta Was this translation helpful? Give feedback.
Fixed setting
packages
parameter as empty list (packages=[]
) insetup.py
Thanks @henryiii