Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup.cfg: fix py_modules #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

setup.cfg: fix py_modules #44

wants to merge 1 commit into from

Conversation

imba-tjd
Copy link

fix #43
cc @tresni

@tresni
Copy link
Contributor

tresni commented Oct 3, 2021

I don't think this does anything we want. pip-autoremove is designed to be a user-run script, not an imported module, as per the documentation:

py_modules
A list of strings specifying the modules that setuptools will manipulate.

scripts
A list of strings specifying the standalone script files to be built and installed.

What are you trying to achieve with this? We may need to add the py_modules line, but I don't believe removing the scripts line is what we want. That seems weird as this isn't really written as a module (it's a single script file.) If we moved to py_modules I think we would also need an entry point ala

[options.entry_points]
console_scripts =
    pip-autoremove = pip_autoremove:main

[edit.] Actually we already definite the console_scripts entry point. @imba-tjd do you have some documentation that shows this will resolve the issue and why? Doesn't make a lot of sense to me but if it works and doesn't break anything...

Copy link
Contributor

@tresni tresni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Mac OS 11 and Debian, this works fine for me. I don't have a windows box to test with so have to take @imba-tjd 's word that it works there too.

@imba-tjd
Copy link
Author

imba-tjd commented Oct 3, 2021

The original setup.py uses py_modules, see https://github.com/invl/pip-autoremove/pull/42/files#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7L11

I'm confident this will solve the issue on windows.

Or you can have a try by python3 -m pip_autoremove on whichever OS. Before your patch, it runs. But now, it doesn't.

Actually we already definite the console_scripts entry point

It will do just like python3 -m pip_autoremove, thus won't run. I tried on Linux. It does run. I don't know the reason. But it won't work on Windows anyway, just as the issue reported.

@char101
Copy link

char101 commented Dec 25, 2021

The launcher in Linux is a python script. In Windows it is an exe file.

With python script the first entry in sys.path is the script directory.

But with an exe launcher, the first entry in sys.path is the exe itself (this looks like a bug, or not if the exe has an embedded zip file). That's why it cannot find the pip_autoremove module.

Anyway since pip_autoremove is imported as a module (pip-autoremove = pip_autoremove:main) it is better to put it in lib/python/site-packages rather than installing it in bin/scripts.

@imba-tjd imba-tjd mentioned this pull request Feb 11, 2022
@costal8
Copy link

costal8 commented Feb 17, 2022

I'm on Windows

I moved the pip_autoremove.py file from the \Scripts path into ### \Lib\site-packages
then I typed the command python -m pip_autoremove 'package name' and it worked correctly.

@pedroangelini
Copy link

I'm on Windows

I moved the pip_autoremove.py file from the \Scripts path into ### \Lib\site-packages then I typed the command python -m pip_autoremove 'package name' and it worked correctly.

worked for me too, on Windows, Python 3.10. also works for > pip-autoremove some_package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pip-autoremove 0.10.0 no longer runs on Windows
5 participants