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.
Native project configuration
Both questions archive and questions upload accept --configuration-file ./native.yml. The file must contain a UTF-8 native HackerRank document with version: 1.0 and a configuration mapping. Its bytes replace the root hackerrank.yml entry or add it if absent. Other files and their executable permissions are preserved. Dry runs validate the configuration and include hackerrank.yml in the file listing without credentials or network requests.
Python callers can render explicit values and configure a prepared ZIP:
"""Add native configuration to a prepared project archive."""
from pathlib import Path
from hackerrank_cli.projects import (
ProjectConfiguration,
configure_project_archive,
)
configuration = ProjectConfiguration(
has_webserver=False,
readonly_paths=[],
scoring_command="python3 -m pytest",
scoring_files=[],
default_open_files=["solution.py"],
project_menu={
"install": "python3 -m pip install -r requirements.txt",
"run": "python3 solution.py",
"test": "python3 -m pytest",
},
)
configured_zip = configure_project_archive(
archive=Path("starter.zip").read_bytes(),
configuration=configuration.to_yaml(),
)
All configuration values are required in the typed helper. Callers choose their own commands, defaults, and file-selection rules. Existing native files may include additional configuration keys. Invalid YAML, invalid ZIPs, and duplicate archive names fail before writing.
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 uses the SDK metadata helper to preserve other question fields. A missing problem statement or duration fails before the update.
Complete API access
The api command group exposes all 76 documented v3, ATS and SCIM operations. Use hackerrank api operations to list names and api describe OPERATION to inspect parameters and body schemas.
hackerrank api call api_list_all_tests --query '{"limit": 10}'
hackerrank api call api_update_interviewer_note --path '{"interview_id": "123"}' --body-file note.json --dry-run
--path and --query accept JSON objects. --body-file reads a JSON object from a UTF-8 file, or stdin when set to -. Real v3 requests use HACKERRANK_API_TOKEN. SCIM requests use their own HACKERRANK_SCIM_API_TOKEN and provisioning host. Dry runs validate requests before reading credentials and make no API calls. Responses include status, headers and complete JSON data, including empty and pending responses.
The complete API commands require hackerrank>=2026.11.7.
Metadata
Release files for hackerrank-cli 2026.11.10.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hackerrank_cli-2026.11.10.1.tar.gz | 186.3 kB | With provenance | Details for hackerrank_cli-2026.11.10.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hackerrank_cli-2026.11.10.1-py3-none-any.whl | Python 3 | none | any | Details for hackerrank_cli-2026.11.10.1-py3-none-any.whl |
Total release size: 202.8 kB
Release files / hackerrank_cli-2026.11.10.1.tar.gz
| Download URL | hackerrank_cli-2026.11.10.1.tar.gz |
|---|---|
| Size | 186.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42ba3949bf74b0fb64a12802d550cfa7e380c6e602bc5fe8324dc10e73c2a750
|
|
BLAKE2b-256 checksum How to use checksums |
0b864598639267a9746d4d3ad816208af16453c9f0bc1de37a0f634504ba765d
|
| 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 Nov 10, 2026.
Transparency logRelease files / hackerrank_cli-2026.11.10.1-py3-none-any.whl
| Download URL | hackerrank_cli-2026.11.10.1-py3-none-any.whl |
|---|---|
| Size | 16.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e0d81e47c69ef007c73c72f14ee8cf7527b74ff6779937c393b3f087aa63676f
|
|
BLAKE2b-256 checksum How to use checksums |
a8e6bdd9e9d2fe29e7b6c086a330502592ab01f83e9fc80e78cd396f5890cd2c
|
| 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 Nov 10, 2026.
Transparency logSecurity for hackerrank-cli 2026.11.10.1
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.
Attestation for hackerrank_cli-2026.11.10.1.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 Nov 10, 2026.
Transparency logA 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.