Overview
Ghps is a minimal, zero-dependency 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 |
Installation
Source Code
- Download Version 0.7 or Latest Source
pip install .
PyPI
- Check Python Packaging User Guide
pip install ghps==0.7
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 |
|---|---|---|
--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 |
Library
from ghps import GHPageServer
server = GHPageServer(
directory="dist",
host="localhost",
port=5000,
base_path="/repo-name",
strict=True,
no_cache=False,
threaded=True,
auto_open=True,
)
server.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 |
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
1KtNLEEeUbTEK9PdN6Ya3ZAKXaqoKUuxCyEthereum
0xcD4Db18B6664A9662123D4307B074aE968535388Litecoin
Ldnz5gMcEeV8BAdsyf8FstWDC6uyYR6pgZDoge
DDUnKpFQbBqLpFVZ9DfuVysBdr249HxVDhTron
TCZxzPZLcJHr2qR3uPUB1tXB6L3FDSSAx7Ripple
rN7ZuRG7HDGHR5nof8nu5LrsbmSB61V1qqBinance Coin
bnb1zglwcf0ac3d0s2f6ck5kgwvcru4tlctt4p5qefTether
0xcD4Db18B6664A9662123D4307B074aE968535388Dash
Xd3Yn2qZJ7VE8nbKw2fS98aLxR5M6WUU3sStellar
GALPOLPISRHIYHLQER2TLJRGUSZH52RYDK6C3HIU4PSMNAV65Q36EGNLZilliqa
zil1knmz8zj88cf0exr2ry7nav9elehxfcgqu3c5e5Coffeete
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.7 - 2026-09-22
Added
hostparameter--hostCLI argument
Changed
- Test system modified
README.mdupdated
0.6 - 2026-08-31
Added
- Custom default error page
Changed
- Server header modified
0.5 - 2026-08-02
Added
directory_listingparameter--directory-listingCLI argument
Changed
- 404 page headers modified
- Port validation bug fixed
GHPageServerclassstartmethod modified- Error messages updated
- Dependencies structure modified
- Test system modified
README.mdupdated
0.4 - 2026-05-08
Added
GHPSErrorclassGHPSValidationErrorclassGHPSRuntimeErrorclass- Port error messages
Changed
- Test system modified
0.3 - 2026-04-05
Added
auto_openparameter--auto-openCLI argument- Random port support
Changed
- Test system modified
- CLI error messages updated
README.mdupdated
0.2 - 2026-03-19
Added
- Logo
- Input validation
Changed
- Test system modified
README.mdupdated
0.1 - 2026-02-27
Added
GHPageServerclass- Command line interface
- Test system
Metadata
Release files for ghps 0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ghps-0.7.tar.gz | 18.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ghps-0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.5 kB
Release files / ghps-0.7.tar.gz
| Download URL | ghps-0.7.tar.gz |
|---|---|
| Size | 18.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6896a73a6ab9329bdd96e42378475960a4883f5a8023d0f340714fdb824eb6d9
|
|
BLAKE2b-256 checksum How to use checksums |
dcb56ffa43019e29a0209780b9c5d68214691d597462a19272f87cc74c60f6f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / ghps-0.7-py3-none-any.whl
| Download URL | ghps-0.7-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9a025ba4cdf898042781cb71e8026843c223504ca27f14d670bcd6c3e24e22f
|
|
BLAKE2b-256 checksum How to use checksums |
e5b43b132f3cf846ab4c73354cddfb7081863e2b5232ec33846aba4221f809e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|