3

I'm trying to create a Python package. I have a setup.cfg which contains this section:

install_requires =
    pyo>=1.0.4
    pywebview>=3.4
    strictyaml>=1.4.4

When I run python3 -m build in the project directory, I get a dist/mypackage.whl as expected. When I switch to another virtual environment to test installing it with pip install mypackage.whl, that works too; however, it doesn't install the dependencies. In fact, the dependencies aren't mentioned in the .whl file at all, as I tested this using

unzip -c mypackage.whl 'mypackage.dist-info/*' | grep pyo

which didn't bring anything up.

Is dependency information even supposed to be included in a wheel? This SO post would suggest so. If not, is this what requirements.txt is for?

Edit: Here's my full setup.cfg and packages version info:

[metadata]
name = mypackage
version = 0.1
author = David Husz
long_description = file: README.md
long_description_content_type = text/markdown
install_requires =
    pyo>=1.0.4
    pywebview>=3.4
    strictyaml>=1.4.4
classifiers =
    Programming Language :: Python :: 3
    Operating System :: OS Independent

[options]
package_dir =
    = src
packages = find:
include_package_data = True
python_requires = >=3.6

[options.packages.find]
where = src

My setuptools version is 57.4.0, and my build version is 0.5.1.

David Husz
  • 48
  • 4

1 Answers1

3

install_requires is not a [metadata] setting but an [options] setting

move that down to the [options] section and you should be good to go!

here's an example from one of my projects: https://github.com/asottile/setup-cfg-fmt/blob/f7d50142cec2174daeee4a67cebf2d161c0cca46/setup.cfg#L25-L26

anthony sottile
  • 61,815
  • 15
  • 148
  • 207