Skip to main content

markmodule

Import python from markdown files.

Usage

In a file named hello_module.md define a function. I'm escaping the fence, use a real three-tick fence.

Here is a function

``(`)python
def hello() -> str:
    return "Hello"
``(`) 

Generate a type stub and import using the usual syntax. generate_side_by_side_pyi will write a .pyi file to the file system and enable IDEs type hinting to work.

import sys
import markmodule
markmodule.generate_side_by_side_pyi("hello_module")
sys.meta_path.append(markmodule.MdFinder())
import hello_module
print(hello_module.hello())

Import with path to file.

import markmodule
markmodule.import_md("hello_module.md")
import hello_module
print(hello_module.hello())

Markdown is a hammer, everything is a nail

You can use markdown:

  • as a place to put module code, markmodule, this library

The do-everything-with-markdown ecosystem is surprisingly robust.

Change Log

  • 0.1.0 - Basic idea.
  • 0.2.0 - Updates to readme
  • 0.3.0 - Generates pyi and you can use import syntax

Documentation

Metadata

Release files for markmodule 0.3.0

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

Source distribution (sdist)

Source distribution for markmodule 0.3.0
File Size Uploaded
markmodule-0.3.0.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for markmodule 0.3.0
File Interpreter ABI Platform
markmodule-0.3.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 13.7 kB

Release files / markmodule-0.3.0.tar.gz

Download URL markmodule-0.3.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d561cf2dc9ccd013ae85ba9a0dcec9bcd83a8e76b20e8edddafbc55bd3f7c191
BLAKE2b-256 checksum
How to use checksums
4579eb2b7e81820f62d4b67832570f6ea0ca8cfa59c82b8682ec355cd964703d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / markmodule-0.3.0-py2.py3-none-any.whl

Download URL markmodule-0.3.0-py2.py3-none-any.whl
Size 7.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ffcbf37e86b39530842a341eda14e9fecce99ec4afd19cf0d10a66bf04e7ad15
BLAKE2b-256 checksum
How to use checksums
c6ef227d75d674a999550cfcf7b502567d88095f906aee8f8668c63b742d0459
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.1 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

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