Skip to content

(🐞) install --compile installs with optimization level 1, which is confusing and undocumented #7639

@KotlinIsland

Description

@KotlinIsland
  • Poetry version: 1.4.0
  • Python version: 3.11.2
  • OS version and name: Windows/LiGNUx
  • pyproject.toml:
[tool.poetry]
name = "poetry-test"
version = "0.1.0"
description = ""
authors = [""]

[tool.poetry.dependencies]
python = "^3.11"
pendulum = "*"
  • [🚀] 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

👉 poetry install --compile
Installing dependencies from lock file

Package operations: 1 install, 0 updates, 0 removals

  • Installing pendulum (2.1.2)
👉 Get-ChildItem $VIRTUAL_ENV\Lib\site-packages\pendulum\__pycache__ | Select-Object Name

Name                             
----
__init__.cpython-312.opt-1.pyc
__version__.cpython-312.opt-1.pyc
constants.cpython-312.opt-1.pyc
date.cpython-312.opt-1.pyc
datetime.cpython-312.opt-1.pyc
duration.cpython-312.opt-1.pyc
exceptions.cpython-312.opt-1.pyc
helpers.cpython-312.opt-1.pyc
parser.cpython-312.opt-1.pyc
period.cpython-312.opt-1.pyc
time.cpython-312.opt-1.pyc

Additionally

I have no idea why these are labeled with cpython-312, my venv is python3.11

`👉 poetry env info`
👉 poetry env info

Virtualenv
Python:         3.11.2
Implementation: CPython
Path:           C:\Users\amongus\AppData\Local\pypoetry\Cache\virtualenvs\poetry-test-RGMhFuFN-py3.11
Executable:     C:\Users\amongus\AppData\Local\pypoetry\Cache\virtualenvs\poetry-test-RGMhFuFN-py3.11\Scripts\python.exe
Valid:          True

System
Platform:   win32
OS:         nt
Python:     3.11.2
Path:       C:\Users\amongus\AppData\Local\Programs\Python\Python311
Executable: C:\Users\amongus\AppData\Local\Programs\Python\Python311\python.exe  

Could this be a bug(🐞)?

Okay, so basically

  • (🐞) This is different to poetry 1.3.x, which installed compiled at normal level, not opt-1.
  • (👩‍💻) There is no way to pick a different level, apart from disabling the new installer entirely.
  • (📚) This behavior is not documented.

My use case

I need my deps to be compiled, but I don't want opt-1 because I like to keep the asserts. Additionally, I would need to setup my entire project to use python -O x, as otherwise it will just compile on the spot anyway.

Workaround

Use python -m compileall.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/installerRelated to the dependency installerkind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions