Where does the py_modules
parameter (I don't know what it is called) go in a pyproject.toml
file?
[project]
name = "elements"
version = "1.0.0"
description = "Magic"
readme = "README.md"
requires-python = ">=3.10"
license = {file = "LICENSE"}
authors = [
{name = "x"},
{name = "y"}
]
maintainers = [
{name = "x"},
{name = "y"}
]
[project.scripts]
stuff = "stuff:__init__"
[tool.setuptools]
packages = ["baseclasses", "elements"]
# this raises error.
py_modules = ["__init__"]
[build-system]
requires = ["setuptools>=43.0.0", "wheel"]
build-backend = "setuptools.build_meta"
My project structure looks like this:
.
├── .gitignore
├── LICENSE
├── README.md
├── __init__.py
├── baseclasses
│ ├── __init__.py
│ ├── bunch_of_py_files.py
├── elements
│ ├── __init__.py
│ ├── bunch_of_py_files.py
├── pyproject.toml
I have tried to put it under the project
section and the tool.setuptools
section, but both raised the project must not contain {'py_modules'} properties
error.
I was looking through setuptools and pip docs, but the only thing I could find was for setup.py
files, which I read was being deprecated and as such didn't want to use.
I was able to find the solution here
[tool.setuptools]
packages = ["baseclasses", "elements"]
py-modules = ["__init__"] # dash, not underscore