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
Url Type #317
Url Type #317
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #317 +/- ##
==========================================
- Coverage 97.36% 97.20% -0.16%
==========================================
Files 55 57 +2
Lines 6334 6450 +116
Branches 44 45 +1
==========================================
+ Hits 6167 6270 +103
- Misses 167 179 +12
- Partials 0 1 +1
Continue to review full report at Codecov.
|
If we wanted to support top level domains, we should use https://github.com/datasets/top-level-domain-names/blob/master/top-level-domain-names.csv. |
From 1.31 MB (for the wheel) to 1.47 MB for a better, faster, safer implementation seems perfectly reasonable to me. |
ye, I think I agree. If people really care about size, we could publish a Though since (AFAIK) there's no way for optional dependencies in python to say "also don't install XXX", there's no easy way to let users call |
Completely agree with @tiangolo! I think people care about size when it becomes "too big" (which is currently the case for compiled pydantic). But here the package remains small! And well done @samuelcolvin for adding this on the rust side. Looks great |
thanks both, I learnt more about URLs doing this - I never new that there are 6 "special" schemes (
While this would be cool, I wonder how many people would really need it, and it would cause a bigger increase in size since we would need to include that full list in the codebase, let's leave it until people complain. |
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.
Looks great! Just a question
@@ -81,6 +81,7 @@ impl ValidationError { | |||
} | |||
|
|||
fn errors(&self, py: Python, include_context: Option<bool>) -> PyResult<PyObject> { | |||
// TODO remove `collect` when we have https://github.com/PyO3/pyo3/pull/2676 |
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.
pyo3 0.17.3 has been released! Can probably be done in a PR afterwards
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, will do.
} else { | ||
result.push_str(chunk); | ||
} | ||
result.push('.'); |
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.
aren't there some cases where it might reallocate the string because the capacity is not enough?
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.
Possibly, but unlikely since the punycode representation should always be longer than the "unicode" (is there a better name?) representation.
Even if it does, it shouldn't cause an error?
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.
(@PrettyWood just mentioning it here since you not have seen, I just sent you a message on twitter, answer on pydantic/pydantic#4665 would be great when you have a chance, sorry to hassle 🙇)
Ref pydantic/pydantic#4694
This will cause some changes in functionality:
user_required
has been dropped (it could be kept, but I don't see the point)tld_required
andtld
have gone - they were unreliable already, we could keep them being unreliable but I'm not a fanOther decedent types will need to be implemented via
Annotated
like:Feedback welcome.
This creates the size of binaries by a non-trivial amount:
(
0.6.1
is this branch)@tiangolo @PrettyWood what do you think? Is getting this right without another python dependency (much more performant, and likely more correct) worth the increase? For me it is, but I know some people care a lot about binary size.