pypa / pypa/setuptools

unittest2 version causes a warning

Open
#1,889 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

Building unittest2 now emits a warning

[   51s] writing unittest2.egg-info/PKG-INFO
[   51s] writing dependency_links to unittest2.egg-info/dependency_links.txt
[   51s] writing entry points to unittest2.egg-info/entry_points.txt
[   51s] writing requirements to unittest2.egg-info/requires.txt
[   51s] writing top-level names to unittest2.egg-info/top_level.txt
[   51s] reading manifest file 'unittest2.egg-info/SOURCES.txt'
[   51s] writing manifest file 'unittest2.egg-info/SOURCES.txt'
[   51s] Copying unittest2.egg-info to /home/abuild/rpmbuild/BUILDROOT/python-unittest2-1.1.0-64.1.x86_64/usr/lib/python3.7/site-packages/unittest2-1.1.0-py3.7.egg-info
[   51s] running install_scripts
[   51s] Installing unit2 script to /home/abuild/rpmbuild/BUILDROOT/python-unittest2-1.1.0-64.1.x86_64/usr/bin
[   51s] /usr/lib/python3.7/site-packages/setuptools/dist.py:484: UserWarning: The version specified (<__main__.late_version object at 0x7fa76cfb8eb8>) is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
[   51s]   "details." % self.metadata.version

It is correctly detecting the version as 1.1.0 when determining the egg-info folder, but elsewhere it is failing.

The unittest2 version parameter is a class which has a __str__ method, so str(..) needs to be called on it.

Based on https://github.com/pypa/setuptools/blob/b3ef77b/setuptools/dist.py#L480 , which is all very old code (5yrs old), it may be that a change occurred in packaging to cause this warning to happen. However, this isnt a recent change. I can reproduce the warning on setuptools 38.4.1 & packaging 16.8.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in setuptools/dist.py around the version validation logic referenced in the issue and inspect how the unittest2 version object is passed to the warning. Reproduce the build with setuptools 38.4.1 and packaging 16.8, then confirm the warning no longer reports an invalid version while the generated egg-info still uses 1.1.0.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.