I'm currently working on publishing a python package (I've already ran installation tests on test pypi and am able to pip install and run my code cleanly in a clean environment).
Context
I currently have a working directory that contains 1) source distribution 2) build distribution 3) src folder containing my package which contains all my code for my library 4) README, LICENSE, pyproject.toml file utilizing setuptools. This working directory has a local git repository which is hooked up to a remote repository (on github).
Problem and My Attempt to Fix It
However, I'm confused about one thing that I couldn't find a clear answer on, even after looking through documentation. I have .py files, in my git repository and working directory, that I DO NOT want to include in my ACTUAL release to pypi. I attempted to use a MANIFEST.in file and used the exclude
command to take these files out, but I found out that MANIFEST.in doesn't exclude python modules (.py files) in the build distributions (wheels), so when I pip install my package, the modules that I wanted gone are still included in the package on the user end. So tldr; How can I keep all my files in the working directory, but exclude certain .py files in the build distribution (before I publish to pypi)?
If I have any mistakes in my terminology/understanding of this, please correct me as I am new to this workflow of publishing packages.
Edit: I figured out a workaround, but still haven't solved this issue.
I originally wanted to exclude a single python module (a .py file) from the bdist because I didn't want the module to be accessible on the user end (i.e. if someone writes from library_name import *
, I didn't want my file to be imported for them to use), however, I still wanted this file to be tracked on my git repository so that it would show up on my github repo for this project.
Instead of excluding the file from my bdist, I just included it in the bdist, but I made sure to not import it in the __init__.py
so that the user couldn't access it by importing. Not the most elegant solution but it is sufficient for my situation. I will leave this question open because I am open to suggestions on how to address this.