I have a package structure as follows:
program_root/
- src/
- tests/
- data/
- templates/
- docs/
- build/
- dist/
- pyproject.toml
- README
- requirements.txt
My pyproject.toml:
[build-system]
requires = ["setuptools==62.6.0", "wheel"]
build-backend = "setuptools.build_meta"
[tool.setuptools]
package-dir = {"" = "src"}
[tool.setuptools.packages.find]
where = ["src"]
[tool.setuptools.package-data]
"*" = ["*.*"]
[project]
name = "file_ops"
version = "1.0.0"
authors = [
{name="abc", email="[email protected]" },
]
dynamic = ["dependencies"]
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
when I am trying to build the package, I keep getting the error.
using python -m build
command, I am getting the following error:
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
The reason why I specifically used the setuptools version 62.6.0
is that it’s the version in which setuptools introduced file attribute as following:
dependencies = {file = ["requirements.txt"]}
Now , when I have gone through the release notes of py 3.12, I got to know that ImpImporter is deprecated.
So, Using some other versions of setuptools gives one of the following errors:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Backend subproccess exited when trying to invoke get_requires_for_build_sdist
I am confused as to what version of setuptools should I use now to build the package successfully.
This setuptools history (2nd Point) says that few fields are still in beta. how to know what are they exactly?
Please help me understand if I am doing anything wrong here.
BTW, I am strongly inclined to use only toml file for my packaging needs.