python-poetry / python-poetry/poetry
`poetry install` run under pre-commit hook does not apply changes.
Open
Nobody has claimed this yet.
area/docs
area/installer
kind/bug
status/triage
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
Description
pre-commit run poetry-install passed but acted as no-op.
The expected package was not in the venv.
A regular: poetry install noticed the missing package.
Workarounds
Manually poetry install.
Poetry Installation Method
pipx
Operating System
Win 10
Poetry Version
v1.8.2
Poetry Configuration
> poetry config --list
cache-dir = "~\\AppData\\Local\\pypoetry\\Cache"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}\\virtualenvs" # ~\AppData\Local\pypoetry\Cache\virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true
Python Sysconfig
> python -m sysconfig
Platform: "win-amd64"
Python version: "3.12"
Current installation scheme: "venv"
Paths:
data = "<repo>\.venv"
include = "~\scoop\apps\python\3.12.3\Include"
platinclude = "~\scoop\apps\python\3.12.3\Include"
platlib = "<repo>\.venv\Lib\site-packages"
platstdlib = "<repo>\.venv\Lib"
purelib = "<repo>\.venv\Lib\site-packages"
scripts = "<repo>\.venv\Scripts"
stdlib = "~\scoop\apps\python\3.12.3\Lib"
Variables:
BINDIR = "<repo>\.venv\Scripts"
BINLIBDEST = "<repo>\.venv\Lib"
EXE = ".exe"
EXT_SUFFIX = ".cp312-win_amd64.pyd"
INCLUDEPY = "~\scoop\apps\python\3.12.3\Include"
LIBDEST = "~\scoop\apps\python\3.12.3\Lib"
TZPATH = ""
VERSION = "312"
VPATH = "..\.."
abiflags = ""
base = "<repo>\.venv"
exec_prefix = "<repo>\.venv"
installed_base = "~\scoop\apps\python\3.12.3"
installed_platbase = "~\scoop\apps\python\3.12.3"
platbase = "<repo>\.venv"
platlibdir = "DLLs"
prefix = "<repo>\.venv"
projectbase = "~\scoop\apps\python\3.12.3"
py_version = "3.12.3"
py_version_nodot = "312"
py_version_nodot_plat = "312"
py_version_short = "3.12"
srcdir = "~\scoop\apps\python\3.12.3"
userbase = "%HOMEDRIVE%%HOMEPATH%\.python"
Example pyproject.toml
[virtualenvs]
in-project = true
Precommit:
default_install_hook_types: [pre-commit, post-checkout]
default_stages: [pre-commit]
fail_fast: true
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/python-poetry/poetry
rev: "1.8.0"
hooks:
- id: poetry-check
- id: poetry-lock
- id: poetry-export
- id: poetry-install
Repo Transcript
> poetry install --dry-run
Installing dependencies from lock file
Package operations: 1 install, 0 updates, 0 removals, 179 skipped
- Installing pip (23.3.1): Skipped for the following reason: Already installed
...
- Installing watermark (2.4.3)
- Installing voluptuous (0.13.1): Skipped for the following reason: Already installed
- Installing wheel (0.41.3): Skipped for the following reason: Already installed
- Installing wcwidth (0.2.9): Skipped for the following reason: Already installed
- Installing yarl (1.9.2): Skipped for the following reason: Already installed
- Installing widgetsnbextension (4.0.9): Skipped for the following reason: Already installed
- Installing tzdata (2023.3): Skipped for the following reason: Already installed
- Installing zipp (3.18.1): Skipped for the following reason: Already installed
- Installing zc-lockfile (3.0.post1): Skipped for the following reason: Already installed
Installing the current project: <package> (0.10.0)
> git checkout
Your branch is up to date with 'origin/<branch>'.
poetry-install...........................................................Passed
dvc checkout.............................................................Passed
> python -c "import watermark"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'watermark'
> poetry env list
.venv (Activated)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Windows 10 case using the shown pyproject.toml and pre-commit configuration, then compare pre-commit run poetry-install with direct poetry install and the active .venv. Confirm the behavior around the poetry-install hook and its environment; done means the missing watermark package is installed and importable afterward.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100