Search code examples
pythonpippackaging

How to install dependencies of a custom python package


I have built a Python package according to the documentation: https://packaging.python.org/en/latest/tutorials/packaging-projects/

Everything works, but when I call pip install my_package.whl, the dependencies are not installed.

The dependencies are listed in the pyproject.toml file as follows: requires = ["hatchling", "package1", "package2"]

Question 1. During the build, I can see the following log:

* Installing packages in isolated environment... (hatchling, pydicom~=2.3.1)

What does it mean the dependencies installed and for what purpose?

Question 2. How to achieve the behavior, where after typing 'pip install my_package.whl', the required dependencies are installed beforehand. This must be possible, becaus all of the available python packages work this way.


Solution

  • require is for build time dependencies.

    You want to use dependencies for runtime ones.

    i.e.

    dependencies = ["package1", "package2"]