Drop-in replacement for timezone aware datetime objects
Project description
awaredatetime
Features
Drop-in replacement for datetime.datetime
Simple implementation that leverages the built-in datetime module as much as possible
Excellent test coverage
Motivation
awaredatetime.AwareDatetime
A drop-in replacement for datetime.datetime that always provide timezone aware objects.
Example Usage
>>> from awaredatetime import AwareDatetime
>>> AwareDatetime(2016, 1, 1)
AwareDatetime(2016, 1, 1, 0, 0, tzinfo=<UTC>)
>>> import datetime
>>> AwareDatetime.from_datetime(datetime.datetime(2016, 1, 1))
AwareDatetime(2016, 1, 1, 0, 0, tzinfo=<UTC>)
>>>
awaredatetime.AwareTime
Dependencies
The only dependency is pytz. We recommend that you use the latest version of pytz, but this package will not force that upon you.
Migrating Existing Code
Similar work
datetime_tz - Another timezone aware drop-in replacement for the datetime module, but overrides more datetime behavior
arrow - An API-compatible re-write of the datetime module
Contributing
Guidelines
Do not change the CHANGELOG file or __version__ in awaredatetime/__init__.py. This is the responsibility of the repo and package owners.
Before adding a dependency, open an issue to discuss why the dependency is needed.
Follow the Google Python Style Guide.
Steps
Setup the development environment
pip install -U -r requirements.dev.txt
Make your changes
Add unittests for your changes
Run tests, which will also check the coding style
coverage run --source=awaredatetime setup.py test_dev
Once tests pass, ensure that your changes have proper test coverage
coverage html && ls htmlcov/index.html
Open a PR
Changelog
0.0.2 (2016-06-20)
Change how package versioning is determined
0.0.1 (2016-06-20)
Initial commit
AwareDatetime is compatible with all known datetime.datetime methods and constants
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file awaredatetime-0.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: awaredatetime-0.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b07d8b97613832ef4208a9bc9989071320545ba675a942f262bd9d8c1ff3e2f |
|
MD5 | 817a9e08732c227b306904164ef3369a |
|
BLAKE2b-256 | d27e25e4f1e14e8bc629467d867558956b75b43626cb863f63985e41afa1044e |