Skip to content

Instantly share code, notes, and snippets.

@rochacbruno
rochacbruno / markdocs_idea.md
Last active February 2, 2021 18:22
Using markdocs to Python documentation (markdown) - Idea - WIP

UNDER DEVELOPMENT HERE: https://github.com/rochacbruno/markdocs


Python documentation

I still think that the problem of lack of good documentation in the Python ecosystem is also related to .rst format and the use of complicated tools like Sphinx.

I'm enjoying writing functional documentation using Markdown in Rustlang, so I'll do experiments to have the same functionality in Python. Take a look at rustdoc and here an example of documentation site generated for a Rust crate using markdown comments.

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@justanr
justanr / _core.py
Last active December 14, 2023 02:47
Clean Architecture In Python
from abc import ABC, ABCMeta, abstractmethod
from collections import namedtuple
from itertools import count
PayloadFactory = namedtuple('PayloadFactory', [
'good', 'created', 'queued', 'unchanged', 'requires_auth',
'permission_denied', 'not_found', 'invalid', 'error'
])
"""
from sre_parse import Pattern, SubPattern, parse as sre_parse
from sre_compile import compile as sre_compile
from sre_constants import BRANCH, SUBPATTERN
class Scanner(object):
def __init__(self, tokens, flags=0):
subpatterns = []
pat = Pattern()
@senko
senko / maybe.py
Last active May 2, 2024 18:35
A Pythonic implementation of the Maybe monad
# maybe.py - a Pythonic implementation of the Maybe monad
# Copyright (C) 2014. Senko Rasic <senko.rasic@goodcode.io>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@mtayseer
mtayseer / watch_n_serve.py
Last active August 29, 2015 13:57
Launch a webserver to view generated output & at the same time watch the content for changes & rebuild it.
# [Pelican](http://docs.getpelican.com/) is a static site generator. I'm using it for building [my own website](http://mtayseer.net/).
# To make the editing experience easier, I created this script to launch a webserver to view generated output & at the same time watch
# the content for changes & rebuild it.
#
# I'm using [Bottle](http://bottlepy.org/) for the webserver & [watchdog](https://pythonhosted.org/watchdog/) to watch directory
#
from bottle import route, run, static_file
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
@mrinaudo
mrinaudo / LICENSE
Last active October 27, 2021 18:37
Basic Template Builder for AWS VPC - Interactively generate basic AWS CloudFormation-based AWS VPC templates.
The MIT License (MIT)
Copyright (c) 2014 Matteo Rinaudo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@fujin
fujin / gist:6094233
Last active December 20, 2015 07:38
thoughtworks go-server / go-agent powered with @dot_cloud Docker
ubuntu@continubus:~/dockerfiles/go-agent$ docker ps
ID IMAGE COMMAND CREATED STATUS PORTS
d89f44c4df5b fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
a132f54a0442 fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
da8b513fbb2a fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
c100df11f9d7 fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
929adf4cbc3b fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
79720ed86e0b fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
ca9403fe93e2 fujin/go-agent:latest /b
@patricklx
patricklx / jsonalchemy.py
Last active December 17, 2015 05:59 — forked from dbarnett/jsonalchemy.py
adds suport for nested dicts and lists
import simplejson
import sqlalchemy
from sqlalchemy import String
from sqlalchemy.ext.mutable import Mutable
class JSONEncodedObj(sqlalchemy.types.TypeDecorator):
"""Represents an immutable structure as a json-encoded string."""
impl = String