The current implementation of the write_package function in frictionless-r is too restrictive, as it couples the writing of the descriptor file and the resources. This design limits flexibility and adds unnecessary friction to workflows requiring customized output.
Limitations:
-
Hardcoded Descriptor File Name:
write_package always writes the descriptor file as datapackage.json, without allowing file name customization.
-
No YAML Support:
Descriptors can only be written in JSON format, personally I prefer YAML over JSON for descriptor files.
-
Resource Path Restrictions:
Resources are always written to the base directory, with no way to specify custom paths for individual resources.
Proposed Solution:
Refactor the functionality by splitting it into two distinct functions:
write_package() - A function responsible only for writing the descriptor file in either JSON or YAML.
write_resource() - Export a new function dedicated to writing individual resources.
The current implementation of the
write_packagefunction in frictionless-r is too restrictive, as it couples the writing of the descriptor file and the resources. This design limits flexibility and adds unnecessary friction to workflows requiring customized output.Limitations:
Hardcoded Descriptor File Name:
write_packagealways writes the descriptor file asdatapackage.json, without allowing file name customization.No YAML Support:
Descriptors can only be written in JSON format, personally I prefer YAML over JSON for descriptor files.
Resource Path Restrictions:
Resources are always written to the base directory, with no way to specify custom paths for individual resources.
Proposed Solution:
Refactor the functionality by splitting it into two distinct functions:
write_package()- A function responsible only for writing the descriptor file in either JSON or YAML.write_resource()- Export a new function dedicated to writing individual resources.