roboflow-python
roboflow-python copied to clipboard
Bugfix with .json not returning valid json and added .dict
Description
We are currently facing an issue with the .predict function which includes an option for .json. However, this .json method does not generate valid JSON data; rather, it returns a dictionary. This discrepancy is likely to cause confusion and issues for users.
The necessary adjustments are to be implemented in the PredictionGroup class within the utils module.
No additional dependencies are required for this change.
Type of Change
- [X] Bug fix (non-breaking change which resolves an issue)
- [X] New feature (non-breaking change which introduces functionality)
Testing and Validation
This change has been executed and verified through direct code implementation. The modification entails relocating the currently effective code to a .dict() method and subsequently converting its output into valid JSON within the .json method.
Deployment Considerations
Potential issues might arise for users who are currently utilizing the output from the .json method (which is effectively a dictionary) as a dictionary in their code. These users may need to adjust their implementations to accommodate the changes.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.
:white_check_mark: Qfc9
:x: pre-commit-ci[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.
@Qfc9 Hello there! Do you have a code example showing a test case for this project?
I agree it might be misleading, but I think it is a common pattern in Python to call it .json() instead of .dict(). It is something like "data prepared to be JSON".
This change would be very backward incompatible with little value, I prefer to not do it, maybe adding type hints and better docs to the method would fix the confusion.