https://pantsbuild.org/ logo
#general
Title
# general
m

magnificent-hairdresser-5608

04/23/2022, 7:21 PM
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

bitter-ability-32190

04/23/2022, 7:49 PM
Have you tried
python_distributiob
?
👍 1
h

happy-kitchen-89482

04/23/2022, 10:49 PM
m

magnificent-hairdresser-5608

04/24/2022, 6:41 AM
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

bitter-ability-32190

04/24/2022, 2:56 PM
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

magnificent-hairdresser-5608

04/24/2022, 4:43 PM
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

high-yak-85899

04/25/2022, 9:05 PM
@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

magnificent-hairdresser-5608

04/30/2022, 4:06 PM
@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

bitter-ability-32190

04/30/2022, 7:55 PM
Mind if I mark this ?
m

magnificent-hairdresser-5608

04/30/2022, 8:07 PM
In my opinion, yes. Thanks 👍
4 Views