Skip to content

Encoding Warnings with PEP 597 Warnings Enabled #8892

@danyeaw

Description

@danyeaw
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

With PEP 597 Encoding Warnings enabled using PYTHONWARNDEFAULTENCODING=true, Poetry prints encoding warnings while doing a poetry install.

In a future version of Python, UTF-8 will be the default encoding. It is also easy to assume that the default encoding right now is UTF-8, which can introduce bugs for Windows users.

If there is interest in fixing this, I would be glad to submit a PR to resolve these warnings. We could also enable the Encoding Warnings on Poetry's GitHub Actions to avoid further introduction of code without encodings specified.

poetry install --only main,packaging --no-interaction
C:\hostedtoolcache\windows\Python\3.11.7\x64\Lib\site-packages\poetry\utils\env\base_env.py:350: EncodingWarning: 'encoding' argument not specified.
  output = subprocess.check_output(
C:\hostedtoolcache\windows\Python\3.11.7\x64\Lib\site-packages\poetry\repositories\installed_repository.py:61: EncodingWarning: 'encoding' argument not specified
  with pth_file.open() as f:
Installing dependencies from lock file

Package operations: 7 installs, 2 updates, 0 removals

  � Updating pycairo (1.25.1 C:/gtk-build/gtk/x64/release/pycairo-1.25.1-cp311-cp311-win_amd64.whl -> 1.25.1)
  � Installing altgraph (0.17.4)
  � Installing pefile (2023.2.7)
  � Updating pygobject (3.46.0 C:/gtk-build/gtk/x64/release/PyGObject-3.46.0-cp311-cp311-win_amd64.whl -> 3.46.0)
  � Installing pyinstaller-hooks-contrib (2023.12)
  � Installing pywin32-ctypes (0.2.2)
  � Installing pyinstaller (6.3.0)
  � Installing pyinstaller-versionfile (2.1.1)
  � Installing semver (3.0.2)

Installing the current project: gaphor (2.23.2.dev4693+fda8f833)
C:\hostedtoolcache\windows\Python\3.11.7\x64\Lib\site-packages\poetry\masonry\builders\editable.py:130: EncodingWarning: UTF-8 Mode affects locale.getpreferredencoding(). Consider locale.getencoding() instead.
  pth_file, content, encoding=locale.getpreferredencoding()
C:\hostedtoolcache\windows\Python\3.11.7\x64\Lib\site-packages\poetry\masonry\builders\editable.py:233: EncodingWarning: 'encoding' argument not specified
  direct_url_json.write_text(
Run poetry run pip install --force-reinstall (Resolve-Path C:\gtk-build\gtk\x64\release\PyGObject*.whl)
C:\hostedtoolcache\windows\Python\3.11.7\x64\Lib\site-packages\poetry\utils\env\base_env.py:350: EncodingWarning: 'encoding' argument not specified.
  output = subprocess.check_output(
Processing c:\gtk-build\gtk\x64\release\pygobject-3.46.0-cp311-cp311-win_amd64.whl
Collecting pycairo>=1.16.0 (from PyGObject==3.46.0)
  Using cached pycairo-1.25.1-cp311-cp311-win_amd64.whl.metadata (2.8 kB)
Using cached pycairo-1.25.1-cp311-cp311-win_amd64.whl (877 kB)
Installing collected packages: pycairo, PyGObject
  Attempting uninstall: pycairo
    Found existing installation: pycairo 1.25.1
    Uninstalling pycairo-1.25.1:
      Successfully uninstalled pycairo-1.25.1
  Attempting uninstall: PyGObject
    Found existing installation: PyGObject 3.46.0
    Uninstalling PyGObject-3.46.0:
      Successfully uninstalled PyGObject-3.46.0
Successfully installed PyGObject-3.46.0 pycairo-1.25.1

Notice:  A new release of pip is available: 23.3.1 -> 23.3.2
Notice:  To update, run: python.exe -m pip install --upgrade pip
C:\hostedtoolcache\windows\Python\3.11.7\x64\Lib\site-packages\poetry\utils\env\base_env.py:350: EncodingWarning: 'encoding' argument not specified.
  output = subprocess.check_output(
Processing c:\gtk-build\gtk\x64\release\pycairo-1.25.1-cp311-cp311-win_amd64.whl
Installing collected packages: pycairo
  Attempting uninstall: pycairo
    Found existing installation: pycairo 1.25.1
    Uninstalling pycairo-1.25.1:
      Successfully uninstalled pycairo-1.25.1
Successfully installed pycairo-1.25.1

Notice:  A new release of pip is available: 23.3.1 -> 23.3.2
Notice:  To update, run: python.exe -m pip install --upgrade pip
Run poetry build
C:\hostedtoolcache\windows\Python\3.11.7\x64\Lib\site-packages\poetry\utils\env\base_env.py:350: EncodingWarning: 'encoding' argument not specified.
  output = subprocess.check_output(
Building gaphor (2.23.2.dev4693+fda8f833)
  - Building sdist
C:\hostedtoolcache\windows\Python\3.11.7\x64\Lib\site-packages\poetry\core\vcs\__init__.py:27: EncodingWarning: 'encoding' argument not specified.
  git_dir = subprocess.check_output(
  - Built gaphor-2.23.2.dev4693+fda8f833.tar.gz
  - Building wheel
  - Built gaphor-2.23.2.dev4693+fda8f833-py3-none-any.whl
C:\hostedtoolcache\windows\Python\3.11.7\x64\Lib\site-packages\poetry\utils\env\base_env.py:350: EncodingWarning: 'encoding' argument not specified.
  output = subprocess.check_output()

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expectedstatus/triageThis issue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions