Skip to main content

Build Status PyPI

sphinx-hackerrank

Export Sphinx documentation as self-contained HTML for HackerRank Interviewer Guidelines, with styles and images. Build and preview locally without HackerRank credentials.

Quick start

In an existing Sphinx project:

pip install sphinx-hackerrank

Add "sphinx_hackerrank" to extensions in docs/conf.py. Create docs/review.rst and add review to your existing toctree:

Widget review
=============

.. hackerrank-export:: interviewer-guidelines/review.html
   :name: Widget review

   Interviewer instructions go here.

   .. code-block:: text

      example input

Build:

sphinx-build -W -b hackerrank docs build/hackerrank

Open build/hackerrank/interviewer-guidelines/index.html to preview the exports. Upload build/hackerrank/interviewer-guidelines/review.html using your own publishing tool.

Code blocks are exported as <pre><code> with their original text and whitespace. HackerRank’s project IDE adds native copy controls to these blocks in its Guidelines tab. Hover over a code block to reveal its Copy button. Check copying inside a project interview. The standalone preview displays the exported HTML without the IDE’s controls.

Choosing content

Wrap content in hackerrank-export and give it an HTML output path relative to the build directory. The required :name: option supplies the preview index label. Each boundary is a Sphinx node carrying its destination and name. No CSS selector or export list is needed. Multiple boundaries in the same document export independently. Destinations must be unique and must not overwrite documentation pages or the preview index. The hackerrank builder writes only the standalone exports and their preview index. Run the ordinary html builder separately for themed documentation pages. When upgrading, clean an existing HackerRank output directory once to remove pages generated by earlier versions.

Python extensions can construct the same boundary directly:

"""Declare an export around prepared Docutils content."""

from docutils import nodes

from sphinx_hackerrank import GuidelineExportNode

content = GuidelineExportNode(
    output_path="interviewer-guidelines/review.html",
    name="Widget review",
)
content += nodes.paragraph("", "Interviewer instructions go here.")
assert content.astext() == "Interviewer instructions go here."

The builder renders each marked subtree from Sphinx’s resolved doctree using its standard HTML translator. It preserves document context for headings, references, figure numbering, and images without rendering the rest of the page or loading a theme. Export metadata is retained across incremental and parallel builds. Other builders receive ordinary containers, preserving their native rendering without additional node handlers.

For collapsible sections, enable sphinx-toolbox.collapse. To reuse guide sections, enable sphinx-section-include. See the sample project for both.

Migrating from selector exports

Replace each GuidelineExport configuration entry with a hackerrank-export directive or GuidelineExportNode around the content being exported. Move output_path and name to that boundary, then remove hackerrank_exports and the old GuidelineExport import. A separate docname and selector are no longer needed. CSS classes remain presentation details.

Contributing

See CONTRIBUTING.rst for checks and releases. MIT licensed.

Complete API publishing

Requires Python 3.13 or later. The explicit hackerrank-publish builder exports guidelines and then executes hackerrank_api_operations in order using the HackerRank SDK. Ordinary html and hackerrank builds remain offline. Every documented v3, ATS and SCIM operation is available. An empty publishing plan exports the operation catalogue without credentials.

Configure a plan in conf.py:

"""Configure explicit API publishing."""

hackerrank_api_operations = [
    {
        "operation": "api_update_question",
        "path_parameters": {"question_id": "123456"},
        "body": {
            "name": "Widget review",
            "problem_statement": "Review the implementation.",
            "type": "code",
        },
        "body_files": {"internal_notes": "interviewer-guidelines/review.html"},
    },
]

Run sphinx-build -W -b hackerrank-publish docs build/hackerrank. body_files reads UTF-8 exports from inside the build directory and inserts that exact text into the request body. All operations and files are validated before any request is sent. Question writes use the SDK’s shared validation for AI prompts, including prompts read from exported files. A known unsupported question type or an overlong prompt prevents the entire plan from publishing. Use HACKERRANK_API_TOKEN for v3 operations and a separate HACKERRANK_SCIM_API_TOKEN for SCIM provisioning. The builder writes hackerrank-api-results.json and hackerrank-api-catalogue.json with complete responses and request schemas.

The publishing builder requires hackerrank>=2026.11.10.

Metadata

Release files for sphinx-hackerrank 2026.11.10

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

Source distribution (sdist)

Source distribution for sphinx-hackerrank 2026.11.10
File Size Uploaded Provenance Actions
sphinx_hackerrank-2026.11.10.tar.gz 171.7 kB With provenance Details for sphinx_hackerrank-2026.11.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sphinx-hackerrank 2026.11.10
File Interpreter ABI Platform Actions
sphinx_hackerrank-2026.11.10-py3-none-any.whl Python 3 none any Details for sphinx_hackerrank-2026.11.10-py3-none-any.whl

Total release size: 189.0 kB

Release files / sphinx_hackerrank-2026.11.10.tar.gz

Download URL sphinx_hackerrank-2026.11.10.tar.gz
Size 171.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5aec63a5caa608d28807b552672fe34a87597bc2d43415c36e26360aadd752e2
BLAKE2b-256 checksum
How to use checksums
c3be859acbc6d1ec4baabbf0c0ab3e39a9cc5eabafbc2273eb4de50264e2ed61
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 log

Release files / sphinx_hackerrank-2026.11.10-py3-none-any.whl

Download URL sphinx_hackerrank-2026.11.10-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a65375ea3f7c0ed27c31f82fb746accb484d5e405def8abc30a3045896cd952
BLAKE2b-256 checksum
How to use checksums
e98c923c01d4cb4104d0535f2ebe1ddd89efa359862243957dbdfbe6f7e0404d
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 log

Security for sphinx-hackerrank 2026.11.10

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 sphinx_hackerrank-2026.11.10.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 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