Skip to main content

Easy Publish

Easy publish is a Python library that provides a simple abstraction for publishing text files as blog posts.

Installation

Requires: Python >= 3.6

python3 -m pip install easy-publish

Usage

To use easy publish import and call the generate_posts function pointing it to the directory your files are located in. The generate_posts function returns an object that has two useful class variables: metadata and posts. metadata is a list of metadata about each of your posts(the "Including Markdown" section explains how to include metadata). posts is a list of post objects that include metadata and post content.

Below is a simple flask app with jinja templating that utilizes easy publish and the metadata/post objects. While this example uses flask/jinja, any web framework/templating engine should work with easy publish.

app.py

from flask import Flask, render_template
from easy_publish import generate_posts

app = Flask(__name__)
posts = generate_posts("~/path/to/blogposts")

@app.route("/blog")
def blog():
  return render_template("blog.html", metadata=posts.metadata)

@app.route("/blog/<p>")
def blogpost(p):
  return render_template("post.html", post=posts.posts[p])

blog.html

{{% for post in metadata %}}
  <li>{{ post.title }}</li>
  <li>{{ post.date }}</li>
  <li>{{ post.tags }}</li>
  <li>{{ post.author }}</li>
{{% endfor %}}

post.html

<h1>{{ post.title }}</h1>
<h4>{{ post.date }}</h1>
<h4>{{ post.author }}</h1>
<p>{{ post.content }}</p>

Including Metadata

Easy publish expects text files to have a section at the top denoting metadata information. The section should be in the following format:

~
title: title would go here
date: date would go here
tags: tags, would, go, here (comma separated)
author: author would go here
~

The parser looks for information in between the ~'s and strips it out into the metadata. It's on the list of TODO's to add different ways to include metadata.

Contributing

Currently in heavy development and not a stable interface. Feel free to contribute ideas as issues or as a pull request.

License

MIT

Metadata

Release files for easy-publish 0.0.12

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

Source distribution (sdist)

Source distribution for easy-publish 0.0.12
File Size Uploaded Provenance Actions
easy-publish-0.0.12.tar.gz 7.1 kB Without provenance Details for easy-publish-0.0.12.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for easy-publish 0.0.12
File Interpreter ABI Platform Actions
easy_publish-0.0.12-py2.py3-none-any.whl Python 3, Python 2 none any Details for easy_publish-0.0.12-py2.py3-none-any.whl

Total release size: 14.5 kB

Release files / easy-publish-0.0.12.tar.gz

Download URL easy-publish-0.0.12.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e3b3ccfb242134285ad433150e479288f4f4dd7caefd1d0e41ff6cab2a8114d5
BLAKE2b-256 checksum
How to use checksums
d202ed7d4dfc29bdcec3e94e5cc3c55cf87f98aa11f7872e8e3472ccc6c30f3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release files / easy_publish-0.0.12-py2.py3-none-any.whl

Download URL easy_publish-0.0.12-py2.py3-none-any.whl
Size 7.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
66f1b8150c2d8156f0f014a6b67776bedc1c200ed519a145d15a70af90654151
BLAKE2b-256 checksum
How to use checksums
1e97f3c17fc13eddfc11908662f4e8ccb7520336897202122ce6c6f57e6dae70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Security for easy-publish 0.0.12

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