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

#627 allow for the -I option in the Python interpreter wrapper #628

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

janwijbrand
Copy link

See issue #627.

@gotcha
Copy link
Member

gotcha commented Mar 9, 2023

I am a bit uneasy with the fact that the option is accepted but silently swallowed. If ever anyone actually needs its normal effect, it will be hard to debug.

Would there be a way to advertise the flag is accepted but swallowed that would support your VSCode use case ?

@janwijbrand
Copy link
Author

janwijbrand commented Mar 9, 2023

I see your point. I don't have a very good answer, but: VSCode cannot really know it is not calling a "real" interpreter, so I see how it expects the -I to be accepted.

-I indicates "I want an isolated python environment" that the wrapper actually sort of already provides - that was the line of reasoning I used for thinking this PR could be an OK solution.

Perhaps we could warn the user when they start the python wrapper in "interactive" mode and did pass in -I that the option is ignored? We can also add a comment in the wrapper about the -I being ignored, would that help?

Alternatively, we actually implement the "correct" -I behaviour. That seems overkill, but would provide the least surprise to the developer? Note that the wrapper script doesn't provide any hint on what options are acceptable - there is no -h or --help support for example. To know which options are acceptable one needs to read the wrapper anyway.

There's a fair chance we will be playing catch up: as soon as VSCode sees a good reason to pass another option native to the "normal" Python interpreter, we're back at square one.

@gotcha
Copy link
Member

gotcha commented Mar 9, 2023

I do agree that implementing the correct behaviour is overkill.
I see your point about the lack of help and thus the need to read the script.
Nevertheless, it could be easy to miss the silent swallow so I think that adding a comment does make sense.

Any chance to have VSCode provide some configuration to avoid the issue ?

@gotcha
Copy link
Member

gotcha commented Mar 9, 2023

There's a fair chance we will be playing catch up: as soon as VSCode sees a good reason to pass another option native to the "normal" Python interpreter, we're back at square one.

Unfortunately yup.

@janwijbrand
Copy link
Author

I have no clear idea why https://github.com/buildout/buildout/actions/runs/4352805641/jobs/7670723752 is failing now. I can't really see a relation to my change. Anyone an idea of an approach to tackle this?

@janwijbrand
Copy link
Author

Nevertheless, it could be easy to miss the silent swallow so I think that adding a comment does make sense.

I'll add a comment.

Any chance to have VSCode provide some configuration to avoid the issue ?

I don't see how to make that into a sensible request to the extension developer/maintainer. In a way, buildout is the odd one out here I'm afraid.

# The Python interpreter wrapper allows some of the options that a
# "regular" Python interpreter accepts, but it only acts on the -i, -c
# and -m options. The other option(s) are ignored. See
# https://github.com/buildout/buildout/issues/627 for more information.
Copy link
Member

Choose a reason for hiding this comment

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

@janwijbrand I used to refer to issues on websites, but they do eventually disappear. Would you mind explaining about VSCode need here ?

@gotcha
Copy link
Member

gotcha commented Mar 15, 2023

I have no clear idea why https://github.com/buildout/buildout/actions/runs/4352805641/jobs/7670723752 is failing now. I can't really see a relation to my change. Anyone an idea of an approach to tackle this?

Current testing setup always uses last setuptools which changes far too often, resulting in broken doctests.
I need to change the GHA especially since I have added the possibility to specify setuptools and pip versions used by dev.py through env vars.

@janwijbrand
Copy link
Author

Done

@gotcha
Copy link
Member

gotcha commented Mar 15, 2023

I see you did not add a test (which I am fine with). I guess you are also fine with the low risk that someone removes that 'useless' options. Is that right ?

@janwijbrand
Copy link
Author

janwijbrand commented Mar 15, 2023

I did add not a new test indeed. I considered having had to update the existing test

# The Python interpreter wrapper allows some of the options that a
to be sufficient and also to express the intention. If someone were to remove the "useless" option, the test would fail. Right?

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.

None yet

2 participants