Hi all. Is there any good practice for distributin...
# general
m
Hi all. Is there any good practice for distributing "wheel" files with the pinned dependencies (similar to what Pants does with the
pex_binary
)? Currently, in our company, we do not have any
pex
registry and we publish our Python libraries/applications on an in-house PyPI registry. So, it is convenient to be able to publish our applications similar to our libraries by wheel files.
1
b
Have you tried
python_distributiob
?
👍 1
h
m
Yes, I do. The
python_distribution
target generates wheel files using the raw requirements themselves (not the pinned requirements). But the
pex_binary
target uses the generated lock files. Am I wrong?
b
I'm on mobile, so I'm not sure exactly. You could use your own
setup.py
or
pyproject.toml
to specify whatever metadata you want
m
In that case, I should pin requirements myself, and it produces some duplications (requirements and properties) inside the
setup.py
file. I found a fairly good solution using the Pants documentation. What about depending
python_distribution
to a
pex_binary
target and register the
pex
file as a console
entry_point
(Pants
entry_point
supports
pex_binary
dependency). https://www.pantsbuild.org/docs/python-distributions#using-a-generated-setuppy It has some pros and cons. The application doesn't depend on any other library and it could be installed safely without virtual-environment creation or Pipx. But its size will be very large.
h
@magnificent-hairdresser-5608, I did something similar recently. I agree about the size, but I found that much easier to deal with than pulling in a distribution and separately having to pip install it. The problem here is that a distribution isn't meant to have locked dependencies. It should be flexible so that others can pull it into their systems that have separate requirements that have to be resolved while taking your distribution into consideration. If you're wanting something to drop into a system with explicit dependencies, I have found pex much nicer to work with.
👍 2
m
@high-yak-85899 Thanks. You're right. Finally, we decided to use the pex in the core and for each platform, use the standard packaging around it (for example, the Debian package and repository for Debian-based distributions).
b
Mind if I mark this ?
m
In my opinion, yes. Thanks 👍