I want to release a PyPI package that depends on OpenBabel. The maintainers of OpenBabel uploaded binary Windows wheels for Python 3.7, but not for later versions of Python. Christoph Gohlke's excellent site contains wheels for versions 3.8 and up, but they are not on PyPI.
I want users of my package to just pip install my-package and have openbabel installed as well. If they use Python 3.7 on Windows, openbabel will be loaded from PyPI. If they use a newer version of Python, installing my package will fail, because there's no wheel, and installing openbabel from source on Windows is a real pain.
I want to include the precompiled wheels from Christoph Gohlke's site in my wheel, and install them. Is there any reasonable way to do it?
TL;DR: Use local path dependencies instead of normal dependencies.
In this case you will need to embed source code of OpenBabel into your own code (e.g. as a submodule).
Then you will need to change OpenBabel dependency from a normal one into a local one within your project requirement.
After having OpenBabel embeded into your project, you won't need to change the OpenBabel part, and you can continue dev on your own code.
And your will have OpenBabel in your wheel everytime you package your project.
===== Example =====
As an example, your project structure would be like this:
YourProject
├── pyproject.toml
├── openbabel_copy
│ ├── __init__.py
│ └── ...
└── myproject
├── __init__.py
├── a.py
└── ...
In your pyproject.toml, you would have lines like this, if your are using poetry:
[tool.poetry.dependencies]
openbabel = { path = "openbabel_copy" }
scipy = "^1.6.3"
protobuf = "^3.17.1"
...
So that you would be able to use and import openbabel in your myproject without problem.
And this is called local path dependency.
However if your are using other packaging tools, I don't know how to do this...(Poetry is fancy and good to use, except for its slow dependency parsing system...but I would still strongly recommend: )
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