{"id":22656504,"url":"https://github.com/python-pendulum/pendulum","last_synced_at":"2026-07-10T16:11:08.833Z","repository":{"id":41055494,"uuid":"62095504","full_name":"python-pendulum/pendulum","owner":"python-pendulum","description":"Python datetimes made easy","archived":false,"fork":false,"pushed_at":"2026-06-30T12:28:58.000Z","size":2854,"stargazers_count":6668,"open_issues_count":260,"forks_count":434,"subscribers_count":65,"default_branch":"master","last_synced_at":"2026-07-06T09:32:46.882Z","etag":null,"topics":["date","datetime","python","python3","time","timezones"],"latest_commit_sha":null,"homepage":"https://pendulum.eustace.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/python-pendulum.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["sdispater"]}},"created_at":"2016-06-27T23:37:53.000Z","updated_at":"2026-07-06T06:50:21.000Z","dependencies_parsed_at":"2022-07-14T06:50:33.987Z","dependency_job_id":"b7276f7d-b1dd-4174-af76-db9832dd9430","html_url":"https://github.com/python-pendulum/pendulum","commit_stats":{"total_commits":745,"total_committers":99,"mean_commits":7.525252525252525,"dds":0.3516778523489933,"last_synced_commit":"df4d44c94adf0852df1722201ecaf0f0e6b829f9"},"previous_names":["python-pendulum/pendulum"],"tags_count":56,"template":false,"template_full_name":null,"purl":"pkg:github/python-pendulum/pendulum","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pendulum%2Fpendulum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pendulum%2Fpendulum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pendulum%2Fpendulum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pendulum%2Fpendulum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/python-pendulum","download_url":"https://codeload.github.com/python-pendulum/pendulum/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-pendulum%2Fpendulum/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35187624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-06T02:00:07.184Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["date","datetime","python","python3","time","timezones"],"created_at":"2024-12-09T10:08:58.579Z","updated_at":"2026-07-10T16:11:08.777Z","avatar_url":"https://github.com/python-pendulum.png","language":"Python","funding_links":["https://github.com/sponsors/sdispater"],"categories":["Python","Date \u0026 Time","Date \u0026 Time Utilities","Date and Time"],"sub_categories":[],"readme":"Pendulum\n########\n\n.. image:: https://img.shields.io/pypi/v/pendulum.svg\n    :target: https://pypi.python.org/pypi/pendulum\n\n.. image:: https://img.shields.io/pypi/l/pendulum.svg\n    :target: https://pypi.python.org/pypi/pendulum\n\n.. image:: https://github.com/sdispater/pendulum/actions/workflows/tests.yml/badge.svg\n    :alt: Pendulum Build status\n    :target: https://github.com/sdispater/pendulum/actions\n\nPython datetimes made easy.\n\nSupports Python **3.9 and newer**.\n\n\n.. code-block:: python\n\n   \u003e\u003e\u003e import pendulum\n\n   \u003e\u003e\u003e now_in_paris = pendulum.now('Europe/Paris')\n   \u003e\u003e\u003e now_in_paris\n   '2016-07-04T00:49:58.502116+02:00'\n\n   # Seamless timezone switching\n   \u003e\u003e\u003e now_in_paris.in_timezone('UTC')\n   '2016-07-03T22:49:58.502116+00:00'\n\n   \u003e\u003e\u003e tomorrow = pendulum.now().add(days=1)\n   \u003e\u003e\u003e last_week = pendulum.now().subtract(weeks=1)\n\n   \u003e\u003e\u003e past = pendulum.now().subtract(minutes=2)\n   \u003e\u003e\u003e past.diff_for_humans()\n   '2 minutes ago'\n\n   \u003e\u003e\u003e delta = past - last_week\n   \u003e\u003e\u003e delta.hours\n   23\n   \u003e\u003e\u003e delta.in_words(locale='en')\n   '6 days 23 hours 58 minutes'\n\n   # Proper handling of datetime normalization\n   \u003e\u003e\u003e pendulum.datetime(2013, 3, 31, 2, 30, tz='Europe/Paris')\n   '2013-03-31T03:30:00+02:00' # 2:30 does not exist (Skipped time)\n\n   # Proper handling of dst transitions\n   \u003e\u003e\u003e just_before = pendulum.datetime(2013, 3, 31, 1, 59, 59, 999999, tz='Europe/Paris')\n   '2013-03-31T01:59:59.999999+01:00'\n   \u003e\u003e\u003e just_before.add(microseconds=1)\n   '2013-03-31T03:00:00+02:00'\n\n\nResources\n=========\n\n* `Official Website \u003chttps://pendulum.eustace.io\u003e`_\n* `Documentation \u003chttps://pendulum.eustace.io/docs/\u003e`_\n* `Issue Tracker \u003chttps://github.com/sdispater/pendulum/issues\u003e`_\n\nWhy Pendulum?\n=============\n\nNative ``datetime`` instances are enough for basic cases but when you face more complex use-cases\nthey often show limitations and are not so intuitive to work with.\n``Pendulum`` provides a cleaner and more easy to use API while still relying on the standard library.\nSo it's still ``datetime`` but better.\n\nUnlike other datetime libraries for Python, Pendulum is a drop-in replacement\nfor the standard ``datetime`` class (it inherits from it), so, basically, you can replace all your ``datetime``\ninstances by ``DateTime`` instances in your code (exceptions exist for libraries that check\nthe type of the objects by using the ``type`` function like ``sqlite3`` or ``PyMySQL`` for instance).\n\nIt also removes the notion of naive datetimes: each ``Pendulum`` instance is timezone-aware\nand by default in ``UTC`` for ease of use.\n\nPendulum also improves the standard ``timedelta`` class by providing more intuitive methods and properties.\n\nLimitations\n===========\n\nEven though the ``DateTime`` class is a subclass of ``datetime`` there are some rare cases where\nit can't replace the native class directly. Here is a list (non-exhaustive) of the reported cases with\na possible solution, if any:\n\n* ``sqlite3`` will use the ``type()`` function to determine the type of the object by default. To work around it you can register a new adapter:\n\n.. code-block:: python\n\n    from pendulum import DateTime\n    from sqlite3 import register_adapter\n\n    register_adapter(DateTime, lambda val: val.isoformat(' '))\n\n* ``mysqlclient`` (former ``MySQLdb``) and ``PyMySQL`` will use the ``type()`` function to determine the type of the object by default. To work around it you can register a new adapter:\n\n.. code-block:: python\n\n    import MySQLdb.converters\n    import pymysql.converters\n\n    from pendulum import DateTime\n\n    MySQLdb.converters.conversions[DateTime] = MySQLdb.converters.DateTime2literal\n    pymysql.converters.conversions[DateTime] = pymysql.converters.escape_datetime\n\n* ``django`` will use the ``isoformat()`` method to store datetimes in the database. However since ``pendulum`` is always timezone aware the offset information will always be returned by ``isoformat()`` raising an error, at least for MySQL databases. To work around it you can either create your own ``DateTimeField`` or use the previous workaround for ``MySQLdb``:\n\n.. code-block:: python\n\n    from django.db.models import DateTimeField as BaseDateTimeField\n    from pendulum import DateTime\n\n\n    class DateTimeField(BaseDateTimeField):\n\n        def value_to_string(self, obj):\n            val = self.value_from_object(obj)\n\n            if isinstance(value, DateTime):\n                return value.to_datetime_string()\n\n            return '' if val is None else val.isoformat()\n\n\nContributing\n============\n\nContributions are welcome, especially with localization.\n\nGetting started\n---------------\n\nTo work on the Pendulum codebase, you'll want to clone the project locally\nand install the required dependencies via `poetry \u003chttps://poetry.eustace.io\u003e`_.\n\n.. code-block:: bash\n\n    $ git clone git@github.com:sdispater/pendulum.git\n    $ poetry install\n\nLocalization\n------------\n\nIf you want to help with localization, there are two different cases: the locale already exists\nor not.\n\nIf the locale does not exist you will need to create it by using the ``clock`` utility:\n\n.. code-block:: bash\n\n    ./clock locale create \u003cyour-locale\u003e\n\nIt will generate a directory in ``pendulum/locales`` named after your locale, with the following\nstructure:\n\n.. code-block:: text\n\n    \u003cyour-locale\u003e/\n        - custom.py\n        - locale.py\n\nThe ``locale.py`` file must not be modified. It contains the translations provided by\nthe CLDR database.\n\nThe ``custom.py`` file is the one you want to modify. It contains the data needed\nby Pendulum that are not provided by the CLDR database. You can take the `en \u003chttps://github.com/sdispater/pendulum/tree/master/src/pendulum/locales/en/custom.py\u003e`_\ndata as a reference to see which data is needed.\n\nYou should also add tests for the created or modified locale.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-pendulum%2Fpendulum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpython-pendulum%2Fpendulum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-pendulum%2Fpendulum/lists"}