On 05. 06. 20 11:51, Tomas Orsava wrote:
## PyPI parity
Every Python package in Fedora **SHOULD** also be available on [the Python Package Index](https://pypi.org) (PyPI).
The command `pip install PROJECTNAME` **MUST** install the same package (possibly in a different version), install nothing, or fail with a reasonable error message.
What should I imagine under "reasonable error message"?
One that explains the situation. Not a segfault.
I think it's fine to leave this to the packager.
Maybe I'm missing some context, but I'm lost. Are we proposing to add new functionality to pip that somehow handles this? Or how could the packager influence pip's error message?
Try:
$ pip install fedora
$ pip install fedora
Defaulting to user installation because normal
site-packages is not writeable
Collecting fedora
Downloading fedora-0.tar.gz (2.0 kB)
Building wheels for collected packages: fedora
Building wheel for fedora (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys,
setuptools, tokenize; sys.argv[0] =
'"'"'/tmp/pip-install-d5gw3ura/fedora/setup.py'"'"';
__file__='"'"'/tmp/pip-install-d5gw3ura/fedora/setup.py'"'"';f=getattr(tokenize,
'"'"'open'"'"',
open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
'"'"'\n'"'"');f.close();exec(compile(code, __file__,
'"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-baiub5ca
cwd: /tmp/pip-install-d5gw3ura/fedora/
Complete output (72 lines):
running bdist_wheel
running build
running build_py
------------------------------------------------------------------------
# `fedora` on PyPI
This dummy project is not installable.
You probably want `python-fedora` instead.
## pyproject.toml tool.fedora namespace
The [PEP
518](https://www.python.org/dev/peps/pep-0518/#tool-table)
declares
that a project can use the subtable `tool.$NAME` if
`pyproject.toml` if,
and only if, they own the entry for `$NAME` in the
Cheeseshop/PyPI.
That's what this project is for.
We own the entry for `fedora`, so we could use
`tool.fedora` in .
## python-fedora
The Fedora Infra's
[python-fedora](https://github.com/fedora-infra/python-fedora)
project provides an importable module named
`fedora`.
This goes against the convention that PyPI
distribution names should
match the module names.
But, python-fedora pre-dates wide use of that
convention, and the issue
is hard to fix now.
Please install `python-fedora` to get the Fedora
Infra's package.
### Please: Don't install packages blindly
When you see the exception:
```
ModuleNotFoundError: No module named 'foo'
```
… please research the actual requirements instead
of going directly for
`pip install foo`.
The project (distribution) name may differ from the
module(s) it
provides.
------------------------------------------------------------------------
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-d5gw3ura/fedora/setup.py",
line 38, in <module>
zip_safe=False,
File
"/home/torsava/.local/lib/python3.7/site-packages/setuptools/__init__.py",
line 144, in setup
return distutils.core.setup(**attrs)
File "/usr/lib64/python3.7/distutils/core.py",
line 148, in setup
dist.run_commands()
File "/usr/lib64/python3.7/distutils/dist.py",
line 966, in run_commands
self.run_command(cmd)
File "/usr/lib64/python3.7/distutils/dist.py",
line 985, in run_command
cmd_obj.run()
File
"/home/torsava/.local/lib/python3.7/site-packages/wheel/bdist_wheel.py",
line 223, in run
self.run_command('build')
File "/usr/lib64/python3.7/distutils/cmd.py",
line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.7/distutils/dist.py",
line 985, in run_command
cmd_obj.run()
File
"/usr/lib64/python3.7/distutils/command/build.py", line 135, in
run
self.run_command(cmd_name)
File "/usr/lib64/python3.7/distutils/cmd.py",
line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.7/distutils/dist.py",
line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-d5gw3ura/fedora/setup.py",
line 20, in run
'"fedora" is not installable. You probably want
python-fedora.'
ValueError: "fedora" is not installable. You
probably want python-fedora.
----------------------------------------
ERROR: Failed building wheel for fedora
Running setup.py clean for fedora
Failed to build fedora
Installing collected packages: fedora
Running setup.py install for fedora ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys,
setuptools, tokenize; sys.argv[0] =
'"'"'/tmp/pip-install-d5gw3ura/fedora/setup.py'"'"';
__file__='"'"'/tmp/pip-install-d5gw3ura/fedora/setup.py'"'"';f=getattr(tokenize,
'"'"'open'"'"',
open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
'"'"'\n'"'"');f.close();exec(compile(code, __file__,
'"'"'exec'"'"'))' install --record
/tmp/pip-record-6ta5hb06/install-record.txt
--single-version-externally-managed --user --prefix= --compile
--install-headers /home/torsava/.local/include/python3.7m/fedora
cwd: /tmp/pip-install-d5gw3ura/fedora/
Complete output (74 lines):
running install
running build
running build_py
------------------------------------------------------------------------
# `fedora` on PyPI
This dummy project is not installable.
You probably want `python-fedora` instead.
## pyproject.toml tool.fedora namespace
The [PEP
518](https://www.python.org/dev/peps/pep-0518/#tool-table)
declares
that a project can use the subtable `tool.$NAME`
if `pyproject.toml` if,
and only if, they own the entry for `$NAME` in
the Cheeseshop/PyPI.
That's what this project is for.
We own the entry for `fedora`, so we could use
`tool.fedora` in .
## python-fedora
The Fedora Infra's
[python-fedora](https://github.com/fedora-infra/python-fedora)
project provides an importable module named
`fedora`.
This goes against the convention that PyPI
distribution names should
match the module names.
But, python-fedora pre-dates wide use of that
convention, and the issue
is hard to fix now.
Please install `python-fedora` to get the Fedora
Infra's package.
### Please: Don't install packages blindly
When you see the exception:
```
ModuleNotFoundError: No module named 'foo'
```
… please research the actual requirements instead
of going directly for
`pip install foo`.
The project (distribution) name may differ from
the module(s) it
provides.
------------------------------------------------------------------------
Traceback (most recent call last):
File "<string>", line 1, in
<module>
File
"/tmp/pip-install-d5gw3ura/fedora/setup.py", line 38, in
<module>
zip_safe=False,
File
"/home/torsava/.local/lib/python3.7/site-packages/setuptools/__init__.py",
line 144, in setup
return distutils.core.setup(**attrs)
File "/usr/lib64/python3.7/distutils/core.py",
line 148, in setup
dist.run_commands()
File "/usr/lib64/python3.7/distutils/dist.py",
line 966, in run_commands
self.run_command(cmd)
File "/usr/lib64/python3.7/distutils/dist.py",
line 985, in run_command
cmd_obj.run()
File
"/home/torsava/.local/lib/python3.7/site-packages/setuptools/command/install.py",
line 61, in run
return orig.install.run(self)
File
"/usr/lib64/python3.7/distutils/command/install.py", line 556,
in run
self.run_command('build')
File "/usr/lib64/python3.7/distutils/cmd.py",
line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.7/distutils/dist.py",
line 985, in run_command
cmd_obj.run()
File
"/usr/lib64/python3.7/distutils/command/build.py", line 135, in
run
self.run_command(cmd_name)
File "/usr/lib64/python3.7/distutils/cmd.py",
line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.7/distutils/dist.py",
line 985, in run_command
cmd_obj.run()
File
"/tmp/pip-install-d5gw3ura/fedora/setup.py", line 20, in run
'"fedora" is not installable. You probably
want python-fedora.'
ValueError: "fedora" is not installable. You
probably want python-fedora.
----------------------------------------
ERROR: Command errored out with exit status 1:
/usr/bin/python -u -c 'import sys, setuptools, tokenize;
sys.argv[0] =
'"'"'/tmp/pip-install-d5gw3ura/fedora/setup.py'"'"';
__file__='"'"'/tmp/pip-install-d5gw3ura/fedora/setup.py'"'"';f=getattr(tokenize,
'"'"'open'"'"',
open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
'"'"'\n'"'"');f.close();exec(compile(code, __file__,
'"'"'exec'"'"'))' install --record
/tmp/pip-record-6ta5hb06/install-record.txt
--single-version-externally-managed --user --prefix= --compile
--install-headers /home/torsava/.local/include/python3.7m/fedora
Check the logs for full command output.
I see what you mean.
On the other hand, that's a pretty horrible error message format
(posting in it's entirety for others to consider).
Is there no better way to achieve this? For a few packages it's
ok, but I would be weary of introducing this to too many packages.
In the proposal there's talk of blocking the name on PyPI. Is
this the way the blocking will be achieved?