marshmallow-code /
marshmallow
A lightweight library for converting complex objects to and from simple Python datatypes.
91/100 healthLoading repository data…
sunainapai / repository
Simple, lightweight, and magic-free static site/blog generator for Python coders
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Take full control of your static website/blog generation by writing your own simple, lightweight, and magic-free static site generator in Python. That's right! Reinvent the wheel!
This repository contains the source code of an example website containing two static blogs and a few static pages. The website can be generated by running makesite.py. The output looks like this. That's it!
So go ahead, fork this repository, replace the content with your own, and generate your static website. It's that simple!
You are free to copy, use, and modify this project for your blog or website, so go ahead and fork this repository and make it your own project. Change the layout if you wish to, improve the stylesheet to suit your taste, enhance makesite.py if you need to, and develop your website/blog just the way you want it.
For fun and profit! Okay, maybe not for profit, but hopefully for fun.
Have you used a popular static site generator like Jekyll to generate your blog? I have too. It is simple and great. But then did you yearn to use something even simpler to generate your blog? Do you like Python? Perhaps the thought of writing your own static site generator crossed your mind but you thought it would be too much work? If you answered "yes" to these questions, then this project is for you.
With makesite.py, you are in full control. There is no hidden magic! There is no need to read any documentation to understand how it works. There is no need to learn how to write configuration files to produce some desired effect.
With makesite.py:
Everything is laid out as plain and simple Python code for you to read
and enhance. It is less than 130 lines of code (excluding comments,
docstrings, and blank lines). It gets you off the ground pretty quickly.
You only need to execute makesite.py.
You can develop a decent website/blog within a few minutes and then you can begin tinkering with the source code, the layout, and the stylesheet to customize the look and feel of your website to your satisfaction.
This section provides some quick steps to get you off the ground as quickly as possible.
For a quick demo on your local system, just enter this command:
make serve
If you don't have make but have Python 3.x, enter this command:
python3 makesite.py
cd _site
python3 -m http.server
Note: In some environments, you may need to use python instead of
python3 to invoke Python 3.x.
If you only have Python 2.7, enter this command:
python makesite.py
cd _site
python -m SimpleHTTPServer
Then visit http://localhost:8000/. It should look like this.
Note: You can run makesite.py with Python 2.7 or Python 3.x.
You may see a few Cannot render Markdown warning messages in the
output of the previous command. This is due to the fact that an
example blog in this project has a few posts written
in Markdown. To render them correctly, install the commonmark
package with this command:
pip install commonmark
Then try the previous step again.
For an Internet-facing website, you would be hosting the static website/blog on a hosting service and/or with a web server such as Apache HTTP Server, Nginx, etc. You probably only need to generate the static files and know where the static files are and move them to your hosting location.
If you have the make command, enter this command to generate your
website:
make site
If you don't have make but have python3, enter this command:
python3 makesite.py
Note: In some environments, you may need to use python instead of
python3 to invoke Python 3.x.
If you only have python, enter this command:
python makesite.py
The _site directory contains the entire generated website. The
content of this directory may be copied to your website hosting
location.
Now that you know how to generate the static website that comes with this project, it is time to see what makesite.py does. You probably don't really need to read the entire section. The source code is pretty self-explanatory but just in case, you need a detailed overview of what it does, here are the details:
The main() function is the starting point of website generation.
It calls the other functions necessary to get the website generation
done.
First it creates a fresh new _site directory from scratch. All
files in the static directory are copied to this
directory. Later the static website is generated and written to this
directory.
Then it creates a params dictionary with some default parameters.
This dictionary is passed around to other functions. These other
functions would pick values from this dictionary to populate
placeholders in the layout template files.
Let us take the subtitle parameter for example. It is set
to our example website's fictitious brand name: "Lorem Ipsum". We
want each page to include this brand name as a suffix in the title.
For example, the about page
has "About - Lorem Ipsum" in its title. Now take a look at the
page layout template that is used as the layout
for all pages in the static website. This layout file uses the
{{ subtitle }} syntax to denote that it is a placeholder that
should be populated while rendering the template.
Another interesting thing to note is that a content file can
override these parameters by defining its own parameters in the
content header. For example, take a look at the content file for
the home page. In its content header, i.e.,
the HTML comments at the top with key-value pairs, it defines a new
parameter named title and overrides the subtitle parameter.
We will discuss the syntax for placeholders and content headers later. It is quite simple.
It then loads all the layout templates. There are 6 of them in this project.
layout/page.html: It contains the base
template that applies to all pages. It begins with
<!DOCTYPE html> and <html>, and ends with </html>. The
{{ content }} placeholder in this template is replaced with
the actual content of the page. For example, for the about page,
the {{ content }} placeholder is replaced with the the entire
content from content/about.html. This is
done with the make_pages() calls further down in the code.
: It contains the template for the blog posts. Note that it does not begin with and does not contain the and tags. This is not a complete standalone template. This template defines only a small portion of the blog post pages that are specific to blog posts. It contains the HTML code and the placeholders to display the title, publication date, and author of blog posts.
Selected from shared topics, language and repository description—not editorial ratings.
marshmallow-code /
A lightweight library for converting complex objects to and from simple Python datatypes.
91/100 healthOpen Source Trading Strategies & End-to-End solution connecting Metatrader4 & Metatrader5 💹 with Python with a simple drag and drop EA. Fully tested bug free & efficient solution for live & paper trading⭐ Full Documentation ready. Lightweight, efficient and stable implementation 🔥
79/100 health<!DOCTYPE html><html></html>This template must be combined with the
page layout template to create the final
standalone template. To do so, we replace the {{ content }}
placeholder in the page layout template with
the HTML code in the post layout template to
get a final standalone template. This is done with the
render() calls further down in the code.
The resulting standalone template still has a {{ content }}
placeholder from the post layout template
template. This {{ content }} placeholder is then replaced
with the actual content from the blog posts.
layout/list.html: It contains the template
for the blog listing page, the page that lists all the posts in
a blog in reverse chronological order. This template does not do
much except provide a title at the top and an RSS link at the
bottom. The {{ content }} placeholder is populated with the
list of blog posts in reverse chronological order.
Just like the post layout template , this template must be combined with the page layout template to arrive at the final standalone template.
layout/item.html: It contains the template
for each blog post item in the blog listing page. The
make_list() function renders each blog post item with this
template and inserts them into the
list layout template to create the blog
listing page.
layout/feed.xml: It contains the XML template
for RSS feeds. The {{ content }} placeholder is populated with
the list of feed items.
layout/item.xml: It contains the XML template for
each blog post item to be included in the RSS feed. The
make_list() function renders each blog post item with this
template and inserts them into the
layout/feed.xml template to create the
complete RSS feed.
After loading all the layout templates, it makes a render() call
to combine the post layout template with the
page layout template to form the final
standalone post template.
Similarly, it combines the list layout template template with the page layout template to form the final list template.
Then it makes two make_pages() calls to render the home page and a
couple of other site pages: the contact page
and the about page.
Then it makes two more make_pages() calls to render two blogs: one
that is named simply blog and another that is named
news.
Note that the make_pages() call accepts three positional
arguments:
These three positional arguments are then followed by keyword arguments. These keyword arguments are used as template parameters in the output path template and the layout template to replace the placeholders with their corresponding values.
As described in point 2 above, a content file can override these parameters in its content header.
Then it makes two make_list() calls to render the blog listing
pages for the two blogs. These calls are very similar to the
andy-landy /
Adds variables to python traceback. Simple, lightweight, controllable. Customize formats and colors. Debug reasons of exceptions by logging or pretty printing colorful variable contexts for each frame in a stacktrace, showing every value. Dump locals environments after errors to console, files, and loggers. Works in Jupyter too.
83/100 healthKenanHanke /
A fast, simple and lightweight Bloom filter library for Python, implemented in Rust.
81/100 healthseladb /
PickleDB-rs is a lightweight and simple key-value store. It is a Rust version for Python's PickleDB
81/100 healthbreily /
a lightweight and simple python web framework
54/100 health