Metadata-Version: 2.4
Name: strelki
Version: 0.1.1
Summary: Better dates & times for Python
Keywords: strelki,date,time,datetime,timestamp,timezone,humanize
Author-email: Chris Smith <crsmithdev@gmail.com>
Requires-Python: >=3.8
Description-Content-Type: text/x-rst
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: OS Independent
License-File: LICENSE
Requires-Dist: python-dateutil>=2.7.0
Requires-Dist: backports.zoneinfo==0.2.1;python_version<'3.9'
Requires-Dist: tzdata;python_version>='3.9'
Requires-Dist: doc8 ; extra == "doc"
Requires-Dist: sphinx>=7.0.0 ; extra == "doc"
Requires-Dist: sphinx-autobuild ; extra == "doc"
Requires-Dist: sphinx-autodoc-typehints ; extra == "doc"
Requires-Dist: myst-parser ; extra == "doc"
Requires-Dist: sphinx_rtd_theme>=1.3.0 ; extra == "doc"
Requires-Dist: dateparser==1.* ; extra == "test"
Requires-Dist: pre-commit ; extra == "test"
Requires-Dist: pytest ; extra == "test"
Requires-Dist: pytest-cov ; extra == "test"
Requires-Dist: pytest-mock ; extra == "test"
Requires-Dist: pytz==2026.1 ; extra == "test"
Requires-Dist: ruff ; extra == "test"
Requires-Dist: simplejson==3.* ; extra == "test"
Requires-Dist: ty ; extra == "test"
Requires-Dist: types-python-dateutil>=2.8.10 ; extra == "test"
Project-URL: Documentation, https://strelki.readthedocs.io
Project-URL: Issues, https://github.com/krisfremen/strelki/issues
Project-URL: Source, https://github.com/krisfremen/strelki
Provides-Extra: doc
Provides-Extra: test

Strelki: Better dates & times for Python
==================================================

.. start-inclusion-marker-do-not-remove

.. image:: https://github.com/krisfremen/strelki/workflows/tests/badge.svg?branch=master
   :alt: Build Status
   :target: https://github.com/krisfremen/strelki/actions?query=workflow%3Atests+branch%3Amaster

.. image:: https://codecov.io/gh/krisfremen/strelki/branch/master/graph/badge.svg
   :alt: Coverage
   :target: https://codecov.io/gh/krisfremen/strelki

.. image:: https://img.shields.io/pypi/v/strelki.svg
   :alt: PyPI Version
   :target: https://pypi.python.org/pypi/strelki

.. image:: https://img.shields.io/pypi/pyversions/strelki.svg
   :alt: Supported Python Versions
   :target: https://pypi.python.org/pypi/strelki

.. image:: https://img.shields.io/pypi/l/strelki.svg
   :alt: License
   :target: https://pypi.python.org/pypi/strelki

.. image:: https://img.shields.io/badge/linting-ruff-blue.svg
   :alt: Linting: Ruff
   :target: https://github.com/astral-sh/ruff


**Strelki** is a Python library that offers a sensible and human-friendly approach to creating, manipulating, formatting and converting dates, times and timestamps. It implements and updates the datetime type, plugging gaps in functionality and providing an intelligent module API that supports many common creation scenarios. Simply put, it helps you work with dates and times with fewer imports and a lot less code.

Strelki is plural for arrow in Macedonian. Strelki takes its name from the `arrow of time <https://en.wikipedia.org/wiki/Arrow_of_time>`_ and is heavily inspired by `moment.js <https://github.com/moment/moment>`_ and `requests <https://github.com/psf/requests>`_.

Strelki is an experimental fork for testing new ideas. Upstream `Arrow <https://github.com/arrow-py/arrow>`_ should still be your default choice unless you specifically need features that are experimental and only implemented here.

Why use Strelki over built-in modules?
--------------------------------------

Python's standard library and some other low-level modules have near-complete date, time and timezone functionality, but don't work very well from a usability perspective:

