question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`python_requires` not written when only `--min-py3-version` is specified

See original GitHub issue

See repro:

def test_guess_python_min_version(tmpdir):
    setup_cfg = tmpdir.join('setup.cfg')
    setup_cfg.write(
        '[metadata]\n'
        'name = pkg\n'
        'version = 1.0\n',
    )

    assert main((str(setup_cfg), '--min-py3-version=3.8'))
$ pytest -vvv -k test_guess_python_min_version tests/setup_cfg_fmt_test.py
========================================= test session starts ==========================================
platform darwin -- Python 3.9.15, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /Users/mxr/src/mxr/unkey/venv/bin/python
cachedir: .pytest_cache
rootdir: /Users/mxr/src/asottile/setup-cfg-fmt
collected 67 items / 66 deselected / 1 selected                                                        

tests/setup_cfg_fmt_test.py::test_guess_python_min_version FAILED                                [100%]

=============================================== FAILURES ===============================================
____________________________________ test_guess_python_min_version _____________________________________

tmpdir = local('/private/var/folders/mg/2_7nx7493qg0vn9jhdp951tw0000gp/T/pytest-of-mxr/pytest-10/test_guess_python_min_version0')

    def test_guess_python_min_version(tmpdir):
        setup_cfg = tmpdir.join('setup.cfg')
        setup_cfg.write(
            '[metadata]\n'
            'name = pkg\n'
            'version = 1.0\n',
        )
    
>       assert main((str(setup_cfg), '--min-py3-version=3.8'))
E       AssertionError: assert 0
E        +  where 0 = main(('/private/var/folders/mg/2_7nx7493qg0vn9jhdp951tw0000gp/T/pytest-of-mxr/pytest-10/test_guess_python_min_version0/setup.cfg', '--min-py3-version=3.8'))

tests/setup_cfg_fmt_test.py:667: AssertionError
======================================= short test summary info ========================================
FAILED tests/setup_cfg_fmt_test.py::test_guess_python_min_version - AssertionError: assert 0
=================================== 1 failed, 66 deselected in 0.17s ===================================

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Dec 11, 2022

yeah the latter probably makes more sense

1reaction
mxrcommented, Dec 8, 2022

Going to try to get a PR for this out this week

Read more comments on GitHub >

github_iconTop Results From Across the Web

setuptools could respect python_requires · Issue #1633 - GitHub
Expected: Command fails with an error explaining that the Python version isn't supported. Some packages workaround this by adding the following ...
Read more >
pip ignores python_requires field in setup - Stack Overflow
[metadata] name = mathsom python_requires = '>=3.8' ... Problem is that I created an enviroment with Python 3.7 and installation had no problems ......
Read more >
Packaging and distributing projects
python_requires. If your project only runs on certain Python versions, setting the python_requires argument to the appropriate PEP 440 version specifier string ...
Read more >
PythonPackage — Spack 0.17.1 documentation
If Python 2.7 is the only version that works, you can use: depends_on('python@2.7:2.8', type=('build', 'run')). The documentation may not always specify ...
Read more >
2. The basic structure of a Python package
You can specify version requirements, such as numpy>=1.7 , using the standard pip syntax. If you have a dependency that is not on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found