-
Notifications
You must be signed in to change notification settings - Fork 2.4k
deprecate / remove "pythonpathsetter" #5384
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
Comments
The reason why The proposed alternative to use
instead once
The above is not as convenient as |
Although I doubt |
Hmm, I thought it would still be possible to run If we decide to remove Could you @franzhaas test that if you remove |
I think the only case where there is a problem when running robot as a script is when this is done from a source tree which was not installed into the environment, and the pythonpath was not adjusted. I planned to go something like that: if __name__ == '__main__' and 'robot' not in sys.modules:
try:
import robot as __ignore
asssert pathlib.Path(__file__).parent.absolute() == pathlib.Path(__ignore.__file__).parent.absolute(), "you run robot/run.py using a robot installation from a different path... this is not suported"
except ModuleNotFoundError:
print("depricated running without having python path setup proactively, please either install or configure python path before running run.py")
import pythonpathsetter That way, as long as the pyton path is configured (by installation, or by any other means) the script works. The thing that would make the life easier for zipapps/frozen apps is if robot behaved more predictably. So "running the code by Preventing running the src/robot/run.py as a script would not help my goals much. (except for maybe a more helpful error message) |
After thinking this a bit more, I'd prefer not to remove the support to use
Could you @franzhaas explain the problems Could you also explain what kind of workaround code you need to use currently? If it's not too complicated, needing to use such workarounds could still be a smaller problem than the problems associated with |
I think what you are looking for is try:
import pythonpathsetter
except:
pass This will make robot/run.py run in an environment with robotframework installed (currently, it does so only if pythonpathsetter is loadable, robot.pythonpathsetter, the "regular" way to address this module does not help). I do not think that this is a good idea, as it adds yet another way the pythonpath can be defined when using robotframework. |
Adding |
Have you tried the suggestions from the initial issue description? Changing setup.py is probably the least effort. But to clarify, there is no issue. These goals.:
are mutually exclusive. @pekkaklarck it would have saved both of us a lot of time if you would have stated this goal early instead of encouraging a PR. If you want to go zipapp/frozenapp or similar these things may work for you.:
There are examples here.: https://github.com/MarketSquare/compact_testprogram_distribution. |
pythonpathsetter is a module that modifies the
sys.path
in a way that it is possible to run robot-related scripts without having robot installed in your environment.This makes robot fail in very wired ways IF.:
scripts=["src/robot/run.py"]
instead of an entry point in setup.pyWhile it is possible to work around this for zipapp and frozen app usage, it is the main source of effort. The problem tends only to manifest when the frozen executable is built, making debugging hard and experimentation slow. It is hard to comprehend how seemingly innocent changes (run main / call main) break and fix things, and at least for me, I might be using imprecise language and end up mixing run vs call in communication.
In most circumstances, I believe that this concept is the better solution.:
It makes the productive robot code simpler, it makes it more visible that the
sys.modules
gets tinkered with.Many solutions to support running robot-related scripts outside of an installed robot are possible, but it is not the use case I use, so I would like to leave this up to the real users.
This change might break the workflow of some people, so depricating first and collecting feedback should be the right step.
The text was updated successfully, but these errors were encountered: