-
Notifications
You must be signed in to change notification settings - Fork 525
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
Moving scripts to within python source code folder #3297
base: develop
Are you sure you want to change the base?
Moving scripts to within python source code folder #3297
Conversation
Almost, but I think you need to go through each script file itself and also check that it actually defines a function called
Whereas it should instead follow the format:
(and of course you can in principle do without the final two lines as well, but it might be convenient to keep them in for obscure usecases). |
And I should say that I don't have much experience with these nested submodules you are using in openmc, so I never actually tried to point at those in |
Oh, and you are also missing a If it doesn't work, you might have to rename them. For instance instead of:
This for sure will work:
with:
|
Another advantage of having all of the scripts as python modules is that they can simply do relative imports, i.e. instead of:
they can write:
Which is nice, as it for instance prevents the mistake I did and the "import openmc" actually finds the openmc folder in my current working directory instead of the one in python site-packages :-) |
I've tinkered a bit more as the scripts were failing when called in the terminal. Looks like the advice is to add main functions with None as the default args then call the arg parser if the arguments are none To be honest I think all of these scripts are redundant and we can do all the same functionality with the python API so I don't think they are necessary. However this PR is an option if we want to bring them up to date with packaging recommendations and windows compatibility. If we want to keep these scripts we might as well have them in the openmc/scripts folder instead of their current location scripts folder which makes packaging and windows compatibility harder Note the openmc-plot-mesh-tally script is failing with a matplot lib error as it looks like that script was untested and matplot lib has moved on.
I can put in another PR that simple deletes the scripts if that is preferable? |
Description
Moves the scripts folder to within the python package
@tkittel is this the change you had in mind for making the scripts a little more standard and more compatible with windows
Fixes # (issue)
helps with future windows compatibility
Checklist