setup.py of my package X uses setuptools to optionally install an extra package Y, via the extras_require
parameter.
Now package Y disappeared from PyPi and, as far as I can tell, from the visible Internet. easy_install X[Y]
fails with error: Could not find suitable distribution for Y
.
However, I still have a local copy of Y's tarball. Y is a pure-Python package.
What is the best way to modify setup.py to allow this (local?) optional extra?
EDIT: The fix is meant to be temporary, until I figure out a proper replacement. I do not want to start officially maintaining Y myself :)
To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.
To add a new module or change the version of an existing module, use the --additional-python-modules job parameter key with a value containing a list of comma-separated Python modules. This allows your AWS Glue 2.0 ETL job to install the additional modules using the Python package installer (pip3).
You could subclass setuptools.Command
and then overload the default install
command. Then you could have THAT execute a subprocess that installs the dependency. It's a hack, but that's what you were asking for!
In setup.py:
from setuptools import Command
class MyInstallCommand(Command):
# Overload the 'install' command to do default install but also install
# your provided tarball. Blah blah blah read the docs on what to do here.
setup(
name='mypackage',
# etc ... and then...
# Overload the 'install' command
cmdclass={
'install': MyInstallCommand,
}
)
I'm grossly oversimplifying it, but this is the basic gist.
I found a quick workaround via the dependency_links
option of setuptools.
http://URL_Y
.dependency_links = ['http://URL_Y'],
to my setup.py.Now easy_install X[Y]
works and I didn't have to register Y anywhere. I will delete it from URL_Y as soon as I have a proper fix.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With