Skip to main content

Create a timeline by listing events with multilingual support.

Project description

PyTimeliner

Issues open Last commit License Latest version PyPI Version

PyTimeliner is a Python package for working with time-based functions such as formatting, time calculations, and multilingual time expressions. This package provides various tools for handling date and time calculations in multiple languages.

Features

  • Format and humanize time expressions
  • Perform date and time calculations
  • Get time expressions in different languages
  • Useful for applications requiring time-based utilities in various languages

Installation

Using setup.py

First, clone the repository and navigate to the project directory. Then, install the package with:

pip install -e .

This package uses googletrans for translation support. If you are using requirements.txt, make sure it contains:

googletrans==4.0.0-rc1

Usage

Using PyTimeliner, you can perform time calculations, format times, and translate time expressions.

Example Usage

from pytimeliner.timeliner import TimeLiner
from datetime import datetime

# English timeline
timeliner = TimeLiner(language='en')
print(timeliner.format_time(datetime.now()))
print(timeliner.time_since(datetime(2023, 1, 1, 12, 0, 0)))
timeliner.set_language('es')
print(timeliner.time_since(datetime(2023, 1, 1, 12, 0, 0)))

Output

2024-10-29 12:34:56
"298 days ago"        # English
"hace 298 días"       # Spanish (translated)

Development

To contribute to this project, please follow the GitHub Repository and create a fork. Make sure you have the following in requirements.txt:

googletrans==4.0.0-rc1

You can install the requirements with:

pip install -r requirements.txt

Running Tests

To run tests, use the tests folder which contains test files:

python -m unittest discover -s tests

Contributing

If you want to contribute, feel free to open an issue or submit a pull request. All contributions are welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytimeliner-0.4.1.3.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytimeliner-0.4.1.3-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file pytimeliner-0.4.1.3.tar.gz.

File metadata

  • Download URL: pytimeliner-0.4.1.3.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pytimeliner-0.4.1.3.tar.gz
Algorithm Hash digest
SHA256 05cbda7c80d7cefda6240f5b1a83d853078797e50c6b71425da3257576b50881
MD5 8d57fa4bf59e2dd7d9530dadaacbd9a7
BLAKE2b-256 947286979ed9d410e568ac26efebdbc6ba7803d2e8f7c28f3a570bb2ac01e7a3

See more details on using hashes here.

File details

Details for the file pytimeliner-0.4.1.3-py3-none-any.whl.

File metadata

  • Download URL: pytimeliner-0.4.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pytimeliner-0.4.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 40d89cdf254f70486a60b29deaf8360d02e70ddf002a79643bb0578041ae0041
MD5 fcb16f8994139d7837cce1f88b8db3ab
BLAKE2b-256 668e4fdde424d0149c672edcefadde450756c91aa259aade9eae48c620ceb446

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page