Simple and extensible static site generator written in Python.
Features
- simplicity
- extensibility
- live update (changes are visible in browser right after saving the file)
- jinja2 templates
- front matter markdown
Installation
pip install staticpie
Note: At least Python 3.8 version is required.
Create a new website
pie create website mywebsite
Create page
pie create page anotherpage
Edit page
The pages are editable front matter markdown files. That means the pages are divided into two parts:
- metadata part written in YAML
- content part written in Markdown
Both parts are separated by ---.
Serve the website
To edit page open the *.md file in any text file editor and run:
pie serve -c mywebsite/mywebsite.yaml
The command will generate the website in public folder (given in config file), run http server and open the website in browser.
After successfull execution of serve you should see screen similar to below:
Once the file is saved, the browser refreshes the website (or some parts of it).
Deployment
The serve action generates the website for localhost. That means it replaces all the addresses to localhost. The deploy option should be used to generate website with parameters given in yaml config file:
pie deploy
Configuration
The configuration is a YAML file and contains following elements:
PUBLIC_FOLDER- where the website should be deployed (or served)BASE_URL- the website domainPROTOCOL-http://orhttps://includes- list of files that should be copied to public folder (css, js, imgs)extensions- list of extensions (elements) used on website- and other elements (such as extension configs, etc.)
Example configuration:
# deployment folder
PUBLIC_FOLDER: ./public_www
# the URL used for deploy
BASE_URL: www.example.com
# the protocol http:// or https://
PROTOCOL: http://
# Folders/files that should be copied to public folder
includes:
- assets
- styles.css
- styles.rtl.css
# Extensions
extensions:
- menu
- tags
- pagelist
- search
- mostrecent
# Extension config
tags:
tags_ignored:
- movie
tags_map:
art:
label: Article # the `art` tag will be displayed as Article
order: 100
art2:
label: Annother article category
order: 101
Extensions
Most of the parts of this engine is written as extension.
Writing a custom extension is straightforward and can be described in a few steps:
-
Create a python (
*.py) file in theextensionsfolder inside the root webside folder. It can be also a folder with a*.pyfile of the same name. Example:mywebsite +- mywebsite.yaml +- extensions +- myextension.py # 1st way +- anotherext # 2nd way +- __init__.py +- anotherext.py +- ... -
The extension file (i.e.
myextension.py) contains a class that inherits fromExtensionclass. Example:from pie.core.extension import Extension class Myextension(Extension): ...
-
Finally, the
Myextensionclass implements at least one of the following methods:on_generation_start,preprocessing,postprocessing,on_generation_end.
The details can be found in
pie.core.extension.Extensionclass.
Note: This project was created only for my use case and I suggest using some popular widely used frameworks such as Hugo or Jekyll for production.
Metadata
Release files for staticpie 0.5.0
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 |
|---|---|---|---|---|
| staticpie-0.5.0.tar.gz | 394.9 kB | Without provenance | Details for staticpie-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| staticpie-0.5.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for staticpie-0.5.0-py2.py3-none-any.whl |
Total release size: 832.0 kB
Release files / staticpie-0.5.0.tar.gz
| Download URL | staticpie-0.5.0.tar.gz |
|---|---|
| Size | 394.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a49d189736e60b77e45ea6faa1d125ed8e4a71b55bd4211178a9b4deb1ffd102
|
|
BLAKE2b-256 checksum How to use checksums |
43809c9d95d5b001fd6131cd75d0675e494877c40f799c6c1e77fef2a55e38cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.11
|
Release files / staticpie-0.5.0-py2.py3-none-any.whl
| Download URL | staticpie-0.5.0-py2.py3-none-any.whl |
|---|---|
| Size | 437.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
d8400d8d5a9d7415de67928519a01cf9e79f767db3cf3708cfba4d0e0fc355bc
|
|
BLAKE2b-256 checksum How to use checksums |
ca8efcbb75e519106254f1afe20bb7af185edc4d055405fada72824f324d305c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.11
|
Security for staticpie 0.5.0
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.