PDM: A wiser option to handle Python packages

Learn extra at:

PDM may run single-file scripts. Python’s PEP 723 added a function known as “inline script metadata,” the place Python recordsdata that begin with a specifically formatted remark block can describe dependencies and different necessities a la pyproject.toml. Whenever you name pdm run to run a Python file that has one of these information, PDM will create a brief digital setting to comprise the wanted dependencies.

Utilizing __pypackages__ with PDM

PDM was initially created to reap the benefits of a function described in PEP 582, which has since been rejected. This concept was to permit a mission to comprise a listing, __pypackages__, the place packages might be bundled as dependencies for a mission with out utilizing a digital setting. In different phrases, the packages might be saved instantly within the mission’s supply tree, however in a approach that didn’t intrude with its listing construction. Such packages wouldn’t should be put in into the mission’s venv as a part of its setup course of.

PEP 582 was not authorized for Python typically, however PDM-managed initiatives can use the __pypackages__ listing on a per-project or global basis. A superb use case for this is able to be when you needed to vendor custom-modified packages right into a mission. On the entire, although, PDM recommends utilizing venvs, as they’re the extra broadly supported answer for isolating mission necessities.

Turn leads into sales with free email marketing tools (en)

Leave a reply

Please enter your comment!
Please enter your name here