Open SonOfLilit opened 1 month ago
Here's what a PR would look like it we didn't care about people who don't have dateutil installed:
https://github.com/SonOfLilit/DateType/commit/7690b5b347273236596971edac15add6fa1693b2
@SonOfLilit I think we could do this, if you protected the import with an if TYPE_CHECKING
and we made sure to have 2 CI jobs, one with relativedelta and one without.
cc @pganssle will I regret this approach?
I kinda hate the Self | DateTime
, but I realize we wouldn't want to do this without it since it would be incorrect to assert you can only get dates. I feel like a RelativeDateDelta
and a RelativeDateTimeDelta
would want to be two different types in the DateType cinematic universe, but perhaps the patch could be to dateutil instead?
I'm afraid dateutil are not much more likely to accept our patches than the standard library, so we will need to create a dateutiltype?
I'm afraid dateutil are not much more likely to accept our patches than the standard library
Why not?
I'm not entirely opposed to landing the changes here, assuming we have at least tacit buy-in from the dateutil maintainers
I'll ask
On Wed, Aug 7, 2024, 09:43 Glyph @.***> wrote:
I'm afraid dateutil are not much more likely to accept our patches than the standard library
Why not?
I'm not entirely opposed to landing the changes here, assuming we have at least tacit buy-in from the dateutil maintainers
— Reply to this email directly, view it on GitHub https://github.com/glyph/DateType/issues/11#issuecomment-2272736504, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADU7JQQ37HVESVYABGML3ZQG6Y3AVCNFSM6AAAAABLZRZPCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZSG4ZTMNJQGQ . You are receiving this because you were mentioned.Message ID: @.***>
Hi,
You're my hero. Thanks.
Also, I want to actually use your library in my code, but I'm getting errors for
my_date + relativedelta(days=1)
(and same withdatetime
s). I wonder what it would take to fix it.Can your
pyi
add additional overloads to [https://github.com/python/typeshed/blob/main/stubs/python-dateutil/dateutil/relativedelta.pyi](typeshed's relativedelta.pyi)?I guess we can add a fake
Date.__add__(self, other: relativedelta)
instead and it would do the right thing? Do we need to entirely replace typeshed'srelativedelta
for this to work?How can I approach getting this to work? Will you accept a PR? Is there a workaround I can use in the meantime?
You should be aware of this before you answer, I guess. One of the weirder corners of Python:
I guess we could have something like: