python-tf2-utilities
A fast, reliable, and easy-to-use Python library for accessing detailed Team Fortress 2 (TF2) data, including items, skins, effects, and more. Built for developers, this library simplifies retrieving and managing TF2 assets, with minimal setup and optimized performance.
Inspired by TF2autobot's node-tf2-schema and TF2autobot's node-tf2-sku, this library supports a wide range of TF2-related applications.
Key Features
- Item Management: Easily convert between item SKUs, names, and object formats.
- Schema Integration: Access and manipulate detailed TF2 schema data, such as item attributes, qualities, and effects.
- Comprehensive Tools: Work with unusual effects, paint kits, skins, crate series, crafting recipes, and trade configurations.
- Lightweight Mode: Optimize performance by only loading essential schema data for resource-constrained applications.
- Automatic Updates: Automatically stay up to date with schema changes through configurable update intervals.
- User-Friendly API: Simplify development with clean, consistent, and intuitive methods.
Installation
Install the library using pip:
pip install tf2-utilities
Prerequisites:
- Python 3.10 or later
- A Steam Web API key (obtain it from here)
Getting Started
Initialize the Library
To initialize the schema, you’ll need your Steam Web API key:
from tf2utilities.main import TF2
# Initialize the TF2 utilities with your Steam API key and settings
schema = TF2(
api_key="your_steam_api_key", # Your Steam Web API key
auto_update=True, # Enable automatic schema updates
update_time=86400, # Update interval in seconds (default: 1 day)
lite=False # Enable lightweight mode (default: False)
).schema
Common Use Cases
- Convert Item SKU to Item Name
item_name = schema.get_name_from_sku("5021;6")
print(item_name) # Output: "Mann Co. Supply Crate Key"
- Convert Item Name to Item SKU
item_sku = schema.get_sku_from_name("Mann Co. Supply Crate Key")
print(item_sku) # Output: "5021;6"
- Retrieve TF2 Schema as JSON
schema_data = schema.to_json()
print(schema_data) # Output: JSON representation of the schema data
SKU Utilities
- Convert Item SKU to Item Object
from tf2utilities.sku import SKU
item_object = SKU.from_string("5021;6")
print(item_object) # Output: Item object representing the SKU
- Convert Item Object to Item SKU
item_object = {
"defindex": 5021,
"quality": 6,
"craftable": True,
"tradable": True,
"killstreak": 0,
"australium": False,
"effect": None,
"festive": False,
"paintkit": None,
"wear": None,
"quality2": None,
"craftnumber": None,
"crateseries": None,
"target": None,
"output": None,
"outputQuality": None,
"paint": None
}
item_sku = SKU.from_object(item_object)
print(item_sku) # Output: "5021;6"
- Convert Steam Inventory API Data to Item SKU
SKU.from_API converts an item description object from the Steam Community inventory
endpoint (e.g. https://steamcommunity.com/inventory/<steamid>/440/2?l=english) into a SKU.
schema = TF2(api_key="your_steam_api_key").schema
# item is one entry from the inventory response's "descriptions" array
item_sku = SKU.from_API(item, schema)
print(item_sku) # Output: SKU based on the inventory item
Configuration
| Parameter | Description | Default |
|---|---|---|
api_key |
Your Steam Web API key. | None |
auto_update |
Enable or disable automatic schema updates. | False |
update_time |
Time interval (in seconds) between schema updates. | 86400 (1 day) |
lite |
Enable lightweight mode for reduced memory usage. | False |
Contributing
We welcome contributions! If you’d like to improve the library, fix bugs, or add features, please fork the repository, create a branch, and submit a pull request. For ideas or issues, feel free to open an issue on GitHub.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Metadata
Release files for tf2-utilities 4.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tf2_utilities-4.2.0.tar.gz | 25.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tf2_utilities-4.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.4 kB
Release files / tf2_utilities-4.2.0.tar.gz
| Download URL | tf2_utilities-4.2.0.tar.gz |
|---|---|
| Size | 25.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2fef211369bc544ea5f511b552c02c57f06283edfc7ae37b0b896d594703bdd9
|
|
BLAKE2b-256 checksum How to use checksums |
efeb884e58cf0c852563ca41a6c3a24bb849c404ba983fbeb037b5fc3e8bf8f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.
Transparency logRelease files / tf2_utilities-4.2.0-py3-none-any.whl
| Download URL | tf2_utilities-4.2.0-py3-none-any.whl |
|---|---|
| Size | 25.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0732d792ea4acf0335f81b7ac0d71a2ccdb268bc1c2eef3e46b634eaca23f224
|
|
BLAKE2b-256 checksum How to use checksums |
2ffb65390f0a702242a2a8273d94e009875798cd08d93cf6ddf04ca1528c4724
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.
Transparency log