gukoff / dtparse Goto Github PK
View Code? Open in Web Editor NEWFast datetime parser for Python written in Rust
License: MIT License
Fast datetime parser for Python written in Rust
License: MIT License
Cargo randomly fails to download the source code of chrono because of the bug in the downstream dependency, libgit2. This is specific for x32 systems, and it sometimes prevents the wheels from building:
This bug is fixed in cargo 1.50 thanks to @ehuss. This version will be released on 2021-02-11.
Short-term: add retries to this CI step.
Long-term: use rust 1.50 when it's out.
Chrono 1.4.1 supports subsecond precision now: https://github.com/chronotope/chrono/blob/master/CHANGELOG.md#041
It looks easy to port.
Hi,
it would be cool if you could also upload a source dist with the next release. This would make re-packaging (e.g., for Conda or Linux distros) a lot easier. :-)
Is it possible to add compatibility with strings without the time part for fuller compatibility with datetime library and more helpful usage in different applications where datetime format could be partially unexpected?
I am not able to parse timezones other an Z
/+00:00
with dtparse 1.3.2.
>>> dtparse.parse("2021-05-04 13:37:00+00:00", "%Y-%m-%d %H:%M:%S%:z")
datetime.datetime(2021, 5, 4, 13, 37)
>>> dtparse.parse("2021-05-04 13:37:00+10:00", "%Y-%m-%d %H:%M:%S%:z")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: no possible date and time matching input
>>> dtparse.parse("2021-05-04T13:37:00Z", "%+")
datetime.datetime(2021, 5, 4, 13, 37)
>>> dtparse.parse("2021-05-04T13:37:00+00:00", "%+")
datetime.datetime(2021, 5, 4, 13, 37)
>>> dtparse.parse("2021-05-04T13:37:00+01:00", "%+")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: no possible date and time matching input
I'd also expect that tzinfo is attached to the datetime for Z
/+00:00
:
>>> dtparse.parse("2021-05-04 13:37:00+00:00", "%Y-%m-%d %H:%M:%S%:z")
datetime.datetime(2021, 5, 4, 13, 37, tzinfo=datetime.timezone.utc)
>>> dtparse.parse("2021-05-04T13:37:00Z", "%+")
datetime.datetime(2021, 5, 4, 13, 37, tzinfo=datetime.timezone.utc)
>>> dtparse.parse("2021-05-04T13:37:00+00:00", "%+")
datetime.datetime(2021, 5, 4, 13, 37, tzinfo=datetime.timezone.utc)
Did I miss something or is this a bug or even expected behavior?
python-dateutil is a very widely used Python library for heuristic datetime parsing.
The same functionality was recently implemented in Rust: https://github.com/bspeice/dtparse
Porting the Rust version back to Python would be a great addition to this library, very much in the spirit of "parsing datetimes in Python, but faster".
Building wheels is crucial for Rust extensions' distribution.
Although there are scripts to build wheels manually in the repo, it would make a lot of sense to automate the process. cibuildwheel looks interesting.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.