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.4

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.4
File Size Uploaded Provenance Actions
code_battles_cli-1.2.4.tar.gz 7.4 kB Without provenance Details for code_battles_cli-1.2.4.tar.gz

Built distribution (wheel)

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

Total release size: 18.3 kB

Release files / code_battles_cli-1.2.4.tar.gz

Download URL code_battles_cli-1.2.4.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c8f445a84efe36d7f457010c5cf9a9708087aadd5184fa722cdff7583cc4138b
BLAKE2b-256 checksum
How to use checksums
e2088c75576dfaa11724c61b9cc01a5abe97fbebfbab79fe7b0cfb41decc9590
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.4-py3-none-any.whl

Download URL code_battles_cli-1.2.4-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b3d8c7c08ce45ed0d4a4e1e86376fefad6e816930fd0bdc76c5af5c10326d20
BLAKE2b-256 checksum
How to use checksums
a01c60a984f7706d112e03b1828daaa55997bf2cacc0df55dc9a4df358215cc7
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.4

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