Reputation: 742
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.
Upvotes: 1
Views: 342
Reputation: 539
require
is for build time dependencies.
You want to use dependencies
for runtime ones.
i.e.
dependencies = ["package1", "package2"]
Upvotes: 1
Reputation: 742
I've managed to solve it in the meantime.
Q1: These are packages required during the build, not for using the package.
Q2: Use setuptool and the setup.py file instead of pyproject.toml The content of the file is in my case:
from setuptools import setup
setup(
name='my_package',
version='1.0.0',
description='Description',
author='Karol',
packages=['my_package'],
install_requires=[
'numpy~=1.23.4',
'pillow~=9.3.0',
'pydicom~=2.3.1'
],
zip_safe=False
)
Upvotes: 0