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

Make some serializers optionals #280

Closed
kripnerl opened this issue Oct 27, 2023 · 8 comments · Fixed by #330
Closed

Make some serializers optionals #280

kripnerl opened this issue Oct 27, 2023 · 8 comments · Fixed by #330

Comments

@kripnerl
Copy link
Contributor

Reasoning

OMAS should be (IMHO) a lightweight tool for; however, some of its dependencies make it bulky and have complicated dependencies.

Problem

I speak specifically about mojo-core. We have already encountered a second issue with that library. First was an obsolete dependency on urllib (which is fixed in the newer version) and second is now Windows poetry installations:

Installing botocore (1.31.33): Failed

  FileNotFoundError

  [Errno 2] No such file or directory: 'C:\\Users\\jh\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\Local\\pypoetry\\Cache\\virtualenvs\\cug-vessel-model-WXhTS8yu-py3.11\\Lib\\site-packages\\botocore\\data\\kinesis-video-archived-media\\2017-09-30\\endpoint-rule-set-1.json.gz'

  at C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\pathlib.py:1044 in open
      1040│         the built-in open() function does.
      1041│         """
      1042│         if "b" not in mode:
      1043│             encoding = io.text_encoding(encoding)
    → 1044│         return io.open(self, mode, buffering, encoding, errors, newline)
      1045│
      1046│     def read_bytes(self):
      1047│         """
      1048│         Open the file in bytes mode, read it, and close the file.

Proposed solution

Add specialized backend as optional dependencies in setup.py:

...
install_requires = [
    'numpy>=1.16.1',
    'uncertainties',
    'pint',
    'netCDF4',
    'matplotlib',  # In principle, plotting could be also optional since some deployments do not require any plotting.
    'scipy',
    'h5py',
    'dnspython', # Not sure about this one - it is not used in the code, or I missed it. 
    'xarray',
    'setuptools>=41.2',  
    'Cython',
]

extras_require = {
    'machine': [
        'omfit_classes',
        'pexpect',
        'fortranformat',
        'pygacode',
    ],
    'hdc': ['pyhdc'],
    'imas': ['imas'],
    'uda': ['pyuda'],
    'mongo': ['pymongo'],
    'aws': ['boto3'],
    
    'build_structures': ['bs4', 'xmltodict', 'tqdm'], # xmltodict is used only in `omas_structures` and `tqdm` only when fetching data and the code more over is checking on the existence of the `tqdm`.  
    'build_documentation': ['Sphinx', 'sphinx-bootstrap-theme', 'sphinx-gallery', 'Pillow'],
}
...
@kripnerl
Copy link
Contributor Author

If you agree, I will be very happy to open a pull request.

@orso82
Copy link
Member

orso82 commented Oct 27, 2023

I am not sure how much the MongoDB interface is used. I suspect zero. If so, I'd be inclined to actually remove all that part of the source... others can comment

@kripnerl
Copy link
Contributor Author

Hah. I was just recently thinking that it would be cool to test the MongoDB :-D. However, I assume this will remain only with dreams since the day is only 24 hours long ... So no. We are nor using nor (actively) planning using this.

@orso82
Copy link
Member

orso82 commented Oct 29, 2023

Ok, well, perhaps we can start by making it an optional dependency as you suggested. Who knows that someday you'll find the time :P

Other comments for the PR:

  • dnspython can probably go, I honestly forgot why it got there
  • instead of aws can we use s3 ?

Copy link

Stale issue message

@kripnerl
Copy link
Contributor Author

kripnerl commented Jan 3, 2024

On hold, to be resolved soon.

Copy link

github-actions bot commented Mar 4, 2024

Stale issue message

@kripnerl
Copy link
Contributor Author

Reopening with opened pull request: #330

@kripnerl kripnerl reopened this Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants