biglocalnews / warn-scraper

Command-line interface for downloading WARN Act notices of qualified plant closings and mass layoffs from state government websites
https://warn-scraper.readthedocs.io
Apache License 2.0
29 stars 10 forks source link

Update reasonable build suite #667

Open stucka opened 1 week ago

stucka commented 1 week ago

Related to #665 , the build suite is out of date along with the regular testing suite.

warn-transformer, of a similar vintage and related stack, encountered build problems caused by Github's rollout of a newer version of git itself onto its Actions runner images.

The fix for warn-transformer may have been to update setuptools_scm to 8.1.0, seen here: https://github.com/biglocalnews/warn-transformer/issues/278

Trying to update to a similar version in warn-scraper failed miserably; looks like possibly make test may be running the wrong tooling to work with with newer versions of some things.

Run make test
  make test
  shell: /usr/bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.9.19/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.19/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.19/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.19/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.19/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.19/x64/lib
  __________
 |BIG🌲LOCAL|
 |&&& ======|
 |=== ======|  This is a Big Local News automation
 |=== == %%%|
 |[_] ======|         🤖 Running tests 🤖
 |=== ===!##|
 |__________|

/home/runner/.local/share/virtualenvs/warn-scraper-y6CRbt1U/lib/python3.9/site-packages/setuptools/__init__.py:94: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!

        ********************************************************************************
        Requirements should be satisfied by a PEP 517 installer.
        If you are using pip, you can try `pip install --use-pep517`.
        ********************************************************************************

!!
  dist.fetch_build_eggs(dist.setup_requires)
/home/runner/.local/share/virtualenvs/warn-scraper-y6CRbt1U/lib/python3.9/site-packages/setuptools/_distutils/dist.py:261: UserWarning: Unknown distribution option: 'test_suite'
  warnings.warn(msg)
/home/runner/.local/share/virtualenvs/warn-scraper-y6CRbt1U/lib/python3.9/site-packages/setuptools/_distutils/dist.py:261: UserWarning: Unknown distribution option: 'tests_require'
  warnings.warn(msg)
[09/10/24 15:14:03] WARNING  toml section missing        pyproject_reading.py:42
                             'pyproject.toml does not                           
                             contain a                                          
                             tool.setuptools_scm                                
                             section'                                           
                             Traceback (most recent call                        
                             last):                                             
                               File                                             
                             "/home/runner/.local/share/                        
                             virtualenvs/warn-scraper-y6                        
                             CRbt1U/lib/python3.9/site-p                        
                             ackages/setuptools_scm/_int                        
                             egration/pyproject_reading.                        
                             py", line 36, in                                   
                             read_pyproject                                     
                                 section =                                      
                             defn.get("tool",                                   
                             {})[tool_name]                                     
                             KeyError: 'setuptools_scm'                         
/home/runner/.local/share/virtualenvs/warn-scraper-y6CRbt1U/lib/python3.9/site-packages/setuptools_scm/git.py:167: UserWarning: "/home/runner/work/warn-scraper/warn-scraper" is shallow and may cause errors
  warnings.warn(f'"{wd.path}" is shallow and may cause errors')
/home/runner/work/warn-scraper/warn-scraper/.eggs/pytest_runner-6.0.1-py3.9.egg/ptr/__init__.py:81: SetuptoolsDeprecationWarning: The test command is disabled and references to it are deprecated.
!!

        ********************************************************************************
        Please remove any references to `setuptools.command.test` in all supported versions of the affected package.

        By 2024-Nov-15, you need to update your project and remove deprecated calls
        or your builds will no longer be supported.
        ********************************************************************************

!!
  class PyTest(orig.test):
Traceback (most recent call last):
  File "/home/runner/work/warn-scraper/warn-scraper/setup.py", line 116, in <module>
    setup(
  File "/home/runner/.local/share/virtualenvs/warn-scraper-y6CRbt1U/lib/python3.9/site-packages/setuptools/__init__.py", line 117, in setup
    return distutils.core.setup(**attrs)
  File "/home/runner/.local/share/virtualenvs/warn-scraper-y6CRbt1U/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 184, in setup
    return run_commands(dist)
  File "/home/runner/.local/share/virtualenvs/warn-scraper-y6CRbt1U/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
    dist.run_commands()
  File "/home/runner/.local/share/virtualenvs/warn-scraper-y6CRbt1U/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands
    self.run_command(cmd)
  File "/home/runner/.local/share/virtualenvs/warn-scraper-y6CRbt1U/lib/python3.9/site-packages/setuptools/dist.py", line 950, in run_command
    super().run_command(command)
  File "/home/runner/.local/share/virtualenvs/warn-scraper-y6CRbt1U/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
    cmd_obj.run()
  File "/home/runner/work/warn-scraper/warn-scraper/.eggs/pytest_runner-6.0.1-py3.9.egg/ptr/__init__.py", line 195, in run
    setattr(dist, attr, getattr(self.distribution, attr))
AttributeError: 'Distribution' object has no attribute 'tests_require'
make: *** [Makefile:95: test] Error 1
Error: Process completed with exit code 2.
stucka commented 1 week ago

I'm wondering if this might be tied to setup.py's local_version function.

stucka commented 1 week ago

Or possibly the setuptools_scm==8.1.0 that patches the git incompatibilities ... causes this problem.

https://github.com/pypa/setuptools-scm/issues/938#issuecomment-2234037294

stucka commented 1 week ago

There appear to be multiple incompatibilities because of deprecations in setuptools. A migration guide: https://packaging.python.org/en/latest/guides/modernize-setup-py-project/#modernize-setup-py-project

stucka commented 1 week ago

setup.py requires things that have been deprecated.

pipenv is now hardcoded to setuptools_scm==8.1.0 (higher version needed to work with git changes) while setuptools==71.1.0 because newer versions will break on the setup.py problems.

While the immediate crisis is past, I'm leaving this issue open because we now have multiple structural problems in the build and testing suite that should be addressed.