Skip to main content

Highly customizable Dota 2 hero grid generator

Project description

D2Grid

A powerful, highly customizable CLI tool for creating and managing your Dota 2 hero grid layouts.

Features

  • Declarative Layouts
  • Multiple Data Sources
  • Automatic Sizing
  • Extensibility (custom sources)
  • Update & Sync (across multiple Steam accounts)

Installation

D2Grid can be installed from PyPI:

# With uv
uv tool install d2grid
# With pipx
pipx install d2grid

Usage

Once installed, run the tool by passing it the path to your configuration file:

d2grid settings.json

Alternatively, you can execute the script without an installation:

# With uv
uvx d2grid settings.json

Or run from the source directly:

# With uv
uv run -m src.d2grid settings.json
# With python (need to install python and dependencies)
python3 -m src.d2grid settings.json

Configuration

The tool is controlled by a single JSON settings file. Here is an example:

{
    "globals": {
        "file_source": "hero_grid_config.json",
        "stratz_api_key": "STRATZ API KEY"
    },
    "result_paths": ["new_hero_grid_config.json"],
    "configs": [
        {
            "name": "Main Grid",
            "columns": [
                { "x": 0.0, "width": 316.0, "width_heroes": 6 },
                { "x": 960, "width": 214, "width_heroes": 4 }
            ],
            "row_gap": 21.5,
            "categories": [
                {
                    "name": "Strength",
                    "source": "attr",
                    "param": "str"
                },
                {
                    "name": "My Custom List",
                    "source": "inline",
                    "param": [1, 2, 3, 14, 56]
                },
                {
                    "name": "Sync from File",
                    "source": "file",
                    "param": { "config": "Fav", "category": 4 }
                },
                {
                    "name": "15 best supports (10 days)",
                    "source": "stratz",
                    "param": {"top": 15, "days": 10, "positions": ["POSITION_4", "POSITION_5"]}
                },
                {
                    "name": "Spectral.gg Core Meta",
                    "source": "spectral",
                    "param": { "top": 12, "position": "P1" }
                }
            ]
        }
    ]
}

The script will create new_hero_grid_config.json containing a single Main Grid layout with five categories distributed across two columns.

Columns control the horizontal layout with automatic vertical sizing based on the number of heroes in each category. The heroes within each category are determined by the specified sources and parameters.

A single settings file can define multiple configs (layouts), each with as many categories as needed.

Dota stores its hero grid configuration at <STEAM_PATH>/userdata/<STEAMID>/570/remote/hero_grid_config.json, which can be used as the path for file_source or result_paths.

The full configuration schema can be printed with the following command:

d2grid --schema

Sources

Sources are callables that provide a list of hero IDs for a category.

Inline Source

Directly provides a list of hero IDs. Use this for static categories.

  • Source Key: "inline"

Parameters

The param field accepts a simple list of hero IDs (integers).

File Source

Pulls heroes from a category in an existing hero_grid_config.json file. Ideal for syncing or preserving manual edits. Requires file_source to be defined in the globals section of your settings.

  • Source Key: "file"

Parameters

The param field is an object with the following properties:

Property Type Description
config integer | string The name (string) or index (integer) of the config to read from. Required
category integer | string The name (string) or index (integer) of the category within that config. Required

Note: When using string names, the first match found will be used.

Attribute Source

Pulls heroes based on their primary attribute, sorted alphabetically.

  • Source Key: "attr"

Parameters

The param field is a string specifying the attribute. Allowed values are: "str", "agi", "int" or "all".

Stratz Source

Pulls the best performing heroes over a specified time window using the STRATZ API. Requires stratz_api_key to be defined in the globals section of your settings.

  • Source Key: "stratz"

Parameters

The param field is an object with the following properties:

Property Type Description
top integer How many heroes to include in the category. Required
sort string Sort method ("rank" or "winrate"). Default: "rank"
days integer Number of recent days of data to consider (1-30). Default: 14
ranks array<string> Rank brackets to filter by. Default: ["IMMORTAL"]
positions array<string> Positions to filter by. Default: [] (all positions)
regions array<string> Regions to filter by. Default: [] (all regions)
game_modes array<string> Game modes to filter by. Default: ["ALL_PICK_RANKED"]

Spectral Source

Pulls the best performing heroes in a specified league from Spectral.gg.

  • Source Key: "spectral"

Parameters

The param field is an object with the following properties:

Property Type Description
top integer How many heroes to include in the category. Required
position string The position to filter by ("P1", "P2", "P3", "P4", "P5"). Required
league string League name. Default: latest ranked patch

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

d2grid-0.3.0.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

d2grid-0.3.0-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

Details for the file d2grid-0.3.0.tar.gz.

File metadata

  • Download URL: d2grid-0.3.0.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for d2grid-0.3.0.tar.gz
Algorithm Hash digest
SHA256 fd4e68eb8a1a6fc763017434d7f3d5eb52e336640c2e2861f90a44b42f6275da
MD5 e9800e23b7169d41d37c3d10e23e6066
BLAKE2b-256 63911a2fd5dc1048c4b657b8daa04350f7c67a5c01ce5055f843aab368ce15e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for d2grid-0.3.0.tar.gz:

Publisher: release-publish.yml on mkk5/d2grid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file d2grid-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: d2grid-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 27.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for d2grid-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 97e2d52294b482e7144e0255351e10348f85eb591e4863db888f4e5b8c15cd2c
MD5 80d7332597f9cdf4f4c674347ff9f7a2
BLAKE2b-256 8f4da45c5ae53a769420bc9bf4ea9e0b38a88d21124c616d43a9eb4fe97d2251

See more details on using hashes here.

Provenance

The following attestation bundles were made for d2grid-0.3.0-py3-none-any.whl:

Publisher: release-publish.yml on mkk5/d2grid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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