Skip to main content

Ghps: A Minimal GitHub Pages Simulator for Local Development


built with Python3 GitHub repo size PyPI version

Overview

Ghps is a minimal GitHub Pages simulator written in pure Python for local development and testing. It accurately replicates GitHub Pages' static hosting behavior, including proper 404.html handling, project base path simulation, strict routing mode, and optional cache control - all while remaining lightweight, fast, and usable both as a CLI tool and as an importable Python library.

PyPI Counter
Github Stars
Branch main dev
CI
Code Quality CodeFactor

Installation

Source Code

PyPI

Usage

Ghps can be used both as a CLI tool and as a Python library.

CLI

ghps --host=127.0.0.1 --port=8080 --no-cache --no-threaded

Options

Option Description Default
-c, --config Path to configuration file Auto discovers .ghps
--host Host address to bind to localhost
-p, --port Port to serve on 8000
-d, --directory Directory to serve Current directory (.)
-b, --base-path Base path for project pages (e.g. /repo-name) ""
--no-strict Enable .html fallback Strict mode enabled
--no-cache Disable HTTP caching headers Cache enabled
--no-threaded Disable threaded server Threaded enabled
--auto-open Automatically open the server URL Disable
--directory-listing Enable directory listing Disable
--quiet Suppress informational server output Disable

Library

from ghps import GHPageServer

server1 = GHPageServer(
    directory="dist",
    host="localhost",
    port=5000,
    base_path="/repo-name",
    strict=True,
    no_cache=False,
    threaded=True,
    auto_open=True,
    quiet=False,
)

server1.start()

server2 = GHPageServer.from_config(config="config.toml")

server2.start()

Parameters

Parameter Type Description Default
directory str Directory to serve "."
host str Host address to bind the server to "localhost"
port int Port number 8000
base_path str Base path for project page simulation ""
strict bool Enforce GitHub-like routing behavior True
no_cache bool Disable cache headers False
threaded bool Enable threaded request handling True
auto_open bool Automatically open the server URL False
directory_listing bool Enable directory listing False
quiet bool Suppress informational server output False

Configuration File

You can define your server settings in a TOML configuration file (typically named .ghps):

directory = "dist"
host = "localhost"
port = 8080
base_path = "/repo-name"
strict = true
no_cache = false
threaded = true
auto_open = false
directory_listing = false
quiet = false

Issues & Bug Reports

Just fill an issue and describe it. We'll check it ASAP!

  • Please complete the issue template

Show Your Support

Star This Repo

Give a ⭐️ if this project helped you!

Donate to Our Project

Bitcoin

1KtNLEEeUbTEK9PdN6Ya3ZAKXaqoKUuxCy

Ethereum

0xcD4Db18B6664A9662123D4307B074aE968535388

Litecoin

Ldnz5gMcEeV8BAdsyf8FstWDC6uyYR6pgZ

Doge

DDUnKpFQbBqLpFVZ9DfuVysBdr249HxVDh

Tron

TCZxzPZLcJHr2qR3uPUB1tXB6L3FDSSAx7

Ripple

rN7ZuRG7HDGHR5nof8nu5LrsbmSB61V1qq

Binance Coin

bnb1zglwcf0ac3d0s2f6ck5kgwvcru4tlctt4p5qef

Tether

0xcD4Db18B6664A9662123D4307B074aE968535388

Dash

Xd3Yn2qZJ7VE8nbKw2fS98aLxR5M6WUU3s

Stellar

GALPOLPISRHIYHLQER2TLJRGUSZH52RYDK6C3HIU4PSMNAV65Q36EGNL

Zilliqa

zil1knmz8zj88cf0exr2ry7nav9elehxfcgqu3c5e5

Coffeete

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Unreleased

0.8 - 2026-11-08

Added

  • quiet parameter
  • --quiet CLI argument
  • --config CLI argument
  • from_config method

Changed

  • Test system modified
  • Build system modified
  • Python 3.15 added to test.yml
  • README.md updated

0.7 - 2026-09-22

Added

  • host parameter
  • --host CLI argument

Changed

  • Test system modified
  • README.md updated

0.6 - 2026-08-31

Added

  • Custom default error page

Changed

  • Server header modified

0.5 - 2026-08-02

Added

  • directory_listing parameter
  • --directory-listing CLI argument

Changed

  • 404 page headers modified
  • Port validation bug fixed
  • GHPageServer class start method modified
  • Error messages updated
  • Dependencies structure modified
  • Test system modified
  • README.md updated

0.4 - 2026-05-08

Added

  • GHPSError class
  • GHPSValidationError class
  • GHPSRuntimeError class
  • Port error messages

Changed

  • Test system modified

0.3 - 2026-04-05

Added

  • auto_open parameter
  • --auto-open CLI argument
  • Random port support

Changed

  • Test system modified
  • CLI error messages updated
  • README.md updated

0.2 - 2026-03-19

Added

  • Logo
  • Input validation

Changed

  • Test system modified
  • README.md updated

0.1 - 2026-02-27

Added

  • GHPageServer class
  • Command line interface
  • Test system

Metadata

Release files for ghps 0.8

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

Source distribution (sdist)

Source distribution for ghps 0.8
File Size Uploaded Provenance Actions
ghps-0.8.tar.gz 20.7 kB Without provenance Details for ghps-0.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ghps 0.8
File Interpreter ABI Platform Actions
ghps-0.8-py3-none-any.whl Python 3 none any Details for ghps-0.8-py3-none-any.whl

Total release size: 34.6 kB

Release files / ghps-0.8.tar.gz

Download URL ghps-0.8.tar.gz
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
729f8680a37beffb79b3e109b88b45024e7a8ece86fb2319abcaead50866a008
BLAKE2b-256 checksum
How to use checksums
69607b1858296d89e85f24d03799b6ee9a0b0c1ad474174c6b50c5a97837f193
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / ghps-0.8-py3-none-any.whl

Download URL ghps-0.8-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ba229b7d3076deb8437f28a9cdc28db9163f2cda40b932dcac359a64b4a6839
BLAKE2b-256 checksum
How to use checksums
b50e6860f501c241c8b33c17ab3e34b80ec1b5f8f48a36f2505f90a8d07d5523
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for ghps 0.8

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