
Company News
Socket Has Acquired Secure Annex
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.
awaredatetime
Advanced tools
.. image:: https://img.shields.io/travis/mangohealth/awaredatetime.svg :alt: Build Status :target: https://travis-ci.org/mangohealth/awaredatetime/ .. image:: https://img.shields.io/coveralls/mangohealth/awaredatetime.svg :alt: Code Coverage :target: https://coveralls.io/github/mangohealth/awaredatetime .. image:: https://img.shields.io/pypi/v/awaredatetime.svg :alt: PyPi Version :target: https://pypi.python.org/pypi/awaredatetime/ .. image:: https://img.shields.io/pypi/pyversions/awaredatetime.svg :alt: Supported Python Versions :target: https://pypi.python.org/pypi/awaredatetime/ .. image:: https://img.shields.io/pypi/implementation/awaredatetime.svg :alt: Supported Python Implementations :target: https://pypi.python.org/pypi/awaredatetime
| Module providing a timezone aware datetime.datetime compatible object.
| Supports CPython 2.6 - 3.5 and PyPy.
datetime.datetimedatetime module as much as possible| datetime.datetime objects aren't aware by default.
| New projects should always use timezone aware datetime.datetime objects, but the Python standard library doesn't make that easy.
AwareDatetime is here to help!
|
| You may also have existing code that needs to become timezone aware and migrating code to become timezone aware is tricky.
| Using AwareDatetime will help you track what code has been migrated to support timezone.
A drop-in replacement for datetime.datetime that always provide timezone aware objects.
.. code:: python
>>> 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>)
>>>
| Not implemented since times with a timezone don't make sense.
| e.g. What's the expected behavior for coverting 24:00:00+00:00 to positive UTC offset?
The only dependency is pytz. We recommend that you use the latest version of pytz, but this package will not force that upon you.
datetime_tz_
datetime module, but overrides more datetime behaviorarrow_
datetime module.. _datetime_tz: https://github.com/mithro/python-datetime-tz
.. _arrow: https://github.com/crsmithdev/arrow
__version__ in awaredatetime/__init__.py. This is the responsibility of the repo and package owners.issue <https://github.com/mangohealth/awaredatetime/issues>_ to discuss why the dependency is needed.Google Python Style Guide <https://google.github.io/styleguide/pyguide.html>_.#. Setup the development environment
.. code:: bash
pip install -U -r requirements.dev.txt
#. Make your changes
#. Add unittests for your changes
#. Run tests, which will also check the coding style
.. code:: bash
coverage run --source=awaredatetime setup.py test_dev
#. Once tests pass, ensure that your changes have proper test coverage
.. code:: bash
coverage html && ls htmlcov/index.html
#. Open a PR <https://github.com/mangohealth/awaredatetime/pulls>_
Initial commit
FAQs
Drop-in replacement for timezone aware datetime objects
We found that awaredatetime demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.

Research
/Security News
Socket is tracking cloned Open VSX extensions tied to GlassWorm, with several updated from benign-looking sleepers into malware delivery vehicles.

Product
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.