Skip to main content

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 logging  # Used pretty much everywhere
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 and EmptyDict classes as well as the if_empty method
  • The EnumEx base class for Enums with the from_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 *

Release files for ccptools 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ccptools 1.2.0
File Size Uploaded
ccptools-1.2.0.tar.gz 48.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ccptools 1.2.0
File Interpreter ABI Platform
ccptools-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 115.4 kB

Release files / ccptools-1.2.0.tar.gz

Download URL ccptools-1.2.0.tar.gz
Size 48.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f18f78c4ab146ce681e5e4c13804eec760cd5b8de41aabd7bdea1839b4935334
BLAKE2b-256 checksum
How to use checksums
cce790e70cac856b9c61ce0501d2de76ec42959778ff817c50840bdada420911
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release files / ccptools-1.2.0-py3-none-any.whl

Download URL ccptools-1.2.0-py3-none-any.whl
Size 67.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52e7bc73d9bc6fbc743e9795b2b497580ebc37d3b8b82f958ea960cf345b4b69
BLAKE2b-256 checksum
How to use checksums
86ff028ac6de1a9b6112cdf2bb4b1e7431a1a7c4970e2b588eafe8392396e5f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page