markmodule


Namemarkmodule JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/matthewdeanmartin/markmodule
SummaryImport python code in markdown as module
upload_time2023-06-18 23:35:25
maintainer
docs_urlNone
authorMatthew Martin
requires_python
licenseMIT
keywords markdown
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.

```markdown
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.

```python
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.
```python
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](https://pypi.org/project/markmodule), this library

The do-everything-with-markdown ecosystem is surprisingly robust.
- as a Makefile alternative, [mask](https://github.com/jacobdeichert/mask)
- as a place to put scripts, eg python's [markdown-exec](https://pypi.org/project/markdown-exec/), or ruby's [markdown_exec](https://github.com/fareedst/markdown_exec)
- as a place to put unit tests, [pytest-markdown-docs](https://pypi.org/project/pytest-markdown-docs/),  [pytest-codeblocks](https://pypi.org/project/pytest_codeblocks/), and [pytest-markdown](https://pypi.org/project/pytest-markdown/)
- as a string template, [proof-of-concept gist](https://gist.github.com/facelessuser/53fa4d93f27c252fda813b5e0ba7325c)


## 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

- [Contributing](https://github.com/matthewdeanmartin/markmoduel/blob/main/docs/contributing.md)
- [TODO](https://github.com/matthewdeanmartin/markmoduel/blob/main/docs/TODO.md)
- [Related StackOverflow Links](https://github.com/matthewdeanmartin/markmoduel/blob/main/docs/stackoverflow.md)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/matthewdeanmartin/markmodule",
    "name": "markmodule",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "markdown",
    "author": "Matthew Martin",
    "author_email": "matthewdeanmartin@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/45/79/eb2b7e81820f62d4b67832570f6ea0ca8cfa59c82b8682ec355cd964703d/markmodule-0.3.0.tar.gz",
    "platform": null,
    "description": "# markmodule\nImport python from markdown files.\n\n## Usage\n\nIn a file named `hello_module.md` define a function. I'm escaping the fence, use a real three-tick fence.\n\n```markdown\nHere is a function\n\n``(`)python\ndef hello() -> str:\n    return \"Hello\"\n``(`) \n```\n\nGenerate 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.\n\n```python\nimport sys\nimport markmodule\nmarkmodule.generate_side_by_side_pyi(\"hello_module\")\nsys.meta_path.append(markmodule.MdFinder())\nimport hello_module\nprint(hello_module.hello())\n```\n\nImport with path to file.\n```python\nimport markmodule\nmarkmodule.import_md(\"hello_module.md\")\nimport hello_module\nprint(hello_module.hello())\n```\n\n## Markdown is a hammer, everything is a nail\n\nYou can use markdown:\n\n- as a place to put module code, [markmodule](https://pypi.org/project/markmodule), this library\n\nThe do-everything-with-markdown ecosystem is surprisingly robust.\n- as a Makefile alternative, [mask](https://github.com/jacobdeichert/mask)\n- as a place to put scripts, eg python's [markdown-exec](https://pypi.org/project/markdown-exec/), or ruby's [markdown_exec](https://github.com/fareedst/markdown_exec)\n- as a place to put unit tests, [pytest-markdown-docs](https://pypi.org/project/pytest-markdown-docs/),  [pytest-codeblocks](https://pypi.org/project/pytest_codeblocks/), and [pytest-markdown](https://pypi.org/project/pytest-markdown/)\n- as a string template, [proof-of-concept gist](https://gist.github.com/facelessuser/53fa4d93f27c252fda813b5e0ba7325c)\n\n\n## Change Log\n\n- 0.1.0 - Basic idea.\n- 0.2.0 - Updates to readme\n- 0.3.0 - Generates pyi and you can use `import` syntax \n\n## Documentation\n\n- [Contributing](https://github.com/matthewdeanmartin/markmoduel/blob/main/docs/contributing.md)\n- [TODO](https://github.com/matthewdeanmartin/markmoduel/blob/main/docs/TODO.md)\n- [Related StackOverflow Links](https://github.com/matthewdeanmartin/markmoduel/blob/main/docs/stackoverflow.md)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Import python code in markdown as module",
    "version": "0.3.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/matthewdeanmartin/markmodule/issues",
        "Change Log": "https://github.com/matthewdeanmartin/markmodule/blob/main/CHANGES.md",
        "Documentation": "https://github.com/matthewdeanmartin/markmodule",
        "Homepage": "https://github.com/matthewdeanmartin/markmodule",
        "Repository": "https://github.com/matthewdeanmartin/markmodule"
    },
    "split_keywords": [
        "markdown"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c6ef227d75d674a999550cfcf7b502567d88095f906aee8f8668c63b742d0459",
                "md5": "d257a906c87399c71e74c43fbf6c4665",
                "sha256": "ffcbf37e86b39530842a341eda14e9fecce99ec4afd19cf0d10a66bf04e7ad15"
            },
            "downloads": -1,
            "filename": "markmodule-0.3.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d257a906c87399c71e74c43fbf6c4665",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 7263,
            "upload_time": "2023-06-18T23:35:23",
            "upload_time_iso_8601": "2023-06-18T23:35:23.981135Z",
            "url": "https://files.pythonhosted.org/packages/c6/ef/227d75d674a999550cfcf7b502567d88095f906aee8f8668c63b742d0459/markmodule-0.3.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4579eb2b7e81820f62d4b67832570f6ea0ca8cfa59c82b8682ec355cd964703d",
                "md5": "e693d8ca0e20f109c44c1957e4a05209",
                "sha256": "d561cf2dc9ccd013ae85ba9a0dcec9bcd83a8e76b20e8edddafbc55bd3f7c191"
            },
            "downloads": -1,
            "filename": "markmodule-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e693d8ca0e20f109c44c1957e4a05209",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6449,
            "upload_time": "2023-06-18T23:35:25",
            "upload_time_iso_8601": "2023-06-18T23:35:25.471335Z",
            "url": "https://files.pythonhosted.org/packages/45/79/eb2b7e81820f62d4b67832570f6ea0ca8cfa59c82b8682ec355cd964703d/markmodule-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-18 23:35:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "matthewdeanmartin",
    "github_project": "markmodule",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "markmodule"
}
        
Elapsed time: 0.07684s