- Too many modules: datetime, time, calendar, dateutil, pytz and more
- Too many types: date, time, datetime, tzinfo, timedelta, relativedelta, etc.
- Timezones and timestamp conversions are verbose and unpleasant
- Timezone naivety is the norm
- Gaps in functionality: ISO 8601 parsing, timespans, humanization

Features
--------

- Fully-implemented, drop-in replacement for datetime
- Support for Python 3.8+
- Timezone-aware and UTC by default
- Super-simple creation options for many common input scenarios
- ``shift`` method with support for relative offsets, including weeks
- Format and parse strings automatically
- Wide support for the `ISO 8601 <https://en.wikipedia.org/wiki/ISO_8601>`_ standard
- Timezone conversion
- Support for ``dateutil``, ``pytz``, and ``ZoneInfo`` tzinfo objects
- Generates time spans, ranges, floors and ceilings for time frames ranging from microsecond to year
- Humanize dates and times with a growing list of contributed locales
- Extensible for your own Arrow-derived types
- Full support for PEP 484-style type hints

Quick Start
-----------

Installation
~~~~~~~~~~~~

To install Strelki, use `pip <https://pip.pypa.io/en/stable/quickstart/>`_ or `pipenv <https://docs.pipenv.org>`_:

.. code-block:: console

    $ pip install -U strelki

Example Usage
~~~~~~~~~~~~~

.. code-block:: python

    >>> import strelki
    >>> strelki.get('2013-05-11T21:23:58.970460+07:00')
    <Arrow [2013-05-11T21:23:58.970460+07:00]>

    >>> utc = strelki.utcnow()
    >>> utc
    <Arrow [2013-05-11T21:23:58.970460+00:00]>

    >>> utc = utc.shift(hours=-1)
    >>> utc
    <Arrow [2013-05-11T20:23:58.970460+00:00]>

    >>> local = utc.to('US/Pacific')
    >>> local
    <Arrow [2013-05-11T13:23:58.970460-07:00]>

    >>> local.timestamp()
    1368303838.970460

    >>> local.format()
    '2013-05-11 13:23:58 -07:00'

    >>> local.format('YYYY-MM-DD HH:mm:ss ZZ')
    '2013-05-11 13:23:58 -07:00'

    >>> local.humanize()
    'an hour ago'

    >>> local.humanize(locale='ko-kr')
    '한시간 전'

.. end-inclusion-marker-do-not-remove

Documentation
-------------

For full documentation, please visit `strelki.readthedocs.io <https://strelki.readthedocs.io>`_.

Contributing
------------

Contributions are welcome for both code and localizations (adding and updating locales). Begin by gaining familiarity with the Arrow library and its features. Then, jump into contributing:

#. Find an issue or feature to tackle on the `issue tracker <https://github.com/krisfremen/strelki/issues>`_. Issues marked with the `"good first issue" label <https://github.com/krisfremen/strelki/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_ may be a great place to start!
#. Fork `this repository <https://github.com/krisfremen/strelki>`_ on GitHub and begin making changes in a branch.
#. Add a few tests to ensure that the bug was fixed or the feature works as expected.
#. Run the development environment and checks with ``uv sync --all-extras && uv run pytest && uv run pre-commit run --all-files --show-diff-on-failure && uv run --directory docs make html``.
#. Submit a pull request and await feedback 😃.
#. Use a conventional commit-style PR title such as ``fix: ...`` or ``feat: ...`` so release-please can infer the next version.


If you have any questions along the way, feel free to ask them `here <https://github.com/krisfremen/strelki/discussions>`_.

Support Strelki
---------------

`Open Collective <https://opencollective.com/>`_ is an online funding platform that provides tools to raise money and share your finances with full transparency. It is the platform of choice for individuals and companies to make one-time or recurring donations directly to the project. If you are interested in making a financial contribution, please visit the `Strelki collective <https://opencollective.com/strelki>`_.

