Skip to main content

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 and the Empty and EmptyDict classes as well as the if_empty 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


Download files

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

Source Distribution

ccptools-1.0.0rc2.tar.gz (60.2 kB view details)

Uploaded Source

Built Distribution

ccptools-1.0.0rc2-py3-none-any.whl (85.5 kB view details)

Uploaded Python 3

File details

Details for the file ccptools-1.0.0rc2.tar.gz.

File metadata

  • Download URL: ccptools-1.0.0rc2.tar.gz
  • Upload date:
  • Size: 60.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for ccptools-1.0.0rc2.tar.gz
Algorithm Hash digest
SHA256 780f702b42b52cc2721ee42c1ed945b7d989f44673a7dbb9d355071b8a449ef1
MD5 6e51e218d160522140744d0e9b4fc689
BLAKE2b-256 50ffb334c6032e2c90eec866b40ecef964f5bd24bacdb7a30ac12d0da6f4cb4c

See more details on using hashes here.

File details

Details for the file ccptools-1.0.0rc2-py3-none-any.whl.

File metadata

  • Download URL: ccptools-1.0.0rc2-py3-none-any.whl
  • Upload date:
  • Size: 85.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for ccptools-1.0.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 60f77b100d58cfc3fa843c28058e0c9e1e1c6f9e67fc22627d7a67d83207670d
MD5 b1990c87321bb6d3772162e94f2afd99
BLAKE2b-256 958cf4e3961fa9f9682e6b89ae87a7e8039563c31b5fee7a15676d4b07f00d33

See more details on using hashes here.

Supported by

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