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
hackerrank --version

You can also install with pip install hackerrank-cli.

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.

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. Prebuilt binaries are available from GitHub Releases.

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

Metadata

Release files for hackerrank-cli 2026.10.1.1

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.1.1
File Size Uploaded
hackerrank_cli-2026.10.1.1.tar.gz 159.9 kB Details

Built distribution (wheel)

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

Total release size: 170.0 kB

Release files / hackerrank_cli-2026.10.1.1.tar.gz

Download URL hackerrank_cli-2026.10.1.1.tar.gz
Size 159.9 kB
Tags Source
SHA-256 checksum
How to use checksums
234e3e2c78c36bb1ac2ea8cfcb7288d6c7911fe907ae0c2c4ebdb6fca52d26de
BLAKE2b-256 checksum
How to use checksums
55cef54f4cebf89c74175cbb8fecaf306f552309eb5cec785e5ba5299dbe8871
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 1, 2026.

Transparency log

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

Download URL hackerrank_cli-2026.10.1.1-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64c7e595ba4999a4043ee6cbe0300931db9af6e66b1f4fa01424e82701c322e3
BLAKE2b-256 checksum
How to use checksums
22eda9cd1fb3eebca467c52e234cbc17a2bea9dca2f01c88bd0fd6ecdf39d7bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2026.10.1.1 This release

2 release files

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