Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 50 committers (2.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (8.1%) to scientific vocabulary
Keywords
date
dates
datetimes
forhumans
kennethreitz
parsing
python
time
times
Keywords from Contributors
jinja
pallets
werkzeug
wsgi
apps
templates
views
classes
attributes
progress-bar
Last synced: 6 months ago
·
JSON representation
Repository
Datetimes for Humans™
Basic Info
Statistics
- Stars: 3,411
- Watchers: 66
- Forks: 196
- Open Issues: 20
- Releases: 7
Topics
date
dates
datetimes
forhumans
kennethreitz
parsing
python
time
times
Created about 9 years ago
· Last pushed over 1 year ago
Metadata Files
Readme
Contributing
License
Code of conduct
README.rst
Maya: Datetimes for Humans™
===========================
.. image:: https://img.shields.io/pypi/v/maya.svg
:target: https://pypi.python.org/pypi/maya
.. image:: https://github.com/timofurrer/maya/workflows/Continuous%20Integration%20and%20Deployment/badge.svg
:target: https://github.com/timofurrer/maya/actions
Datetimes are very frustrating to work with in Python, especially when dealing
with different locales on different systems. This library exists to make the
simple things **much** easier, while admitting that time is an illusion
(timezones doubly so).
Datetimes should be interacted with via an API written for humans.
Maya is mostly built around the headaches and use-cases around parsing datetime data from websites.
☤ Basic Usage of Maya
---------------------
Behold, datetimes for humans!
.. code-block:: pycon
>>> now = maya.now()
>>> tomorrow = maya.when('tomorrow')
>>> tomorrow.slang_date()
'tomorrow'
>>> tomorrow.slang_time()
'23 hours from now'
# Also: MayaDT.from_iso8601(...)
>>> tomorrow.iso8601()
'2017-02-10T22:17:01.445418Z'
# Also: MayaDT.from_rfc2822(...)
>>> tomorrow.rfc2822()
'Fri, 10 Feb 2017 22:17:01 GMT'
# Also: MayaDT.from_rfc3339(...)
>>> tomorrow.rfc3339()
'2017-02-10T22:17:01.44Z'
>>> tomorrow.datetime()
datetime.datetime(2016, 12, 16, 15, 11, 30, 263350, tzinfo=)
# Automatically parse datetime strings and generate naive datetimes.
>>> scraped = '2016-12-16 18:23:45.423992+00:00'
>>> maya.parse(scraped).datetime(to_timezone='US/Eastern', naive=True)
datetime.datetime(2016, 12, 16, 13, 23, 45, 423992)
>>> rand_day = maya.when('2011-02-07', timezone='US/Eastern')
# Maya speaks Python.
>>> m = maya.MayaDT.from_datetime(datetime.utcnow())
>>> print(m)
Wed, 20 Sep 2017 17:24:32 GMT
>>> m = maya.MayaDT.from_struct(time.gmtime())
>>> print(m)
Wed, 20 Sep 2017 17:24:32 GMT
>>> m = maya.MayaDT(time.time())
>>> print(m)
Wed, 20 Sep 2017 17:24:32 GMT
>>> rand_day.day
7
>>> rand_day.add(days=10).day
17
# Always.
>>> rand_day.timezone
UTC
# Range of hours in a day:
>>> maya.intervals(start=maya.now(), end=maya.now().add(days=1), interval=60*60)
# snap modifiers
>>> dt = maya.when('Mon, 21 Feb 1994 21:21:42 GMT')
>>> dt.snap('@d+3h').rfc2822()
'Mon, 21 Feb 1994 03:00:00 GMT'
# snap modifiers within a timezone
>>> dt = maya.when('Mon, 21 Feb 1994 21:21:42 GMT')
>>> dt.snap_tz('+3h@d', 'Australia/Perth').rfc2822()
'Mon, 21 Feb 1994 16:00:00 GMT'
☤ Advanced Usage of Maya
------------------------
In addition to timestamps, Maya also includes a wonderfully powerful ``MayaInterval`` class, which represents a range of time (e.g. an event). With this class, you can perform a multitude of advanced calendar calculations with finesse and ease.
For example:
.. code-block:: pycon
>>> from maya import MayaInterval
# Create an event that is one hour long, starting now.
>>> event_start = maya.now()
>>> event_end = event_start.add(hours=1)
>>> event = MayaInterval(start=event_start, end=event_end)
From here, there are a number of methods available to you, which you can use to compare this event to another event.
☤ Why is this useful?
---------------------
- All timezone algebra will behave identically on all machines, regardless of system locale.
- Complete symmetric import and export of both ISO 8601 and RFC 2822 datetime stamps.
- Fantastic parsing of both dates written for/by humans and machines (``maya.when()`` vs ``maya.parse()``).
- Support for human slang, both import and export (e.g. `an hour ago`).
- Datetimes can very easily be generated, with or without tzinfo attached.
- This library is based around epoch time, but dates before Jan 1 1970 are indeed supported, via negative integers.
- Maya never panics, and always carries a towel.
☤ What about Delorean_, Arrow_, & Pendulum_?
--------------------------------------------
All these projects complement each other, and are friends. Pendulum, for example, helps power Maya's parsing.
Arrow, for example, is a fantastic library, but isn't what I wanted in a datetime library. In many ways, it's better than Maya for certain things. In some ways, in my opinion, it's not.
I simply desire a sane API for datetimes that made sense to me for all the things I'd ever want to do—especially when dealing with timezone algebra. Arrow doesn't do all of the things I need (but it does a lot more!). Maya does do exactly what I need.
I think these projects complement each-other, personally. Maya is great for parsing websites, and dealing with calendar events!
.. _Delorean: https://delorean.readthedocs.io/
.. _Arrow: https://arrow.readthedocs.io/
.. _Pendulum: https://pendulum.eustace.io/
☤ Installing Maya
-----------------
Installation is easy, with:
$ pip install maya
How to Contribute
-----------------
#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.
#. Fork `the repository`_ on GitHub to start making your changes to the **master** branch (or branch off of it).
#. Write a test which shows that the bug was fixed or that the feature works as expected.
#. Send a pull request and bug the maintainer until it gets merged and published. :)
.. _`the repository`: http://github.com/timofurrer/maya
Owner
- Name: Kenneth Reitz
- Login: kennethreitz
- Kind: user
- Location: Virginia, USA, Earth, Milky Way.
- Website: kennethreitz.org
- Twitter: kennethreitz42
- Repositories: 26
- Profile: https://github.com/kennethreitz
Software Engineer focused on abstractions, reducing cognitive overhead, and Design for Humans.
GitHub Events
Total
- Watch event: 27
- Fork event: 2
Last Year
- Watch event: 27
- Fork event: 2
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Kenneth Reitz | me@k****g | 124 |
| Timo Furrer | t****o@g****m | 46 |
| Moin | m****8@g****m | 19 |
| Alex Ward | a****d@g****m | 13 |
| Jan Vlcinsky | j****y@t****m | 9 |
| Evan.Mattiza | e****a@g****m | 8 |
| JessicaTegner | j****r@o****m | 7 |
| Tom Barron | t****m@g****m | 4 |
| Adam Nelson | a****m@f****m | 4 |
| Frank Tobia | f****a@f****m | 3 |
| Joshua Li | j****6@p****u | 3 |
| Christian Stade-Schuldt | t****g@y****e | 3 |
| Martin Zugnoni | m****i@g****m | 3 |
| Matt Furden | z****h@g****m | 3 |
| Mat Munn | m****w@d****u | 2 |
| Aaron Eline | a****e@p****t | 2 |
| Dima Spivak | d****a@s****m | 2 |
| Marcel Stör | m****r | 2 |
| Sébastien Eustace | s****n@e****o | 2 |
| Thomas LEVEIL | t****l@g****m | 2 |
| Tim Gates | t****s@i****m | 2 |
| Troy Harrison | i****a@g****m | 2 |
| Tzu-ping Chung | u****r@g****m | 2 |
| wtty-fool | w****l@g****m | 2 |
| Scott Sievert | s****t | 1 |
| Santiago Basulto | s****o@g****m | 1 |
| Pi Delport | p****t@g****m | 1 |
| Mike Pirnat | m****t@g****m | 1 |
| Mat Munn | m****t@m****e | 1 |
| Grigouze | g****e@y****r | 1 |
| and 20 more... | ||
Committer Domains (Top 20 + Academic)
radeksprta.eu: 1
gould.in: 1
salesforce.com: 1
teslahealth.com: 1
digital.gov.au: 1
q2ebanking.com: 1
anomos.info: 1
matmunn.me: 1
iress.com: 1
eustace.io: 1
streamsets.com: 1
parkschool.net: 1
dash.com.au: 1
yahoo.de: 1
psu.edu: 1
fireeye.com: 1
factr.com: 1
tamtamresearch.com: 1
kennethreitz.org: 1
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 4
- Total pull requests: 3
- Average time to close issues: 1 day
- Average time to close pull requests: almost 3 years
- Total issue authors: 4
- Total pull request authors: 3
- Average comments per issue: 2.25
- Average comments per pull request: 1.0
- Merged pull requests: 3
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 0.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- kennethreitz (1)
- nickhell (1)
- Owyn (1)
Pull Request Authors
- timgates42 (2)
- Lenqth (2)
- thomasleveil (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 3
-
Total downloads:
- pypi 304,518 last-month
- Total docker downloads: 7,559
-
Total dependent packages: 31
(may contain duplicates) -
Total dependent repositories: 345
(may contain duplicates) - Total versions: 54
- Total maintainers: 3
pypi.org: maya
Datetimes for Humans.
- Homepage: https://github.com/kennethreitz/maya
- Documentation: https://maya.readthedocs.io/
- License: MIT
-
Latest release: 0.6.1
published about 7 years ago
Rankings
Dependent packages count: 0.5%
Dependent repos count: 0.8%
Docker downloads count: 1.2%
Downloads: 1.3%
Average: 5.2%
Stargazers count: 13.1%
Forks count: 14.2%
Maintainers (3)
Last synced:
6 months ago
proxy.golang.org: github.com/kennethreitz/maya
- Documentation: https://pkg.go.dev/github.com/kennethreitz/maya#section-documentation
- License: mit
-
Latest release: v0.6.1
published about 7 years ago
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced:
6 months ago
conda-forge.org: maya
- Homepage: https://github.com/kennethreitz/maya
- License: MIT
-
Latest release: 0.6.1
published about 7 years ago
Rankings
Dependent packages count: 15.6%
Dependent repos count: 24.3%
Average: 36.1%
Stargazers count: 50.2%
Forks count: 54.1%
Last synced:
6 months ago
Dependencies
.github/workflows/main.yml
actions
- actions/checkout v3 composite
- actions/setup-python v4.2.0 composite
- pypa/gh-action-pypi-publish master composite
setup.py
pypi