-
Notifications
You must be signed in to change notification settings - Fork 43
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
save method respects base path for relative paths #254
save method respects base path for relative paths #254
Conversation
@UnicodingUnicorn Now I'm not sure that I fully understand the initial issue.
And not sure how it will play with remote paths etc. Could you please provide an example/test of new behaviour? And probably we need to add an option to make this change non-breaking (or my understanding is wrong) |
Yeah, the initial issue is a bit weird. But you added the labels to it so I kinda assumed it was good to go. It looked simple enough, and the fact there's a bounty on it is a plus. Looking back now, this is more a documentation issue. Maybe it's simpler to revise the description of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@UnicodingUnicorn
Sorry for the confusion it's my fault not properly checking the initial issue before posting it on Bountysource.
I've dove into it now. I think that the feature request #205 makes sense (I thought it was another bug).
Could you please:
- add
to_base_path (bool)
(better idea for the name?) flag for the behavior you have implemented. So by default, there will be no changes - a few tests to validate new feature
Since I authored the weird issue #205, let me try to explain. What I should have written is probably
I think the docs are quite clear, stating
As such, I would find it very surprising if the call
did not respect It is my understanding that the current behaviour is either a bug, or a case of misleading documentation for the @UnicodingUnicorn It is my understanding that your patch fixes the bug. To ensure backwards compatibility, one could introduce an Sorry for the imprecise statement in the original issue, I hope it is more clear now what I meant. |
I think the issue here is that the docs describe or imply a behaviour that is not actually implemented, so adding this functionality as a new feature as @roll suggests does not help much. I believe that either the docs need to be updated, or the feature implemented, which admittedly is a breaking change. Although I'm a bit wary of adding new arguments, @jdahlbaek's method seems to be a good way to perform the transition. I'm working on the tests now. |
@jdahlbaek If I see the code like this: package = Package(descriptor, base_path='input/datapackage.json')
...
package.save('output/datapackage.json') I will never think about So probably there is no a right answer for it. But I still think that something like this: package = Package(descriptor, base_path='input/datapackage.json')
...
package.save('output/datapackage.json', to_base_path=True) is the least damaging considering the current state of art. cc @akariv |
I mean even if we consider that current behavior is a bug (which I don't think is correct) there can be some code relying on this behavior and we can't introduce breaking changes |
I can imagine use cases in which each api seems more natural. However, from a backward compatibility point of view @roll 's suggestions makes sense to me. |
Yeah, I see the point on backward compatibility now. I will implement stuff as per @roll's suggestion. |
@roll may I request another review please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work. Thanks!
hi @UnicodingUnicorn! Thanks for this! Please claim the bounty 😃 |
Should resolve #205, at least partially. From the wording of the issue, I cannot tell if it's supposed to apply to everything. I suppose so, but it's best to play it safe.
Please preserve this line to notify @roll (lead of this repository)