setuptools
setuptools copied to clipboard
[BUG] pyproject.toml doesn't always install all entry points, but setup.py does
setuptools version
67.4.0
Python version
python 3.10.10
OS
Windows
Additional environment information
I've got a large command line set that I use across platforms called zcmds
Recently I noticed that the root command zcmds which is designed to print out all commands, was missing. Looking at the **/Scripts directory I see that some of the executables are installed, some of them are not.
Description
I was able to resolve it by folding pyproject.toml into the setup.py file. Now everything works!
This is the broken version: https://github.com/zackees/zcmds/commit/04e85af5504a7cbc829dd727d7c2a468f75a07e9
And this works: https://github.com/zackees/zcmds/commit/2c9b19561b5ddf93cd302571e010cf22cabac478
The difference between these two change lists is folding pyproject.toml into setup.py and the deletion of pyproject.toml
Expected behavior
I expect the zcmds toolset and all exe's to be generated.
How to Reproduce
git clone https://github.com/zackees/zcmds
cd zcmds
pip install -e .
zcmds
You should see
zcmds:
common:
archive
askai
audnorm
comports
diskaudit
findfiles
fixinternet
geninvoice
gitsummary
img2vid
img2webp
imgai
losslesscut
myip
obs_organize
pdf2png
pdf2txt
printenv
say
search_and_replace
search_in_files
sharedir
stereo2mono
test_net_connection
vid2gif
vid2jpg
vid2mp3
vid2mp4
vid2webm
vidcat
vidclip
viddur
vidhero
vidinfo
vidlist
vidmatrix
vidmute
vidshrink
vidspeed
vidvol
vidwebmaster
whichall
zcmds
win32:
cat
cp
du
fixvmmem
git-bash
grep
home
ls
mv
open
rm
sudo
touch
which
Instead there is a file not found error.
Output
Note that yes, I did remove python 3.10 and did a fresh re-install and the problem still persisted.
If you want to use my exact copy of python 3.10 then use this installer that I've saved to my github:
https://github.com/zackees/python3.10.
You can also use this script at the Win command terminal which will install python 3.10 and add it to the path.
powershell -Command "Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/zackees/python3.10/main/winpyinstall310.bat' -OutFile 'winpyinstall310.bat'; .\winpyinstall310.bat"
Hi @zackees ,I am not sure what you mean by pyproject.toml not installing the entry-points... following the "broken" link you sent I cannot see entry_points or scripts being specified in pyproject.toml. I also don't see dynamic allowing these fields to be filled in by setup.py... So it seems that the configuration that you are providing implies that no entry-point should be installed (which matches the observed behaviour).
Could you please clarify?
As one of the changes I tried I used dynamic for the entry_points in pyproject.toml and none of the behaviors changed - the bug still manifested.
Also, it looks like entry points is still being installed without the dynamic part, not all, but most.
So it seems that the configuration that you are providing implies that no entry-point should be installed (which matches the observed behaviour).
Again try it, entry points were being installed without dynamic. And adding dynamic didn't change anything.
Hi @zackees , I am away from my pc and I will not be able to try it before January.
I am assuming that you want to have both pyproject.toml for the metadata but to define the entry-points dynamically in the setup.py script, right?
If that is the case, I suggest setting dynamic = ["scripts", "entry-points", ...] (both things).
When installing/building, please have a look on the logs provided by setuptools, there might be some information there. pip hades the logs, but if you run pip -vv install, it should show it to you.
Also it might be worthy having a look on the contents of the .tar.gz and .whl files created when you run python -m build to make sure all the intended files are there.
I am assuming that you want to have both pyproject.toml for the metadata but to define the entry-points dynamically in the setup.py script, right?
Yes.
If that is the case, I suggest setting dynamic = ["scripts", "entry-points", ...] (both things).
Yeah! That was it!
Adding both scripts and entry-points resolved the issue!
Bad case, showing the missing zcmds.exe:
Good case:
In the bad case, it seems that some of the exe's are inserted, even without entry-points and scripts as a dynamic entry.