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

Clarify MET Compile Time Python requirements #2490

Closed
1 task done
DanielAdriaansen opened this issue Mar 16, 2023 · 3 comments · Fixed by #2509
Closed
1 task done

Clarify MET Compile Time Python requirements #2490

DanielAdriaansen opened this issue Mar 16, 2023 · 3 comments · Fixed by #2509
Assignees
Labels
component: documentation Documentation issue MET: Python Embedding priority: medium Medium Priority requestor: METplus Team METplus Development Team type: sub-issue Break an issue down into smaller parts
Milestone

Comments

@DanielAdriaansen
Copy link
Contributor

DanielAdriaansen commented Mar 16, 2023

This is a sub-issue of #2414.

The current Appendix F documentation says:

The local Python installation must also support a minimum set of required packages. The MET build includes some python wrapper scripts to facilitate the passing of data in memory as well as the reading and writing of temporary files. The packages required by those wrapper scripts are sys, os, argparse, importlib, numpy and netCDF4. While most of these are standard packages and readily available, numpy and netCDF4 may not be. Users are advised to confirm their availability prior to compiling MET with python embedding support.

Questions for discussion:

  1. Should we add a requirement for Xarray?
  • If we add a requirement for Xarray, then what of Xarray's optional dependencies should we also include? Note that the xarray.open_mfdataset function requires dask to be installed.
  • What is the current minimum version of Python that should be used? 3.8.6? 3.10.X?

Action items:

  • Remove standard Python modules os, sys, and importlib
@DanielAdriaansen DanielAdriaansen added alert: NEED MORE DEFINITION Not yet actionable, additional definition required alert: NEED ACCOUNT KEY Need to assign an account key to this issue type: sub-issue Break an issue down into smaller parts alert: NEED CYCLE ASSIGNMENT Need to assign to a release development cycle MET: Python Embedding labels Mar 16, 2023
@DanielAdriaansen DanielAdriaansen added this to the MET 11.1.0 milestone Mar 16, 2023
@DanielAdriaansen DanielAdriaansen self-assigned this Mar 16, 2023
@hsoh-u
Copy link
Collaborator

hsoh-u commented Apr 10, 2023

The API which uses "importlib" module/package is added to scripts/python/pyembed/python_embedding.py (#2285 ). "import importlib.util" can be removed by importing the pyembed module/package and by calling pyembed_tools.call_python(argv)

Here is an example:

try:
    from python_embedding import pyembed_tools
except:
    from pyembed.python_embedding import pyembed_tools

#pyembed_tools.add_python_path(__file__)    # un-comment this if there is a path problem
if __name__ == '__main__':
    met_in = pyembed_tools.call_python(sys.argv)

@DanielAdriaansen
Copy link
Contributor Author

The API which uses "importlib" module/package is added to scripts/python/pyembed/python_embedding.py (#2285 ). "import importlib.util" can be removed by importing the pyembed module/package and by calling pyembed_tools.call_python(argv)

Thanks Howard. I think since "importlib" is part of the Python standard lib, we can still use it if we want. Also, I've removed all Python packages that are part of the standard lib, since if the user has Python installed it should have those packages by default.

@DanielAdriaansen DanielAdriaansen linked a pull request Apr 14, 2023 that will close this issue
15 tasks
@DanielAdriaansen
Copy link
Contributor Author

Documentation updates included in #2509 to address this.

@JohnHalleyGotway JohnHalleyGotway added component: documentation Documentation issue requestor: METplus Team METplus Development Team priority: medium Medium Priority and removed alert: NEED MORE DEFINITION Not yet actionable, additional definition required alert: NEED ACCOUNT KEY Need to assign an account key to this issue alert: NEED CYCLE ASSIGNMENT Need to assign to a release development cycle labels Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: documentation Documentation issue MET: Python Embedding priority: medium Medium Priority requestor: METplus Team METplus Development Team type: sub-issue Break an issue down into smaller parts
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants