The HEAD of the main branch is failing CI with a number packaging and python 3.7 related issues:
=================================== FAILURES ===================================
__________ TestSdistMetadataFetcher.test_setup_tar_gz_hyphens_in_name __________
self = <tests.functional.test_package.TestSdistMetadataFetcher object at 0x7fd836b41950>
osutils = <chalice.utils.OSUtils object at 0x7fd824d69810>
sdist_reader = <chalice.deploy.packager.SDistMetadataFetcher object at 0x7fd824d69610>
def test_setup_tar_gz_hyphens_in_name(self, osutils, sdist_reader):
# The whole reason we need to use the egg info to get the name and
# version is that we cannot deterministically parse that information
# from the filenames themselves. This test puts hyphens in the name
# and version which would break a simple ``split("-")`` attempt to get
# that information.
setup_py = self._SETUP_PY % (
self._SETUPTOOLS, 'foo-bar', '1.0-2b'
)
with osutils.tempdir() as tempdir:
filepath = self._write_fake_sdist(setup_py, tempdir, 'tar.gz')
name, version = sdist_reader.get_package_name_and_version(
> filepath)
tests/functional/test_package.py:1181:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
chalice/deploy/packager.py:944: in get_package_name_and_version
pkg_info_filepath = self._get_pkg_info_filepath(package_dir)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <chalice.deploy.packager.SDistMetadataFetcher object at 0x7fd824d69610>
package_dir = '/tmp/tmptu6wp3f7/sdist'
def _get_pkg_info_filepath(self, package_dir):
# type: (str) -> str
setup_py = self._osutils.joinpath(package_dir, 'setup.py')
script = self._SETUPTOOLS_SHIM % setup_py
cmd = [sys.executable, '-c', script, '--no-user-cfg', 'egg_info',
'--egg-base', 'egg-info']
egg_info_dir = self._osutils.joinpath(package_dir, 'egg-info')
self._osutils.makedirs(egg_info_dir)
p = subprocess.Popen(cmd, cwd=package_dir,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
_, stderr = p.communicate()
if p.returncode != 0:
logger.debug("Non zero rc (%s) from the setup.py egg_info "
"command: %s", p.returncode, stderr)
info_contents = self._osutils.get_directory_contents(egg_info_dir)
if info_contents:
pkg_info_path = self._osutils.joinpath(
egg_info_dir, info_contents[0], 'PKG-INFO')
else:
# This might be a pep 517 package in which case this PKG-INFO file
# should be available right in the top level directory of the sdist
# in the case where the egg_info command fails.
logger.debug("Using fallback location for PKG-INFO file in "
"package directory: %s", package_dir)
pkg_info_path = self._osutils.joinpath(package_dir, 'PKG-INFO')
if not self._osutils.file_exists(pkg_info_path):
> raise UnsupportedPackageError(self._osutils.basename(package_dir))
E chalice.deploy.packager.UnsupportedPackageError: Unable to retrieve name/version for package: sdist
After digging into this, the error is caused by:
UserWarning: The version specified ('1.0-2b') 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.
"details." % version
running egg_info
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/var/folders/rb/4c1d0xbd18g_wxjcjlvb0whn1cjh5m/T/tmpz0ktt2t6/sdist/setup.py", line 4, in <module>
version="1.0-2b"
File "/Users/j/.virtualenvs/tmp-7470f1bcdc9c52c/lib/python3.7/site-packages/setuptools/__init__.py", line 108, in setup
return distutils.core.setup(**attrs)
File "/Users/j/.virtualenvs/tmp-7470f1bcdc9c52c/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/Users/j/.virtualenvs/tmp-7470f1bcdc9c52c/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/Users/j/.virtualenvs/tmp-7470f1bcdc9c52c/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
File "/Users/j/.virtualenvs/tmp-7470f1bcdc9c52c/lib/python3.7/site-packages/setuptools/dist.py", line 1213, in run_command
super().run_command(command)
File "/Users/j/.virtualenvs/tmp-7470f1bcdc9c52c/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.ensure_finalized()
File "/Users/j/.virtualenvs/tmp-7470f1bcdc9c52c/lib/python3.7/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
self.finalize_options()
File "/Users/j/.virtualenvs/tmp-7470f1bcdc9c52c/lib/python3.7/site-packages/setuptools/command/egg_info.py", line 219, in finalize_options
parsed_version = parse_version(self.egg_version)
File "/Users/j/.virtualenvs/tmp-7470f1bcdc9c52c/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/version.py", line 197, in __init__
raise InvalidVersion(f"Invalid version: '{version}'")
pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.0-2b'
These tests are no longer valid given setuptools will reject packages with these names. This is currently causing all the PRs to fail so I'd like to take care of this so we can start making progress on merging PRs.
For Python 3.7 it seems as though a number of tools we use have dropped support for python 3.7 in their latest versions. What I propose (as a follow up) is to:
Run the full CI on python 3.8+
Extract out just the test runner parts that run on Python 3.7. We're only concerned that the code works on 3.7, I don't think it's worth the hassle (and package dep branching) to run all the linters/typecheckers on python3.7.
The HEAD of the main branch is failing CI with a number packaging and python 3.7 related issues:
After digging into this, the error is caused by:
These tests are no longer valid given setuptools will reject packages with these names. This is currently causing all the PRs to fail so I'd like to take care of this so we can start making progress on merging PRs.
For Python 3.7 it seems as though a number of tools we use have dropped support for python 3.7 in their latest versions. What I propose (as a follow up) is to: