The CCP Tools team utilities for date and/or time objects and values and messing with types.
Project description
CCP Games Python Toolkit
A smooshup of a few Python packages from the CCP Tools Team of old (Team Batcave).
Our two most commonly used internal packages, called datetimeutils
and
typeutils
were too generically named for Pypi.org and since they were
both used in something like 80-90% of our other projects, it made sense to
just smoosh them together in one module, and thus, the ccptools
package
was born.
Here's the README of the Date Time Utils submodule.
Here's the README of the Type Utils submodule.
Date-Time Utils
The old datetimeutils
package is now included here as the dtu
submodule.
from ccptools import dtu
Changes from datetimeutils
The name has been shortened to dtu
to speed up usage (although you can
also just go from ccptools.dtu import *
if you wish).
The code has also been quite heavily refactored but everything that was
available in datetimeutils
2.3.0.0 should be accessible via ccptools.legacyapi.datetimeutils
.
That is, for a super low-effort upgrade from older datetimeutils
version
to the new ccptools
package, simply replace...:
import datetimeutils
...with...
from ccptools.legacyapi import datetimeutils
...and everything should work fine! :)
Note that any Python 2.7 support has been removed.
Changes from typeutils
The name has been shortened to tpu
although that's more to fit in with the
dtu
pattern. It shouldn't really matter since typeutils
was rarely if
ever imported directly since it was split into multiple submodules from the
start.
Nevertheless to accommodate any changed from typeutils
3.5.0.0 and ease
migration over to ccptools
the old API is aliased in
ccptools.legacyapi.typeutils
.
So you can simply replace
from typeutils import metas
...with...
from ccptools.legacyapi.typeutils import metas
...and everything should work fine! :)
Note that any Python 2.7 support has been removed.
Structs
Importing *
from the structs
submodule will import all of the most
commonly used imports in our projects:
from typing import * # For type annotation
import abc # For interfaces (Abstract Base Classes)
import dataclasses # For dataclass structs
import decimal # Used whenever we're handling money
import enum # Also used for struct creation
import re # Used surprisingly frequently
import time # Very commonly used
Note that datetime is not included in this. That's because tt'll also import
the aliases from the Datetime Utils (ccptools.dtu.structs.aliases
)
package instead:
Date = datetime.date
Time = datetime.time
Datetime = datetime.datetime
TimeDelta = datetime.timedelta
TzInfo = datetime.tzinfo
TimeZone = datetime.timezone
Furthermore, it'll also include a few of the most commonly used utility classes from the Type Utils submodule:
- The
Singleton
Meta Class - The
Empty
andEmptyDict
classes as well as theif_empty
method - The
EnumEx
base class for Enums with thefrom_any
class method
So in most cases we can cover something like 90% of any imports we tend to need in every Python file with a single line:
from ccptools.structs import *
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 Distribution
Built Distribution
File details
Details for the file ccptools-1.1.0.tar.gz
.
File metadata
- Download URL: ccptools-1.1.0.tar.gz
- Upload date:
- Size: 46.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3a71e75017c8ae1e60baa1cbe7d52c0406d0ae75955a61c467a081752cb9aa5 |
|
MD5 | 3c9f21e8391d30be51c49d71c4c10521 |
|
BLAKE2b-256 | 94c640a23223579e78b4c3d2aa32ee3f64f80e6372e0ed79a55d0c68ad6ccd74 |
File details
Details for the file ccptools-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: ccptools-1.1.0-py3-none-any.whl
- Upload date:
- Size: 64.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 602b7f6f4da10215838ff8a844571db74724fd4ff4df814f0111aa1f0889db5c |
|
MD5 | 3202604db613ff2b8aa27bc644bb3a3a |
|
BLAKE2b-256 | c76aefdf4cef40d24b567b366a4f00db86c93eb2ec2bdbee2e96110b4e5f44cb |