What's the status of scripts vs entry_points?

It appears that entry_points have replaced scripts in setuptools (and packaging in general?). Is there a standard around this or official doc? pypa/installer won’t install scripts for example, but it will install entry_points. Should scripts be considered deprecated?

I don’t think there’s anything formal. Scripts are not as well supported (as you discovered) and don’t work well on Windows (where .exe files are the only reliable way of implementing a new command - see here for details). So I’d say that entry points are the better cross-platform solution.

1 Like

Thanks. Does a call need to be made at some stage? I seem to recall pip at some stage had/has future plans (probably far future) to switch installation logic to pypa/installer. Or is that mostly conjecture on my part?

It doesn’t matter whether pip switches to installer or not — wheels are installed in the same manner, by installer.

The way scripts in setuptools works is that it dumps the file directly into the scripts scheme. Entry points will dump a wrapper to call the entry point. The main reason to prefer entry points is for cross platform support (as mentioned)

If we want to kill placing raw files in the scripts scheme, we would only be able to do that by breaking backwards compatibility, and one place to do that would be a wheel 2.0 format.

2 Likes

What about fully deprecating/dropping support on the build backend side instead (does anything other than Setuptools actually implement scripts?) That would guide authors to use entry points instead for new releases and projects, while not breaking compatibility with existing releases. @abravalheri does Setuptools have current plans in that regard?

It’s a useful thing on its own — cmake · PyPI puts an executable in there, as part of a correctly tagged wheel. You can’t do that if we drop things on the wheel format level, so… might make sense on a backend level, but setuptools might be too generic a backend to disallow this sort of thing.

2 Likes

Setuptools supports it “as it is”[1]. I don’t think there are plans to drop or improve support for these files.

If I am not wrong, we do recommend in the docs to use entry-points whenever possible.


  1. with all the existing limitations (e.g. incomplete “editable” behaviour) ↩︎