dasboth
dasboth

Reputation: 226

How do I create a wheel from a manually altered Python package?

I have a Python package I installed locally, thrift-sasl, but because of Python 3 compatibility issues I had to change the source code slightly, so I now have a "custom" version of thrift-sasl.

I work with conda environments, and if I create a new one where I want to use thrift-sasl I don't want to have to make that manual change each time.

Is a wheel the right way to "repackage" this library and if so, how do I do it? The wheel documentation doesn't obviously address this use case so I'm unsure.

Upvotes: 1

Views: 2025

Answers (1)

dasboth
dasboth

Reputation: 226

Thanks to the comments I figured it out. I had to create my own setup.py (outside the thrift-sasl folder) with just the following in it:

from setuptools import setup

setup(name="thrift-sasl", version="0.2.1dev", packages=["thrift_sasl"])

where version is something you can make up and thrift_sasl is the name of the folder that contains the source files.

I could then run

python setup.py bdist_wheel

which creates a dist folder, in which is the correct wheel, which can be installed with:

pip install path_to_wheel.whl

Upvotes: 2

Related Questions