Open tikuma-lsuhsc opened 2 hours ago
What's the package.name
value? It needs to be mypkg
for this to work. It looks for src/<name>
, python/<name>
, and <name>
. Otherwise, you have to specify tool.scikit-build.wheel.packages
. This matches the way hatchling works. Setuptools instead has a massive ignore list and looks for a package-like directory that is not in that ignore list, which does let you use differing names without configuration, but is fairly fragile.
Personally, I'd move src/mypkg/core
to a different spot, like src/core
or core
. As it is, you'll probably also want to exclude the src/mypkg/core
directory from your wheel, as you don't need the source code installed.
What's the package.name value? It needs to be mypkg for this to work. It looks for src/
, python/ , and .
Ah, <name>
is the package name and not any arbitrary name. I misunderstood it as the name of the first subdirectory. My package name is indeed different from distro name, so it sounds like I must use wheel.packages
. (Reason: the module name has been already taken by another project's distro name in PyPI .)
It's likely too late to change the auto-detection behavior, but I'd prefer scikit-build-core
to scan for the packages in src
and define CMake variables for each top-level package found, e.g., SKBUILD_PACKAGE_mypkg
. Too crazy of an idea?
Personally, I'd move src/mypkg/core to a different spot, like src/core or core. As it is, you'll probably also want to exclude the src/mypkg/core directory from your wheel, as you don't need the source code installed.
You're absolutely right. I didn't think of that side effect. This also explains why you suggest python/<name>
!
You should be really careful about mismatching names. It may come back to haunt you like https://github.com/pypa/packaging-problems/issues/818. There's no general solution for an import name fight.
The mismatching-name concern, duly noted! Thank you for the clarification! I'm closing the issue now.
In #932, @henryiii mentioned that
I cannot seem to get this feature to work. My project file structure looks like this:
The root
CMakeLists.txt
includes the only install line:According to the documentation,
src/mypkg
should be automatically picked up as thewheel-install-dir
and by @henryiii's comment above,__init__.py
should be automatically included in the installation, Afterpip -e .
install, I should be able to doimport mypkg.core
but getsModuleNotFoundError
.pip
installed the.pyd
file insite-packages/mypkg
directory (no__init__.py
) as well as_myproject_editable.*
files in thesite-packages
directory.