-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Custom writer example in docs #337
Comments
Thanks for opening the issue. Let me try to think this through 😄 Some concerns:
While I think we'll get around my concerns 1 and 2. The remaining two are more tricky. Hence an alternative propositions: As I understand it, your main reason for proposing this is the fact that it is not obvious that/how a writer should be customized when using the dump function. I agree - that must change. How about - instead of code changes - we explain this in the Either way (code or docs change): Would you be willing to provide a PR for this? Note. This is not directly relevant to #318 which is a full 100% rewrite and where the |
bibtexparser.dump
Simple enough,
It's exposed.. but it's not part of the documentation. So you need to either know it exists or dig in the files to find it. IMO, that's why a
IMO, this one is easily solved by adding in the docstring a note about the behavior. Something like:
I would raise an error message inviting the user to provide one or the other. Some people prefer to silently merge, or chose one input over the other; personally, I don't like to solve conflicts silently and I prefer to raise. All that said, if there is a complete refactor version coming up, I don't see the added value in continuing the development of version 1. I would consider the points above as 'to keep in mind' for the refactor version. |
Sounds fair - that would have been a way to go, but I also agree that investing too much time for a
Well, that's a long process, so if we could do the minimal thing and improve the @mscheltienne thanks again for bringing this up |
bibtexparser.dump
bibtexparser.dump
: Explain custom writer with example
bibtexparser.dump
: Explain custom writer with example
Currently, defining a custom writer is possible but not straightforward.
__init__()
, with detailed docstrings used by the sphinx-build, might improve the experience. Example usingnumpy
style docstrings:Sorting of the fields is hidden in the undocumented
SortingStrategy
class.Most people will not define a custom writer and are simply going to use the
dump
function. The most common configuration should be accessible directly at thedump
function level, e.g. sorting of entries and sorting of fields. Example:In the example above,
None
corresponds to"preserve"
order.order_entries
corresponds to the writer's attributeorder_entries_by
andorder_fields
corresponds to the writer's attributedisplay_order_sorting
.Originally posted in #336
x-ref with v2: #318
The text was updated successfully, but these errors were encountered: