8000 Do not overwrite OPENMS_DATA_PATH in PyOpenMS if it is already set by radusuciu · Pull Request #5562 · OpenMS/OpenMS · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Do not overwrite OPENMS_DATA_PATH in PyOpenMS if it is already set #5562

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

Merged
merged 4 commits into from
Sep 29, 2021

Conversation

radusuciu
Copy link
Contributor
@radusuciu radusuciu commented Sep 27, 2021

Description

I've got a lot of customizations (mostly to unimod.xml ) that I've set in a new directory that is referenced by OPENMS_DATA_PATH but PyOpenMS clobbers that on initialization. This simple modification should prevent it from doing so, if there is a path already set.

Checklist:

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes. (Tick if no updates were necessary.)

How can I get additional information on failed tests during CI:

If your PR is failing you can check out

Note:

  • Once you opened a PR try to minimize the number of pushes to it as every push will trigger CI (automated builds and test) and is rather heavy on our infrastructure (e.g., if several pushes per day are per 8000 formed).

* Do not overwrite OPENMS_DATA_PATH if it is already set
* Update CHANGELOG
* Update AUTHORS
@radusuciu radusuciu changed the title Do not overwrite OPENMS_DATA_PATH in PyOpenMS if it is already set (#1) Do not overwrite OPENMS_DATA_PATH in PyOpenMS if it is already set Sep 27, 2021
@timosachsenberg
Copy link
Contributor

@jpfeuffer looks reasonable. We often have both OpenMS and pyOpenMS installed so if versions differ this might lead to problems. E.g., new OpenMS version with Elements.xml removed and old version of pyOpenMS that expects the file to exist in share. Do you think we need to cover that case?

@jpfeuffer
Copy link
Contributor

Hmm yes, I am not sure. Maybe we should print an info message that the path is set from outside and will be used?

@timosachsenberg
Copy link
Contributor

I agree. Outputting a warning like:
"Warning: OPENMS_DATA_PATH environment variable already exists. pyOpenMS will use it ('" + path + "') to locate data in the OpenMS share folder (e.g., the unimod database)."
Would suffice @radusuciu can you add this?

@radusuciu
Copy link
Contributor Author
radusuciu commented Sep 28, 2021

That sounds very reasonable, apologies for the accidental merge commit - I didn't mean to push when I did. I have a slight edit to make to make the line length more reasonable if that's okay with you. I also added in the default path in the error message and used variables + str.format() to make things a little cleaner (subjective obviously).

@radusuciu
Copy link
Contributor Author

Regardless of whether or not you accept my stylistic change, thank you very much for being open to this small contribution! This makes my life just a littttle bit easier :)

@radusuciu
Copy link
Contributor Author
radusuciu commented Sep 28, 2021

An alternative that I just thought about would be to have a different environment variable that is specific to PyOpenMS eg. PYOPENMS_DATA_PATH or similar.

default_openms_data_path = os.path.join(here, "share/OpenMS")
pyopenms_openms_data_path = os.environ.get("PYOPENMS_DATA_PATH")

os.environ["OPENMS_DATA_PATH"] = pyopenms_openms_data_path or default_openms_data_path 

or

default_openms_data_path = os.path.join(here, "share/OpenMS")
os.environ["OPENMS_DATA_PATH"] = os.environ.get("PYOPENMS_DATA_PATH", default_openms_data_path)

This probably wouldn't necessitate a warning, just some documentation about PYOPENMS_DATA_PATH.

@timosachsenberg
Copy link
Contributor

Nice. Thanks for the cleanup. From my side this PR is good to go!

Copy link
Contributor
@oliveralka oliveralka left a comment

Choose a reason for hiding this comment

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

Looks good!

@oliveralka oliveralka merged commit 9163f07 into OpenMS:develop Sep 29, 2021
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.

4 participants
0