mdsrc
Markdown を Python ソースとして扱うツール。拡張子は *.py.md。
mdsrc run tutorials/hello.py.md # python hello.py 相当
mdsrc run -m pkg # python -m pkg 相当
mdsrc run tutorials/app/ # python dir/ 相当(__main__.py を実行)
mdsrc build [path] # 生成のみ(実行しない)
変換ルール
- バッククォートのフェンス付きコードブロック(
```)だけがソースになる。 Python プロファイルでは~~~はフェンス扱いせず散文とする。 - 言語タグが空・
python・pyのブロックを Python として取り込む。 それ以外(bash,json…)は無視。 - 入力拡張子・出力拡張子・ランナー・フェンス文字・言語タグは言語ごとの
「プロファイル」に集約される。スキーマは
mdsrc/languages/base.py、各言語はmdsrc/languages/<lang>/(現状python/のPYTHON)に置き、他言語 (例:*.sh.md用のshell/)を追加できる。 - インラインコード(
`x`)は取り込まない。 - 散文・フェンス行・非 Python ブロックは空行に置換され、生成
.pyの 行番号が.py.mdと 1:1 で一致する(traceback が Markdown の行を指す)。
仕組み
foo.py.md → 同じ場所に foo.py を生成。実行前にツリー内の全 *.py.md を
ビルドするため、Markdown モジュール同士の import も解決される。生成された
.py はビルド成果物なので .gitignore 済み。
チュートリアル
uv run mdsrc run tutorials/app/
uv run mdsrc run tutorials/hello.py.md
Metadata
Release files for mdsrc 0.1.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 | |
|---|---|---|---|
| mdsrc-0.1.0.tar.gz | 17.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mdsrc-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.3 kB
Release files / mdsrc-0.1.0.tar.gz
| Download URL | mdsrc-0.1.0.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57e4b92e561bec76822bce0f846a144b8b3906a36b02cb3beba77e8ac5c85dad
|
|
BLAKE2b-256 checksum How to use checksums |
bd5d181c66769790d9440df8828b532a7848785c0a1b07aad13698a53e3cd0d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 30, 2026.
Transparency logRelease files / mdsrc-0.1.0-py3-none-any.whl
| Download URL | mdsrc-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c4712ecbc50ddcfca33726466cf2f79a5db2068b89f424dd182b91bd43860e0
|
|
BLAKE2b-256 checksum How to use checksums |
daa9ce9abb90a4d289c70f3e6b40592dba7c8dbb032a64c8f61da73ebb0fcdbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 30, 2026.
Transparency log