Skip to main content

Code Battles CLI

A CLI for competitors in any Code Battles event!

🏃 Getting Started  ·  💡 Features

Getting Started

  • Install the library by running pip install code-battles-cli.
  • Make sure you have the Python scripts folder in your PATH by running code-battles --help.
  • If that fails, run py -m code_battles_cli --help.

The first time you run any command you will be asked for your URL, username and password, and they'll be saved in a code-battles.json file for successive calls.

Features

Downloading the bots

You can download all of the bots your team has by running code-battles download.

Uploading a bot

You can update a bot in the website by running code-battles upload bots/example.py (in this case the bot's name will be example).

If you want to choose a custom bot name, you can run code-battles upload bots/example.py -n myamazingbot.

Running a simulation

You can run a simulation by running code-battles run '{"map": "NYC"}' bots/example.py bots/another_example.py, where NYC is an example of a map.

You will probably find the scripting API nicer to work with if you want to run simulations locally.

Usage in scripts

You can import the code_battles_cli.api module and utilize its Client class to hack Code Battles for your needs!

Example:

from code_battles_cli.api import Client

client = Client()

print(client.get_bots())
print(client.run_simulation("NYC", ["bots/example.py", "bots/another_example.py"]))

Development

For development, you should set up the pre-commit hooks with uv run pre-commit install.

Metadata

Release files for code-battles-cli 1.2.7

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

Source distribution (sdist)

Source distribution for code-battles-cli 1.2.7
File Size Uploaded Provenance Actions
code_battles_cli-1.2.7.tar.gz 7.4 kB Without provenance Details for code_battles_cli-1.2.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for code-battles-cli 1.2.7
File Interpreter ABI Platform Actions
code_battles_cli-1.2.7-py3-none-any.whl Python 3 none any Details for code_battles_cli-1.2.7-py3-none-any.whl

Total release size: 18.5 kB

Release files / code_battles_cli-1.2.7.tar.gz

Download URL code_battles_cli-1.2.7.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
19bd09a3300b0c56420ccb113f4d06800d9bc4070e6c6bde17c14fde13c9134c
BLAKE2b-256 checksum
How to use checksums
1eb42476de0dfb8b2c84d2eeff8bda1981dbd5ceced4e56b72bd97f1767b51cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / code_battles_cli-1.2.7-py3-none-any.whl

Download URL code_battles_cli-1.2.7-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a203db76f8de347bf4d7a05ccf0f708066d9233dd5a58091eda07b165fd3e05
BLAKE2b-256 checksum
How to use checksums
a06cada326cb7f4fd4da3f8d758459101cb215c0f47f10a49415c95b38497e5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for code-battles-cli 1.2.7

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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