Re: help wanted with modern Python packaging macros (%generate_buildrequires, %tox)

2020-09-10 Thread Miro Hrončok

On 11. 09. 20 1:11, Miro Hrončok wrote:

Side note 0: I see the tox config also has:

[testenv]
extras =
 dev

This is something the %pyproject_buildrequires don't understand yet, I'll open a 
bugzilla.


https://bugzilla.redhat.com/show_bug.cgi?id=1877977


Side note 1: I see you have:

 %pyproject_buildrequires ... -x route53 -x plesk

I am not sure this will work, as the macro only recently gained support for 
multiple comma-separated extras passed as:


 %pyproject_buildrequires ... -x route53,plesk

This was due to my false idea that RPM macros cannot handle repeated flags. 
Apparently they can, so I'll open a bugzilla to adapt the script to support the 
more natural way, thanks for the idea.


https://bugzilla.redhat.com/show_bug.cgi?id=1877978

--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok
___
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org


Re: help wanted with modern Python packaging macros (%generate_buildrequires, %tox)

2020-09-10 Thread Miro Hrončok

On 11. 09. 20 0:23, Felix Schwarz wrote:

My main problem is shown at the end of this mail: Somehow the Python extras
subpackage name is bad but I don't know how to debug this (without spending a
lot of time).


The error is:


Error: The package name contains an extras name `easyname` that was not found
in the metadata.


The extras declared in pyproject.toml are:

[tool.poetry.extras]
namecheap = ["pynamecheap"]
route53 = ["boto3"]
transip = ["transip"]
plesk = ["xmltodict"]
localzone = ["localzone"]
softlayer = ["softlayer"]
gransy = ["zeep"]
# Extra "full" list must contain all other extras
full = ["pynamecheap", "boto3", "transip", "xmltodict", "localzone", 
"softlayer", "zeep"]


Indeed, easyname does not exist here.

The changelog section has:


* The `beautifulsoup4` dependency has been integrated to the core
  ones for generic purpose. As a consequence `henet`, `easyname` and `gratisdns`
  providers do not have optional dependencies anymore.


As it seems, the henet, easyname and gratisdns extras were removed. (Which is 
not consistent with what the changelog says.)


Maybe upstream is relying on the fact that pip happily installs any nonexistent 
extra:


$ pip install 'dns-lexicon[hodor]==3.4'
...
Successfully installed dns-lexicon-3.4.0

I'd advise to keep the extras declared in upstream, as:

henet = []
easyname = []
gratisdns = []

See this note in setuptools documentation (final paragraph):

https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies


Note, by the way, that if a project ends up not needing any other packages
to support a feature, it should keep an empty requirements list for that
feature in its extras_require argument, so that packages depending on that > 
feature don’t break (due to an invalid feature name).


You can workaround this on packaging level by removing the 3 subpackages and 
adding this to the "main" package:


Obsoletes: python3-%{pypi_name}+gratisdns < 3.4
Provides: python3dist(%{pypi_name}[gratisdns]) = %{version}
Provides: python%{python3_version}dist(%{pypi_name}[gratisdns]) = %{version}

(repeat for all three)

Alternatively, since nothing in Fedora requires those, just obsolete them and be 
done with it (don't add the provides).





Additionally (but lower priority) just using %tox in %check fails (I think it
tries to download dependencies?).


The upstream's tox file has:

[testenv:light]
commands =
poetry install --no-root -v

I am afraid the %tox macro can only work with "static" deps declaration, not 
with arbitrary installers invoked as commands, sorry about that. I have no idea 
how this should be done "right" from upstream perspective :(




Side note 0: I see the tox config also has:

[testenv]
extras =
dev

This is something the %pyproject_buildrequires don't understand yet, I'll open a 
bugzilla.




Side note 1: I see you have:

%pyproject_buildrequires ... -x route53 -x plesk

I am not sure this will work, as the macro only recently gained support for 
multiple comma-separated extras passed as:


%pyproject_buildrequires ... -x route53,plesk

This was due to my false idea that RPM macros cannot handle repeated flags. 
Apparently they can, so I'll open a bugzilla to adapt the script to support the 
more natural way, thanks for the idea.




Side note 2: I see you've put %generate_buildrequires near the other 
buildrequires. I understand the sentiment, but the %generate_buildrequires 
section happens between %prep and %build, so I highly recommend keeping the same 
order in the spec file.



Thanks fro giving the new macros a try! Feel free to catch me in #fedora-python 
tomorrow (I'm calling it a day after creating those bugzillas) if you'd like to 
iterate in real time.


--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok
___
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org


help wanted with modern Python packaging macros (%generate_buildrequires, %tox)

2020-09-10 Thread Felix Schwarz
Hi,

I wanted to update python-dns-lexicon. Version 3.4 uses poetry and tox so I
thought it would be a good idea to get a grip on %generate_buildrequires, %tox
etc.

Unfortunately I'm a bit stuck at the moment. Maybe this is just because I'm
starring for too long on some spec file (and probably my knowledge of
tox+macros is lacking).

I pushed the current state to:
https://src.fedoraproject.org/fork/fschwarz/rpms/python-dns-lexicon/commits/master

My main problem is shown at the end of this mail: Somehow the Python extras
subpackage name is bad but I don't know how to debug this (without spending a
lot of time).

Additionally (but lower priority) just using %tox in %check fails (I think it
tries to download dependencies?).

Any help/pointers appreciated.
Felix



$ fedpkg --release=f33 mockbuild
…
Obsoletes: python-dns-lexicon < 3.4.0-1.fc33
Processing files: python3-dns-lexicon+easyname-3.4.0-1.fc33.noarch

Error: The package name contains an extras name `easyname` that was not found
in the metadata.
Check if the extras were removed from the project. If so, consider removing
the subpackage and obsoleting it from another.

error: Dependency tokens must begin with alpha-numeric, '_' or '/': ***
PYTHON_EXTRAS_NOT_FOUND_ERROR___SEE_STDERR ***

Error: The package name contains an extras name `easyname` that was not found
in the metadata.
Check if the extras were removed from the project. If so, consider removing
the subpackage and obsoleting it from another.

error: Dependency tokens must begin with alpha-numeric, '_' or '/': ***
PYTHON_EXTRAS_NOT_FOUND_ERROR___SEE_STDERR ***
Provides: python-dns-lexicon+easyname = 3.4.0-1.fc33
python3-dns-lexicon+easyname = 3.4.0-1.fc33 python3.9-dns-lexicon+easyname =
3.4.0-1.fc33
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests)
<= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Obsoletes: python-dns-lexicon+easyname < 3.4.0-1.fc33


RPM build errors:
absolute symlink: /usr/bin/lexicon-3 -> /usr/bin/lexicon-3.9
Dependency tokens must begin with alpha-numeric, '_' or '/': ***
PYTHON_EXTRAS_NOT_FOUND_ERROR___SEE_STDERR ***
Dependency tokens must begin with alpha-numeric, '_' or '/': ***
PYTHON_EXTRAS_NOT_FOUND_ERROR___SEE_STDERR ***
Finish: rpmbuild python-dns-lexicon-3.4.0-1.fc33.src.rpm
Finish: build phase for python-dns-lexicon-3.4.0-1.fc33.src.rpm
___
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org