Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove default encoding checks for py-fast tox env #1474

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

rmartin16
Copy link
Member

I don't understand why....but tox -e py-fast fails for a default encoding from setuptools_scm...but tox -e py does not...

❯ tox -e py-fast
.pkg: _optional_hooks> python /home/russell/github/beeware/briefcase/venv-3.11-briefcase/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: get_requires_for_build_wheel> python /home/russell/github/beeware/briefcase/venv-3.11-briefcase/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: get_requires_for_build_editable> python /home/russell/github/beeware/briefcase/venv-3.11-briefcase/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: build_editable> python /home/russell/github/beeware/briefcase/venv-3.11-briefcase/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
py-fast: install_package> python -I -m pip install --force-reinstall --no-deps /home/russell/github/beeware/briefcase/.tox/.tmp/package/2/briefcase-0.3.16.dev246+g8daf920c-0.editable-py3-none-any.whl
py-fast: commands[0]> python -X warn_default_encoding -m pytest -vv --color yes -n auto
ImportError while loading conftest '/home/russell/github/beeware/briefcase/tests/conftest.py'.
tests/conftest.py:8: in <module>
    from briefcase.config import AppConfig
src/briefcase/__init__.py:12: in <module>
    __version__ = get_version("../..", relative_to=__file__)  # pragma: no cover
.tox/py-fast/lib/python3.11/site-packages/setuptools_scm/_get_version_impl.py:151: in get_version
    maybe_version = _get_version(config, force_write_version_files=True)
.tox/py-fast/lib/python3.11/site-packages/setuptools_scm/_get_version_impl.py:89: in _get_version
    parsed_version = parse_version(config)
.tox/py-fast/lib/python3.11/site-packages/setuptools_scm/_get_version_impl.py:52: in parse_version
    or parse_scm_version(config)
.tox/py-fast/lib/python3.11/site-packages/setuptools_scm/_get_version_impl.py:37: in parse_scm_version
    return _entrypoints.version_from_entrypoint(config, entrypoint, root)
.tox/py-fast/lib/python3.11/site-packages/setuptools_scm/_entrypoints.py:55: in version_from_entrypoint
    maybe_version: version.ScmVersion | None = fn(root, config=config)
.tox/py-fast/lib/python3.11/site-packages/setuptools_scm/git.py:207: in parse
    _require_command("git")
.tox/py-fast/lib/python3.11/site-packages/setuptools_scm/_run_cmd.py:200: in require_command
    if not has_command(name, warn=False):
.tox/py-fast/lib/python3.11/site-packages/setuptools_scm/_run_cmd.py:177: in has_command
    p = run([name, *args], cwd=".", timeout=5)
.tox/py-fast/lib/python3.11/site-packages/setuptools_scm/_run_cmd.py:138: in run
    res = subprocess.run(
../../../.pyenv/versions/3.11.4/lib/python3.11/subprocess.py:548: in run
    with Popen(*popenargs, **kwargs) as process:
../../../.pyenv/versions/3.11.4/lib/python3.11/subprocess.py:877: in __init__
    self.encoding = encoding = _text_encoding()
../../../.pyenv/versions/3.11.4/lib/python3.11/subprocess.py:372: in _text_encoding
    warnings.warn("'encoding' argument not specified.",
E   EncodingWarning: 'encoding' argument not specified.
py-fast: exit 4 (0.30 seconds) /home/russell/github/beeware/briefcase> python -X warn_default_encoding -m pytest -vv --color yes -n auto pid=1754412
.pkg: _exit> python /home/russell/github/beeware/briefcase/venv-3.11-briefcase/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
  py-fast: FAIL code 4 (3.03=setup[2.74]+cmd[0.30] seconds)
  evaluation failed :( (3.16 seconds)

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@rmartin16 rmartin16 marked this pull request as ready for review October 2, 2023 18:54
Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be a bug in setuptools_scm, combined with a change in Python itself.

setuptools_scm is using a slightly weird way to specify the encoding when they identify whether git is installed. This approach doesn't cause a problem on Python 3.10, but the Python 3.10 sources explicitly call out that the behavior will change in future - and lo, in Python 3.11, it does.

AFAICT< It doesn't effect non-fast running because coverage -m doesn't pass the -X warn_default_encoding down to the invocation of setuptools_scm.

I've logged this with setuptools as pypa/setuptools-scm#950. In the meantime, I agree this is the pragmatic solution.

@freakboy3742 freakboy3742 merged commit 939b17a into beeware:main Oct 3, 2023
35 checks passed
@rmartin16 rmartin16 deleted the limit-default-encoding-check branch October 3, 2023 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants