I’m not sure I understand you. However, building for python implies creating bindings in the .pyd format. It is enough to run the build via python of the required version and with the --use-python flag.
I don’t know how to use Python libraries without installing them via pip install. I hear about the .pyd format for the first time. I found this information:
.pyd files are dll’s, but there are a few differences. If you have a DLL named foo.pyd, then it must have a function PyInit_foo(). You can then write Python import foo, and Python will search for foo.pyd (as well as foo.py, foo.pyc) and if it finds it, will attempt to call PyInit_foo() to initialize it. You do not link your .exe with foo.lib, as that would cause Windows to require the DLL to be present.
Note that the search path for foo.pyd is PYTHONPATH, not the same as the path that Windows uses to search for foo.dll. Also, foo.pyd need not be present to run your program, whereas if you linked your program with a dll, the dll is required. Of course, foo.pyd is required if you want to say import foo. In a DLL, the linkage is declared in the source code with __declspec(dllexport). In a .pyd, linkage is defined in a list of available functions.
It’s like a dll in C++. If I understand correctly, I can build with the --use-python flag. The file panda3d.pyd will be created. Should I copy this file to every project I have? What is the size of this file?
In fact, there are several of them, depending on the modules that you specified during the build. You can install any panda distribution, if you are windows, then find the “panda3d” folder in the SDK root folder as a package. You can study it.
.dll files in for windows and .so files in unix systems. They are present if the linking was dynamic. When dynamically linking a file .pyd will load data from them.
Of course you have to copy it into every project. However, there is an option to use sys.path or registry. At the moment, the SDK for Windows uses the system registry to search for the panda3d module, how this is done is unknown to me.
There are other ways to install Python packages, namely by putting the “built” directory to your PYTHONPATH environment variable, or by installing the package into your system’s site-packages/dist-packages directory. For example, if you build an Ubuntu .deb package with the --installer flag, this will install Panda3D into your system’s dist-packages directory. Or a Windows .exe installer will add the paths to the Panda3D installation to the Windows Registry so that Python can find the modules.
However, creating a wheel is certainly also a valid way of installing a Panda3D build. Pass the --wheel flag in Panda3D, and it will create a .whl file.
Building Panda3D as wheels is acceptable, however, this does not exempt from generating files with the extension .pyd. For this reason, it is a misconception, so this is a goal for a package manager that is third-party to python. In other words, it’s just a specialized installer for python.