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

Using quickstart example, the Foundry.json() method errors on DLHubClient not JSON serializable #373

Closed
marshallmcdonnell opened this issue Jun 15, 2023 · 2 comments
Assignees

Comments

@marshallmcdonnell
Copy link
Contributor

NOTE: This is related to JOSS review openjournals/joss-reviews#5467

Describe the bug
It appears the Foundry.json() for quick start in README currently raises an exception due to DLHubClient being unserializable

To Reproduce

  1. Use following script modified from quickstart README:
from foundry import Foundry
f = Foundry(index="mdf")
f = f.load("10.18126/e73h-3w6n")
f.json()
  1. Should see following traceback:
Traceback (most recent call last):
  File "/path/to/script.py", line 4, in <module>
    f.json()
  File "pydantic/main.py", line 504, in pydantic.main.BaseModel.json
  File "/.../python3.10/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/.../python3.10/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/.../python3.10/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "pydantic/json.py", line 90, in pydantic.json.pydantic_encoder
TypeError: Object of type 'DLHubClient' is not JSON serializable

Expected behavior
Foundry.json() to produce JSON from quickstart; possibly put a unit test around this?

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Version foundry-ml==0.6.3
  • Python Version 3.10

Additional context
Related, is there no way to get the version from the module?

import foundry
foundry.__version__

gives:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'foundry' has no attribute '__version__'

Found out version via a pip freeze instead

@marshallmcdonnell
Copy link
Contributor Author

Related PR: #374

@ascourtas
Copy link
Contributor

Updated Quickstart docs to reflect the proper usage; documentation has been deployed. I'll close this issue until further notice.

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

No branches or pull requests

2 participants