pnpm installed a Python project's dependencies but never the project itself, so `import <project>` failed after an install and the commands in `[project.scripts]` were missing from the environment. Every repository surveyed in pnpm/pnpm#14945 needs the project importable to run anything. The environment now also holds the project's own package. pnpm does not build it: it writes a `.pth` file pointing at the project's source tree plus the `.dist-info` an installed distribution records (METADATA, entry_points.txt, a direct_url.json marking it editable, INSTALLER and RECORD). That is what an editable install is, so an edit to a module takes effect without another install. A project is packaged when it declares a `[build-system]`, and `tool.uv.package` overrides that either way, which is how uv decides too. Modules are imported from the package directories the build backend declares in `[tool.hatch.build]`, `[tool.hatch.build.targets.wheel]` or `[tool.setuptools] package-dir`; a project that declares none uses `src` when it has such a directory, and the project directory otherwise. Running a backend's PEP 660 `build_editable` hook would need an isolated build environment and the network, neither of which this integration has, so the layout is read from the manifest instead. A project whose version is dynamic gets its dependencies and a warning, since pnpm cannot record a version only a build backend knows. So does one whose `[tool.setuptools] package-dir` maps a package into a directory that no `sys.path` entry stands in for. A `.pth` file names one directory per line, and Python runs a line that starts with `import`, so a declared package directory carrying a line break or reaching outside the project is refused rather than installed. PEP 621 reserves `console_scripts` and `gui_scripts` in `[project.entry-points]`, and declaring either there is now an error naming the table to use instead. The wheel writer in `host.py` became an `Environment` class so the project's package writes its files, scripts and RECORD through the same collision checks and entry point validation as a wheel. Related to pnpm/pnpm#14945.
465 B
465 B
pacquet
| pacquet |
|---|
| minor |
pnpm install now installs a Python project's own package, so the project can be imported and the commands in [project.scripts] run right after an install #14945. The installed package points at the source tree, so an edit to a module takes effect without another install. pnpm installs the package of a project that declares a [build-system]. tool.uv.package overrides that either way.