sarugaku / plette

Structured Pipfile and Pipfile.lock models.
ISC License
7 stars 7 forks source link

Calling `get_hash` raises an exception #56

Closed Javalar closed 2 months ago

Javalar commented 3 months ago

Description

Calling get_hash under any condition raises an exception with message TypeError: Object of type PackageCollection is not JSON serializable.

Example code:

from plette import Pipfile

with open('Pipfile', 'r', encoding='UTF-8') as file:
    pipfile = Pipfile.load(file)

pipfile.get_hash()

This is caused by the fact that to_dict now creates a structure which is populated with dataclasses, which json.dumps can't convert to JSON.

Notes

Looking at the unit tests, I think they are passing because the test Pipfile object does not contain any packages.

oz123 commented 2 months ago

Should be fixed in v2.0.0