Skip to content
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

itemadapter #13

Merged
merged 19 commits into from Jul 1, 2020
Merged

itemadapter #13

merged 19 commits into from Jul 1, 2020

Conversation

ejulio
Copy link
Collaborator

@ejulio ejulio commented Jun 18, 2020

Just moved @elacuesta's changes here. Since we changed a few things since then, moving the commits would be a bit messy.
So, I copied his changes and gave his credit in the commit message :)

@codecov
Copy link

codecov bot commented Jun 18, 2020

Codecov Report

Merging #13 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #13   +/-   ##
=======================================
  Coverage   98.00%   98.00%           
=======================================
  Files           4        4           
  Lines         251      251           
=======================================
  Hits          246      246           
  Misses          5        5           
Impacted Files Coverage Δ
itemloaders/__init__.py 97.38% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 37a63cd...ad543c1. Read the comment docs.

itemloaders/__init__.py Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
ejulio and others added 2 commits June 18, 2020 07:57
Co-authored-by: Adrián Chaves <adrian@chaves.io>
Co-authored-by: Adrián Chaves <adrian@chaves.io>
@ejulio ejulio requested a review from Gallaecio June 19, 2020 19:00
docs/declaring-loaders.rst Outdated Show resolved Hide resolved
itemloaders/__init__.py Outdated Show resolved Hide resolved
docs/declaring-loaders.rst Outdated Show resolved Hide resolved
@ejulio
Copy link
Collaborator Author

ejulio commented Jun 24, 2020

@kmike I was thinking to raise an specific exception in __init__ if we fail to create default_item_class.
What do you think?
Even though it is documented, it is a bit hidden, so I'd raise a TypeError with a message similar to the one in the API Reference (maybe remove the example)..

itemloaders/__init__.py Outdated Show resolved Hide resolved
@Gallaecio
Copy link
Member

@kmike I was thinking to raise an specific exception in __init__ if we fail to create default_item_class.

I’m unsure.

On the one hand, given the long-term plan is to delay such an exception until load_item() or similar are called, it may be better to leave things as is; the dataclass-specific exception is not documented, so it’s an implementation detail, and by delaying the exception in the future we won’t be breaking the documented API.

That said, since we will nonetheless break the actual API in the future, defining an exception type now should not negatively affect users in the future. If they are catching the dataclass-specific exception now, they will need to move the exception handling either way; if we already define the exception class that we raise, then they will only need to move the code, and not also rename the exception class they catch.

@ejulio
Copy link
Collaborator Author

ejulio commented Jun 29, 2020

@Gallaecio

On the one hand, given the long-term plan is to delay such an exception until load_item() or similar are called, it may be better to leave things as is; the dataclass-specific exception is not documented, so it’s an implementation detail, and by delaying the exception in the future we won’t be breaking the documented API.

I don't think we'll be able to delay the creation. Check my last comment here #14

That said, since we will nonetheless break the actual API in the future, defining an exception type now should not negatively affect users in the future. If they are catching the dataclass-specific exception now, they will need to move the exception handling either way; if we already define the exception class that we raise, then they will only need to move the code, and not also rename the exception class they catch.

I don't think users should handle this exception, they should fix it. Otherwise, they won't get the result they want, so they can't proceed with the given implementation.

@ejulio ejulio requested review from Gallaecio and kmike June 30, 2020 14:54
docs/declaring-loaders.rst Outdated Show resolved Hide resolved
@ejulio ejulio requested a review from Gallaecio July 1, 2020 13:10
@kmike kmike merged commit 7b548da into master Jul 1, 2020
@kmike
Copy link
Member

kmike commented Jul 1, 2020

Thank you @ejulio!

@ejulio ejulio deleted the feat-itemadapter branch July 1, 2020 20:08
@ejulio
Copy link
Collaborator Author

ejulio commented Jul 1, 2020

YAY 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants