-
Notifications
You must be signed in to change notification settings - Fork 545
-
Notifications
You must be signed in to change notification settings - Fork 545
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
Imports from __future__
fail
#1306
Comments
This bug is still present in recent versions of |
I doubt there's any specific reason; that looks like a much better solution. Are you able to make a PR correcting this? |
I have been digging around a bit, and I thing one of the reasons it is done this way is that it is similar to the way R and Julia scripts are handled. Interestingly there is a regex defined in |
I don't know anything about R or Julia, but it seems to me a language-specific method that's properly supported is much preferable to a language-agnostic method that breaks. Regex workaround seem hacky to me. I'm not actually super familiar with |
I have some experience in R, and none in Julia, but if you would be ok with a specific method for running python scripts that makes it a lot easier I guess. Still might take some time as I'm busy finishing my thesis. |
Yeah, no worries. Not my decision actually, that's up to @johanneskoester, but it makes sense to me |
Was thinking about this a bit more, one thing to be aware of is that snakemake needs to be able to run scripts from any arbitrary python interpreter in order to properly use conda envs. So to implement your solution properly, the best way to go about it is probably to have a dedicated script that consumes all the pickled args and does all the prepwork, finishing by calling the user script using |
Snakemake version
6.9.1
Describe the bug
When a script contains a line
from __future__ import {some future behaviour}
python raises a syntaxerror as snakemake inserts a few lines of code before the first line of user code. Perhaps a guard should be built in to check whether future behaviour is imported, and if so, inject the snakemake code after that line.Logs
Minimal example
Additional context
The text was updated successfully, but these errors were encountered: