pyciv7


Namepyciv7 JSON
Version 1.0.1 PyPI version JSON
download
home_pageNone
SummaryPython bindings for the Sid Meier's Civilization VII Software Development Kit (SDK)
upload_time2025-08-21 05:20:38
maintainerNone
docs_urlNone
authorDylan Manuel
requires_python<3.14,>3.8
licenseMIT License Copyright (c) 2025 Dylan Manuel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords civilization civ7 sdk python bindings
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!-- markdownlint-disable first-line-heading -->
![Build Status](https://github.com/dmanuel64/pyciv7/actions/workflows/test.yml/badge.svg?branch=main)
![PyPI](https://img.shields.io/pypi/v/pyciv7)
![Python Version](https://img.shields.io/pypi/pyversions/pyciv7)
![License](https://img.shields.io/github/license/dmanuel64/pyciv7)


# `pyciv7`

Python bindings for the **Sid Meier’s Civilization VII SDK**.

Easily build, validate, and package Civilization 7 mods using Python instead of hand-writing `.modinfo` XML.

## Features

- **High-level mod definition**: Define your mods in Pydantic models and export `.modinfo` XML automatically.
- **Validation & recommendations**: Get warnings when mod metadata is missing or incorrectly formatted.
- **SQLAlchemy integration**: Embed SQLAlchemy queries directly into your mods instead of writing raw SQL files.
- **Settings auto-detection**: Automatically detects Civ7 installation and settings directories across Windows, macOS, and Linux.

## Quick Example

```python
import pyciv7
from pyciv7.modinfo import *
from sqlalchemy import text

sql_statement = text(
    "INSERT INTO Types"
    "\n        (Type,                              Kind)"
    "\nVALUES  ('TRADITION_FXS_CYLINDER_SEALS',    'KIND_TRADITION');"
    "\n"
    "\nINSERT INTO TraditionModifiers"
    "\n  ("
    "\n   TraditionType,"
    "\n   ModifierId"
    "\n  )"
    "\nVALUES ("
    "\n   'TRADITION_PANJI',"
    "\n   'MOD_FXS_TRADITION_PANJI_QUARTER_CULTURE'"
    "\n  ),"
    "\n  ("
    "\n   'TRADITION_PANJI',"
    "\n   'MOD_FXS_TRADITION_PANJI_QUARTER_CULTURE_ISLAND'"
    "\n  );"
)

mod = Mod(
    id="fxs-new-policies",
    version="1",
    properties=Properties(
        name="Antiquity Policies",
        description="Adds new policies to the Antiquity Age",
        authors="Firaxis",
        affects_saved_games=True,
    ),
    action_criteria=[
        Criteria(
            id="antiquity-age-current",
            conditions=[AgeInUse(age="AGE_ANTIQUITY")],
        )
    ],
    action_groups=[
        ActionGroup(
            id="antiquity-game",
            scope="game",
            criteria="antiquity-age-current",
            # Items can still be a relative path to a SQL/XML file
            actions=[UpdateDatabase(items=[sql_statement])],
        )
    ],
)

# If you want to use a dictionary instead of importing all the models, you can also do
# Mod.model_validate({"id": "fxs-new-policies", "properties": {"name": "Antiquity Policies"}, ... etc.})
pyciv7.build(mod)
```

This Python snippet produces a `.modinfo` XML similar to the SDK's "Getting Started" example:

```xml
<Mod id="fxs-new-policies" version="1" xmlns="ModInfo">
    <Properties>
        <Name>Antiquity Policies</Name>
        <Description>Adds new policies to the Antiquity Age</Description>
        <Authors>Firaxis</Authors>
        <AffectsSavedGames>1</AffectsSavedGames>
    </Properties>
    <ActionCriteria>
        <Criteria id="antiquity-age-current">
            <AgeInUse>AGE_ANTIQUITY</AgeInUse>
        </Criteria>
    </ActionCriteria>
    <ActionGroups>
        <ActionGroup id="antiquity-game" scope="game" criteria="antiquity-age-current">
            <Actions>
                <UpdateDatabase>
                    <Item>sql_statements/65a41eff-c3b5-4982-92d1-ee02ea02e9b8.sql</Item>
                </UpdateDatabase>
            </Actions>
        </ActionGroup>
    </ActionGroups>
</Mod>
```

## Installation

With `uv` (preferred):

```bash
uv add pyciv7
```

Or with `pip`:

```bash
pip install pyciv7
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyciv7",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.14,>3.8",
    "maintainer_email": null,
    "keywords": "civilization, civ7, sdk, python bindings",
    "author": "Dylan Manuel",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/f0/73/ee3018a2cdf547d4b7d9cd811a377b4f3d5cd2887fa5b7da06439c066164/pyciv7-1.0.1.tar.gz",
    "platform": null,
    "description": "<!-- markdownlint-disable first-line-heading -->\n![Build Status](https://github.com/dmanuel64/pyciv7/actions/workflows/test.yml/badge.svg?branch=main)\n![PyPI](https://img.shields.io/pypi/v/pyciv7)\n![Python Version](https://img.shields.io/pypi/pyversions/pyciv7)\n![License](https://img.shields.io/github/license/dmanuel64/pyciv7)\n\n\n# `pyciv7`\n\nPython bindings for the **Sid Meier\u2019s Civilization VII SDK**.\n\nEasily build, validate, and package Civilization 7 mods using Python instead of hand-writing `.modinfo` XML.\n\n## Features\n\n- **High-level mod definition**: Define your mods in Pydantic models and export `.modinfo` XML automatically.\n- **Validation & recommendations**: Get warnings when mod metadata is missing or incorrectly formatted.\n- **SQLAlchemy integration**: Embed SQLAlchemy queries directly into your mods instead of writing raw SQL files.\n- **Settings auto-detection**: Automatically detects Civ7 installation and settings directories across Windows, macOS, and Linux.\n\n## Quick Example\n\n```python\nimport pyciv7\nfrom pyciv7.modinfo import *\nfrom sqlalchemy import text\n\nsql_statement = text(\n    \"INSERT INTO Types\"\n    \"\\n        (Type,                              Kind)\"\n    \"\\nVALUES  ('TRADITION_FXS_CYLINDER_SEALS',    'KIND_TRADITION');\"\n    \"\\n\"\n    \"\\nINSERT INTO TraditionModifiers\"\n    \"\\n  (\"\n    \"\\n   TraditionType,\"\n    \"\\n   ModifierId\"\n    \"\\n  )\"\n    \"\\nVALUES (\"\n    \"\\n   'TRADITION_PANJI',\"\n    \"\\n   'MOD_FXS_TRADITION_PANJI_QUARTER_CULTURE'\"\n    \"\\n  ),\"\n    \"\\n  (\"\n    \"\\n   'TRADITION_PANJI',\"\n    \"\\n   'MOD_FXS_TRADITION_PANJI_QUARTER_CULTURE_ISLAND'\"\n    \"\\n  );\"\n)\n\nmod = Mod(\n    id=\"fxs-new-policies\",\n    version=\"1\",\n    properties=Properties(\n        name=\"Antiquity Policies\",\n        description=\"Adds new policies to the Antiquity Age\",\n        authors=\"Firaxis\",\n        affects_saved_games=True,\n    ),\n    action_criteria=[\n        Criteria(\n            id=\"antiquity-age-current\",\n            conditions=[AgeInUse(age=\"AGE_ANTIQUITY\")],\n        )\n    ],\n    action_groups=[\n        ActionGroup(\n            id=\"antiquity-game\",\n            scope=\"game\",\n            criteria=\"antiquity-age-current\",\n            # Items can still be a relative path to a SQL/XML file\n            actions=[UpdateDatabase(items=[sql_statement])],\n        )\n    ],\n)\n\n# If you want to use a dictionary instead of importing all the models, you can also do\n# Mod.model_validate({\"id\": \"fxs-new-policies\", \"properties\": {\"name\": \"Antiquity Policies\"}, ... etc.})\npyciv7.build(mod)\n```\n\nThis Python snippet produces a `.modinfo` XML similar to the SDK's \"Getting Started\" example:\n\n```xml\n<Mod id=\"fxs-new-policies\" version=\"1\" xmlns=\"ModInfo\">\n    <Properties>\n        <Name>Antiquity Policies</Name>\n        <Description>Adds new policies to the Antiquity Age</Description>\n        <Authors>Firaxis</Authors>\n        <AffectsSavedGames>1</AffectsSavedGames>\n    </Properties>\n    <ActionCriteria>\n        <Criteria id=\"antiquity-age-current\">\n            <AgeInUse>AGE_ANTIQUITY</AgeInUse>\n        </Criteria>\n    </ActionCriteria>\n    <ActionGroups>\n        <ActionGroup id=\"antiquity-game\" scope=\"game\" criteria=\"antiquity-age-current\">\n            <Actions>\n                <UpdateDatabase>\n                    <Item>sql_statements/65a41eff-c3b5-4982-92d1-ee02ea02e9b8.sql</Item>\n                </UpdateDatabase>\n            </Actions>\n        </ActionGroup>\n    </ActionGroups>\n</Mod>\n```\n\n## Installation\n\nWith `uv` (preferred):\n\n```bash\nuv add pyciv7\n```\n\nOr with `pip`:\n\n```bash\npip install pyciv7\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2025 Dylan Manuel  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Python bindings for the Sid Meier's Civilization VII Software Development Kit (SDK)",
    "version": "1.0.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/dmanuel64/pyciv7/issues",
        "Homepage": "https://github.com/dmanuel64/pyciv7",
        "Repository": "https://github.com/dmanuel64/pyciv7"
    },
    "split_keywords": [
        "civilization",
        " civ7",
        " sdk",
        " python bindings"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d103f564f9f635de7d774afdc7fabb2ece81de79636bd82bb187256c403079d1",
                "md5": "8ed3d3a6b1a23317347bbe8d8c23a920",
                "sha256": "8bec1ead9aabf332bcd6503b6f7e37a95fc8f699cb4bbbfc5a1c566a8ad0f8e5"
            },
            "downloads": -1,
            "filename": "pyciv7-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8ed3d3a6b1a23317347bbe8d8c23a920",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.14,>3.8",
            "size": 16478,
            "upload_time": "2025-08-21T05:20:37",
            "upload_time_iso_8601": "2025-08-21T05:20:37.376057Z",
            "url": "https://files.pythonhosted.org/packages/d1/03/f564f9f635de7d774afdc7fabb2ece81de79636bd82bb187256c403079d1/pyciv7-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f073ee3018a2cdf547d4b7d9cd811a377b4f3d5cd2887fa5b7da06439c066164",
                "md5": "1c17d141bb0cbce800ca1a5b65fdcdd5",
                "sha256": "07e57c61318552ef26d0bb097ff4fe12b8e17699a3ce3d89a9b5885c7a475df4"
            },
            "downloads": -1,
            "filename": "pyciv7-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1c17d141bb0cbce800ca1a5b65fdcdd5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.14,>3.8",
            "size": 12061,
            "upload_time": "2025-08-21T05:20:38",
            "upload_time_iso_8601": "2025-08-21T05:20:38.530504Z",
            "url": "https://files.pythonhosted.org/packages/f0/73/ee3018a2cdf547d4b7d9cd811a377b4f3d5cd2887fa5b7da06439c066164/pyciv7-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-21 05:20:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dmanuel64",
    "github_project": "pyciv7",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyciv7"
}
        
Elapsed time: 0.90622s