Skip to main content

hackerrank-cli

Upload starter files to an existing HackerRank for Work project question using the hackerrank Python SDK. This independent CLI replaces only the project archive, preserving the question’s name, problem statement, environment, scoring settings, and other metadata.

The initial scope is project questions such as fullstack, frontend, and backend projects. Language-specific coding-question stubs are outside this CLI’s initial scope.

Requires Python 3.13 or later. Install from PyPI:

uv tool install hackerrank-cli
hackerrank --help

Or install the checkout for development:

uv sync --locked
uv run hackerrank --help
uv run python -m hackerrank_cli --version

pip install hackerrank-cli is also supported.

Usage

Use synthetic question ID 123456 below in place of your own question ID. Exactly one content source is required:

hackerrank questions upload 123456 --directory ./starter --dry-run
hackerrank questions upload 123456 --directory ./starter --exclude '*.zip'
hackerrank questions upload 123456 --file ./starter.py

Real uploads read HACKERRANK_API_TOKEN from the environment. Get a key from the HackerRank for Work API tokens page. Missing, empty, and whitespace-only keys fail clearly. Dry runs need no key and make no network requests.

Exactly one of --directory or --file is required. Both replace the entire project archive. --file creates a one-file project using the source’s basename; it does not update a language-specific code stub or upload a prebuilt ZIP as the project archive.

All file bytes are preserved exactly, including binary files, CRLF, blank lines, trailing whitespace, UTF-8 BOMs, and documentation markers. Empty single files are valid. Neither paths nor IDs are inferred from repository configuration. Inputs are fully read, staged, and archived before credentials are read or a mutation is issued. POSIX executable bits are preserved. Errors exit nonzero. API response bodies and credentials are never printed. The default retry count is zero, matching the released SDK. Set --retries 3 to delegate retries and backoff to the SDK for this repeatable upload. The CLI adds no separate retry loop. Each attempt uses the same prepared archive bytes.

Offline archives

Export the same project ZIP locally without a question ID, credentials, or network access:

hackerrank questions archive --directory ./starter --exclude '*.zip' --output ./starter.zip
hackerrank questions archive --file ./starter.py --output - > ./starter.zip

--output is required. A file destination must not already exist; - writes only ZIP bytes to standard output. Shell redirection controls whether its destination is overwritten. Source validation and packaging finish before the output is opened. The source options, ignore rules, file contents, and executable permissions match questions upload. Consumers can extract this archive for local checks, then send its bytes with the SDK’s questions.upload_project_zip method.

Directory selection

  • Both Git and non-Git directories work. Paths are relative to the current working directory. A Git worktree’s .git file also identifies its root.

  • In a Git repository, rules are inherited from the nearest Git root down to the upload directory. Outside Git, rules start at the upload directory; unrelated parent .gitignore files are not used.

  • Each traversed directory adds its own .gitignore rules. Later matching rules override earlier ones, and deeper files override ancestor rules. Patterns are relative to their owning directory. Directory-only rules and negations follow Gitignore semantics. Excluded directories are pruned, so a child cannot re-include itself unless its parent is re-included first. This also applies to ancestors of an explicitly selected nested upload root.

  • Ignore rules apply to tracked files too. Global Git excludes and .git/info/exclude are not read. Hidden files, including .gitignore, are uploaded unless excluded.

  • .git files and directories are always excluded at every depth. Explicit source paths inside Git metadata are rejected, including an upload rooted at a .git directory. Repeatable --exclude PATTERN options form a final Gitignore rule layer, relative to the upload root. This layer can exclude files re-included by .gitignore; its own later negations can undo its earlier patterns. It cannot re-include a file excluded by .gitignore or Git metadata.

  • ZIP files are included by default. Use --exclude '*.zip' to omit them. Add other exclusions explicitly, such as --exclude node_modules/.

  • Selected symlinks (including directory, broken, and external links) and symlinks in the source path are rejected rather than dereferenced. Ignored links are skipped. Symlinked .gitignore files are rejected when their rules would be read. Special files are rejected. Empty selections fail. Selected files are copied to a temporary directory without dereferencing links. The CLI packages these prepared files with Python’s standard ZIP library. The released SDK handles multipart serialization, authentication, network requests, response decoding, and retries.

Development and distribution

Development checks, release setup, and build instructions for Docker, Nix, and standalone binaries are in docs/source/development.rst. The generated CLI reference is in docs/source/cli.rst. There are no prebuilt artifacts yet.

See docs/source/migration.rst for migrating an existing shell uploader and keeping repository-specific snippet preparation outside this CLI.

Project AI system prompts

Set an existing project question’s AI assistant prompt from a UTF-8 file:

$ hackerrank questions set-system-prompt 123456 --prompt-file prompt.txt

Use --dry-run to validate without credentials or network access. Prompts may contain up to 15,000 characters. Text is sent exactly as read, including whitespace and line endings. An empty file explicitly clears the prompt. The command reads the question first to preserve its other metadata.

Metadata

Release files for hackerrank-cli 2026.10.30

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

Source distribution (sdist)

Source distribution for hackerrank-cli 2026.10.30
File Size Uploaded Provenance Actions
hackerrank_cli-2026.10.30.tar.gz 177.5 kB With provenance Details for hackerrank_cli-2026.10.30.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hackerrank-cli 2026.10.30
File Interpreter ABI Platform Actions
hackerrank_cli-2026.10.30-py3-none-any.whl Python 3 none any Details for hackerrank_cli-2026.10.30-py3-none-any.whl

Total release size: 189.2 kB

Release files / hackerrank_cli-2026.10.30.tar.gz

Download URL hackerrank_cli-2026.10.30.tar.gz
Size 177.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f215285a907e6e17447b96c56bbaeb1affffb4b14a207e7fa8d59ad18d3fc795
BLAKE2b-256 checksum
How to use checksums
c5ec4c126b4442f51b77c9a41c9d42ed5736a8de2fc502cbf66dd4d21c5cda0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 30, 2026.

Transparency log

Release files / hackerrank_cli-2026.10.30-py3-none-any.whl

Download URL hackerrank_cli-2026.10.30-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
abc21b85b9d87a8de944430183baa5b1fec1e28aee20e2f404ced7aa712582b5
BLAKE2b-256 checksum
How to use checksums
b8cdbfa6aa7ccb885cb2c864fa0afb3cd644346cad84ca7c7b59e9074ca4a193
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 30, 2026.

Transparency log

Security for hackerrank-cli 2026.10.30

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hackerrank_cli-2026.10.30.tar.gz

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 Oct 30, 2026.

Transparency log

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