Open amdei opened 1 year ago
After some reflections I've had a second thought.
importlib.metadata
is better that backported importlib_metadata
importlib.metadata
is still not good enough to obtain all required metadata of not-yet-installed python packagewheel
API from pkginfo
packageGoing to revise my solution accordingly. Stay tuned.
It seems to be working a little bit better now. At least in terms of metadata retrieval.
Things to do:
Architecture: all
;--[no-]python-obey-requirements-txt
fpm's optionAny suggestions/comments/guidelines are still welcome. As well as package samples, where things go wrong.
Thanks for your work on this! I’ll take a look as soon as I can :)
Bottom line:
python3 -m pip install -U wheel
- there was a bug, affected fpm, fixed only very recently.*.whl
file nor from sdist
via any API. But it contains in *.whl
. But I'm not brave enough to parse it in that way (yet). --install-lib
, --install-data
, --install-scripts
and build_scripts --executable
. So all fpm's --python-install-*
options will not work (and currently silently ignored).pip install
is rather short: https://docs.python.org/3/installing/index.html#installing-index Significantly shorter than one would expect.After a while, I hack the Wheel metadata to get information if package is pure or not. https://peps.python.org/pep-0491/ As it seems to be impossible (at least yet) via pkginfo.Wheel API: https://bugs.launchpad.net/pkginfo/+bug/2015657
It reached "works for me" stage. Let's collect feedback before starting to polish things..
Amy update on this? A lot of packages no longer ship setup.py files so if we need to use fpm then we're stuck on old versions
I don't understand what this does? It still requires a legacy setup.py
file to be generated by the python project that is supposed to be converted. However, pretty much all PEP-517 build backends disable the support for generating setup.py
legacy files by default, so they will not be able to be used by fpm
. (some backends don't even offer an option at all to generate legacy setup.py
files)
And if you have a source python project that has the option to generate a legeacy setup.py
enabled, then such a project can already be used as a source in fpm
without this change.
I am a bit confused what this change is supposed to do.
What is the intention of this change?
It still requires a legacy setup.py file
No, it doesn't.
There is an option to use setup.py file
, if it presented.
But if there is pyproject.toml
file - it will be used instead.
It still requires a legacy setup.py file
No, it doesn't.
There is an option to use
setup.py file
, if it presented. But if there ispyproject.toml
file - it will be used instead.
Thanks for the clarification. I'll need to read through the patch again then. :grin:
Although in this MR I made attempt to solve the issue via pip wheel
, not via build
module from PyPA, as suggested in https://github.com/jordansissel/fpm/issues/2040.
Although in this MR I made attempt to solve the issue via
pip wheel
, not viabuild
module from PyPA, as suggested in #2040.
That's excellent. pip wheel
will actually just invoke the Python build
module which takes care of performing the right build process (legacy setup.py vs new PEP-517 build backends)
I will need to test out your PR and report the results.
Specifically, I will need to test with this PEP-517 project ... https://github.com/openai/openai-python
Just an enthusiastic vote for more eyeballs on this merge request ... I would love :heart: to see the project catch up to this shift in the python community.
I will need to test out your PR and report the results.
Quick feedback from my initial testing of this patch:
Testing with
openai
package from PyPI (which uses hatchling as the PEP 517 build backend)My main issue that I'm looking into at the moment is the boot-strapping of the PEP 517 build environments for pip wheel
(and to a lesser degree pip download
... which is a separate story).
I think the main concern so far is the new dependency on the pkginfo
Python library. E.g. on Ubuntu 22.04, the version of python3-pkginfo
is a bit older and does not yet have support for version 2.3 Metadata file formats.
But a lot of wheels will now write 2.3 Metadata file formats.
Therefore, injecting or vendoring an up-to-date version of pkginfo
is important.
TL;DR: It works! (With some limitations at the moment though, as this is work in progress currently)
Limitations:
Temporary limitations (TODOs):
I had no previous experience with ruby, so any suggestions/comments/guidelines are welcome.
@ObjatieGroba - could you please check Python part of code, and give your suggestions on how to improve it?
Fixes #1780 Fixes #1873 Fixes #1860 Fixes magma/magma#13847