Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Action for publishing to PyPI #125

Merged
merged 3 commits into from
Sep 14, 2022
Merged

Conversation

sethmlarson
Copy link
Collaborator

This PR adds a GitHub Action which can publish to PyPI. There are a few things @kjd you'll need to configure to get things working:

  • Create a GitHub Environment for this repository named "publish"
  • For this environment add yourself (and maybe other collaborators) as required reviewers to publish to this environment.
  • Add a secret named PYPI_TOKEN to this environment

The workflow to publish will then be to push a tag, one of us will review the environment deployment, and then the GitHub Action will run which builds the distributables and uploads them to PyPI. Let me know if you have questions about this configuration.

I also removed the setup.py that was added recently. This file in it's current state isn't providing support for legacy users, see this output of python setup.py install:

python setup.py install
running install
running bdist_egg
running egg_info
creating UNKNOWN.egg-info
writing UNKNOWN.egg-info/PKG-INFO
writing dependency_links to UNKNOWN.egg-info/dependency_links.txt
writing top-level names to UNKNOWN.egg-info/top_level.txt
writing manifest file 'UNKNOWN.egg-info/SOURCES.txt'
reading manifest file 'UNKNOWN.egg-info/SOURCES.txt'
writing manifest file 'UNKNOWN.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
warning: install_lib: 'build/lib' does not exist -- no Python modules to install

creating build
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying UNKNOWN.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying UNKNOWN.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying UNKNOWN.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying UNKNOWN.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/UNKNOWN-0.0.0-py3.9.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing UNKNOWN-0.0.0-py3.9.egg
Copying UNKNOWN-0.0.0-py3.9.egg to /home/sethmlarson/idna/venv/lib/python3.9/site-packages
Adding UNKNOWN 0.0.0 to easy-install.pth file

Installed /home/sethmlarson/idna/venv/lib/python3.9/site-packages/UNKNOWN-0.0.0-py3.9.egg
Processing dependencies for UNKNOWN==0.0.0
Finished processing dependencies for UNKNOWN==0.0.0

@kjd Is there something in particular that prompted adding back setup.py?

@kjd
Copy link
Owner

kjd commented Sep 14, 2022

Restoring setup.py was triggered by firstly reconciling the fact the documentation still advised python setup.py install for installation, and I used the approach described at https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html which seemed to work for me in some basic testing, but apparently not tested sufficiently.

Since setup.py was used until this release it seemed to be prudent to not deprecate it in a single release in case people's pipelines relied upon it. Maybe that is an overly conservative take, but if the setup.py is now broken i guess a followup release is in order.

@sethmlarson
Copy link
Collaborator Author

@kjd Did you use python -m build or python setup.py sdist bdist_wheel to create the dists on PyPI?

If it's the latter I suggest yanking the release. I'm away from my computer currently so can't help firefight if there is something wrong.

@kjd
Copy link
Owner

kjd commented Sep 14, 2022

I used flit per your prior PR and I think the wheel and sdist posted are sound.

@sethmlarson
Copy link
Collaborator Author

Great, yeah they're all good then.

@kjd kjd merged commit 13c518c into kjd:master Sep 14, 2022
@kjd
Copy link
Owner

kjd commented Sep 14, 2022

I've merged this PR but still wrapping my head around it a little bit. I understand that it doesn't use flit to build the package and instead uses pip. I know flit expressly sets the sdist files' UID and GID to 0 and also scrubs the user names and group names. I suspect this Github action may do something similar incidentally through the container but that probably needs some validation to stop a regression on #123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants