Name | pytkdocs JSON |
Version |
0.16.2
JSON |
| download |
home_page | None |
Summary | Load Python objects documentation. |
upload_time | 2024-09-07 14:58:53 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | ISC |
keywords |
python
source
signature
docs
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# pytkdocs
[![ci](https://github.com/mkdocstrings/pytkdocs/workflows/ci/badge.svg)](https://github.com/mkdocstrings/pytkdocs/actions?query=workflow%3Aci)
[![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://mkdocstrings.github.io/pytkdocs/)
[![pypi version](https://img.shields.io/pypi/v/pytkdocs.svg)](https://pypi.org/project/pytkdocs/)
[![conda version](https://img.shields.io/conda/vn/conda-forge/pytkdocs)](https://anaconda.org/conda-forge/pytkdocs)
[![gitpod](https://img.shields.io/badge/gitpod-workspace-708FCC.svg?style=flat)](https://gitpod.io/#https://github.com/mkdocstrings/pytkdocs)
[![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#pytkdocs:gitter.im)
Load Python objects documentation.
## Installation
With `pip`:
```bash
pip install pytkdocs
```
With [`pipx`](https://github.com/pipxproject/pipx):
```bash
python3.8 -m pip install --user pipx
pipx install pytkdocs
```
With `conda`:
```python
conda install -c conda-forge pytkdocs
```
## Usage
`pytkdocs` accepts JSON on standard input and writes JSON on standard output.
Input format:
```json
{
"objects": [
{
"path": "pytkdocs",
"new_path_syntax": false,
"members": true,
"inherited_members": false,
"filters": [
"!^_[^_]"
],
"docstring_style": "google",
"docstring_options": {
"replace_admonitions": true
}
}
]
}
```
Output format:
```json
{
"loading_errors": [
"string (message)"
],
"parsing_errors": {
"string (object)": [
"string (message)"
]
},
"objects": [
{
"name": "pytkdocs",
"path": "pytkdocs",
"category": "module",
"file_path": "/media/data/dev/pawamoy/pytkdocs/src/pytkdocs/__init__.py",
"relative_file_path": "pytkdocs/__init__.py",
"properties": [
"special"
],
"parent_path": "pytkdocs",
"has_contents": true,
"docstring": "pytkdocs package.\n\nLoad Python objects documentation.",
"docstring_sections": [
{
"type": "markdown",
"value": "pytkdocs package.\n\nLoad Python objects documentation."
}
],
"source": {
"code": "\"\"\"\npytkdocs package.\n\nLoad Python objects documentation.\n\"\"\"\n\nfrom typing import List\n\n__all__: List[str] = []\n",
"line_start": 1
},
"children": {
"pytkdocs.__all__": {
"name": "__all__",
"path": "pytkdocs.__all__",
"category": "attribute",
"file_path": "/media/data/dev/pawamoy/pytkdocs/src/pytkdocs/__init__.py",
"relative_file_path": "pytkdocs/__init__.py",
"properties": [
"special"
],
"parent_path": "pytkdocs",
"has_contents": false,
"docstring": null,
"docstring_sections": [],
"source": {},
"children": {},
"attributes": [],
"methods": [],
"functions": [],
"modules": [],
"classes": []
}
},
"attributes": [
"pytkdocs.__all__"
],
"methods": [],
"functions": [],
"modules": [
"pytkdocs.__main__",
"pytkdocs.cli",
"pytkdocs.loader",
"pytkdocs.objects",
"pytkdocs.parsers",
"pytkdocs.properties",
"pytkdocs.serializer"
],
"classes": []
}
]
}
```
## Command-line
Running `pytkdocs` without argument will read the whole standard input,
and output the result once.
Running `pytkdocs --line-by-line` will enter an infinite loop,
where at each iteration one line is read on the standard input,
and the result is written back on one line.
This allows other programs to use `pytkdocs` in a subprocess,
feeding it single lines of JSON, and reading back single lines of JSON as well.
This mode was actually implemented specifically for
[mkdocstrings](https://github.com/pawamoy/mkdocstrings).
## Configuration
The configuration options available are:
- `new_path_syntax`: when set to true, this option forces the use of the new object path syntax,
which uses a colon (`:`) to delimit modules from other objects.
- `filters`: filters are regular expressions that allow to select or un-select objects based on their name.
They are applied recursively (on every child of every object).
If the expression starts with an exclamation mark,
it will filter out objects matching it (the exclamation mark is removed before evaluation).
If not, objects matching it are selected.
Every regular expression is performed against every name.
It allows fine-grained filtering. Example:
- `!^_`: filter out every object whose name starts with `_` (private/protected)
- `^__`: but still select those who start with two `_` (class-private)
- `!^__.*__$`: except those who also end with two `_` (specials)
- `members`: this option allows to explicitly select the members of the top-object.
If `True`, select every members that passes filters. If `False`, select nothing.
If it's a list of names, select only those members, and apply filters on their children only.
- `inherited_members`: true or false (default). When enabled, inherited members will be selected as well.
- `docstring_style`: the docstring style to use when parsing the docstring. `google`, `restructured-text`<sup>1</sup> and `numpy`<sup>2</sup>.
- `docstring_options`: options to pass to the docstring parser.
- `replace_admonitions` boolean option (default: true). When enabled, this option will
replace titles of an indented block by their Markdown admonition equivalent:
`AdmonitionType: Title` will become `!!! admonitiontype "Title"`.
- `trim_doctest_flags` boolean option (default: true). When enabled, all doctest
flags (of the form `# doctest: +FLAG` and `<BLANKLINE>`) located within python
example blocks will be removed from the parsed output.
The `google` docstring style accepts both options. The `numpy` style only accepts `trim_doctest_flags`. The `restructured-text` style does not accept any options.
<sup>1</sup>: reStructured Text parsing is in active development and is not feature complete yet.</br>
<sup>2</sup>: The following sections are currently not supported : `Notes`, `See Also`, `Warns` and `References`.
### Details on `new_path_syntax`
Example:
<table>
<tr>
<td>New syntax</td>
<td><code>package.module:Class.attribute</code></td>
</tr>
<tr>
<td>Old syntax</td>
<td><code>package.module.Class.attribute</code></td>
</tr>
</table>
- If there is a colon is an object's path, `pytkdocs` splits the path accordingly,
regardless of the value of `new_path_syntax`.
- If there isn't a colon, and `new_path_syntax` is false, `pytkdocs` uses the
old importing behavior.
- If there isn't a colon, and `new_path_syntax` is true, `pytkdocs` uses the new
importing behavior and therefore considers that the path points to a module.
Raw data
{
"_id": null,
"home_page": null,
"name": "pytkdocs",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "python, source, signature, docs",
"author": null,
"author_email": "=?utf-8?q?Timoth=C3=A9e_Mazzucotelli?= <dev@pawamoy.fr>",
"download_url": "https://files.pythonhosted.org/packages/6e/69/103d84dafac1dd3a892127999ebbe48019ae27c33d6ea1d35aa46be6c6bc/pytkdocs-0.16.2.tar.gz",
"platform": null,
"description": "# pytkdocs\n\n[![ci](https://github.com/mkdocstrings/pytkdocs/workflows/ci/badge.svg)](https://github.com/mkdocstrings/pytkdocs/actions?query=workflow%3Aci)\n[![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://mkdocstrings.github.io/pytkdocs/)\n[![pypi version](https://img.shields.io/pypi/v/pytkdocs.svg)](https://pypi.org/project/pytkdocs/)\n[![conda version](https://img.shields.io/conda/vn/conda-forge/pytkdocs)](https://anaconda.org/conda-forge/pytkdocs)\n[![gitpod](https://img.shields.io/badge/gitpod-workspace-708FCC.svg?style=flat)](https://gitpod.io/#https://github.com/mkdocstrings/pytkdocs)\n[![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#pytkdocs:gitter.im)\n\nLoad Python objects documentation.\n\n## Installation\n\nWith `pip`:\n\n```bash\npip install pytkdocs\n```\n\nWith [`pipx`](https://github.com/pipxproject/pipx):\n\n```bash\npython3.8 -m pip install --user pipx\npipx install pytkdocs\n```\n\nWith `conda`:\n```python\nconda install -c conda-forge pytkdocs\n```\n\n## Usage\n\n`pytkdocs` accepts JSON on standard input and writes JSON on standard output.\n\nInput format:\n\n```json\n{\n \"objects\": [\n {\n \"path\": \"pytkdocs\",\n \"new_path_syntax\": false,\n \"members\": true,\n \"inherited_members\": false,\n \"filters\": [\n \"!^_[^_]\"\n ],\n \"docstring_style\": \"google\",\n \"docstring_options\": {\n \"replace_admonitions\": true\n }\n }\n ]\n}\n```\n\nOutput format:\n\n```json\n{\n \"loading_errors\": [\n \"string (message)\"\n ],\n \"parsing_errors\": {\n \"string (object)\": [\n \"string (message)\"\n ]\n },\n \"objects\": [\n {\n \"name\": \"pytkdocs\",\n \"path\": \"pytkdocs\",\n \"category\": \"module\",\n \"file_path\": \"/media/data/dev/pawamoy/pytkdocs/src/pytkdocs/__init__.py\",\n \"relative_file_path\": \"pytkdocs/__init__.py\",\n \"properties\": [\n \"special\"\n ],\n \"parent_path\": \"pytkdocs\",\n \"has_contents\": true,\n \"docstring\": \"pytkdocs package.\\n\\nLoad Python objects documentation.\",\n \"docstring_sections\": [\n {\n \"type\": \"markdown\",\n \"value\": \"pytkdocs package.\\n\\nLoad Python objects documentation.\"\n }\n ],\n \"source\": {\n \"code\": \"\\\"\\\"\\\"\\npytkdocs package.\\n\\nLoad Python objects documentation.\\n\\\"\\\"\\\"\\n\\nfrom typing import List\\n\\n__all__: List[str] = []\\n\",\n \"line_start\": 1\n },\n \"children\": {\n \"pytkdocs.__all__\": {\n \"name\": \"__all__\",\n \"path\": \"pytkdocs.__all__\",\n \"category\": \"attribute\",\n \"file_path\": \"/media/data/dev/pawamoy/pytkdocs/src/pytkdocs/__init__.py\",\n \"relative_file_path\": \"pytkdocs/__init__.py\",\n \"properties\": [\n \"special\"\n ],\n \"parent_path\": \"pytkdocs\",\n \"has_contents\": false,\n \"docstring\": null,\n \"docstring_sections\": [],\n \"source\": {},\n \"children\": {},\n \"attributes\": [],\n \"methods\": [],\n \"functions\": [],\n \"modules\": [],\n \"classes\": []\n }\n },\n \"attributes\": [\n \"pytkdocs.__all__\"\n ],\n \"methods\": [],\n \"functions\": [],\n \"modules\": [\n \"pytkdocs.__main__\",\n \"pytkdocs.cli\",\n \"pytkdocs.loader\",\n \"pytkdocs.objects\",\n \"pytkdocs.parsers\",\n \"pytkdocs.properties\",\n \"pytkdocs.serializer\"\n ],\n \"classes\": []\n }\n ]\n}\n```\n\n## Command-line\n\nRunning `pytkdocs` without argument will read the whole standard input,\nand output the result once.\n\nRunning `pytkdocs --line-by-line` will enter an infinite loop,\nwhere at each iteration one line is read on the standard input,\nand the result is written back on one line.\nThis allows other programs to use `pytkdocs` in a subprocess,\nfeeding it single lines of JSON, and reading back single lines of JSON as well.\nThis mode was actually implemented specifically for\n[mkdocstrings](https://github.com/pawamoy/mkdocstrings).\n\n## Configuration\n\nThe configuration options available are:\n\n- `new_path_syntax`: when set to true, this option forces the use of the new object path syntax,\n which uses a colon (`:`) to delimit modules from other objects.\n\n- `filters`: filters are regular expressions that allow to select or un-select objects based on their name.\n They are applied recursively (on every child of every object).\n If the expression starts with an exclamation mark,\n it will filter out objects matching it (the exclamation mark is removed before evaluation).\n If not, objects matching it are selected.\n Every regular expression is performed against every name.\n It allows fine-grained filtering. Example:\n\n - `!^_`: filter out every object whose name starts with `_` (private/protected)\n - `^__`: but still select those who start with two `_` (class-private)\n - `!^__.*__$`: except those who also end with two `_` (specials)\n\n- `members`: this option allows to explicitly select the members of the top-object.\n If `True`, select every members that passes filters. If `False`, select nothing.\n If it's a list of names, select only those members, and apply filters on their children only.\n\n- `inherited_members`: true or false (default). When enabled, inherited members will be selected as well.\n\n- `docstring_style`: the docstring style to use when parsing the docstring. `google`, `restructured-text`<sup>1</sup> and `numpy`<sup>2</sup>.\n\n- `docstring_options`: options to pass to the docstring parser.\n - `replace_admonitions` boolean option (default: true). When enabled, this option will\n replace titles of an indented block by their Markdown admonition equivalent:\n `AdmonitionType: Title` will become `!!! admonitiontype \"Title\"`.\n - `trim_doctest_flags` boolean option (default: true). When enabled, all doctest\n flags (of the form `# doctest: +FLAG` and `<BLANKLINE>`) located within python\n example blocks will be removed from the parsed output.\n\n The `google` docstring style accepts both options. The `numpy` style only accepts `trim_doctest_flags`. The `restructured-text` style does not accept any options.\n\n<sup>1</sup>: reStructured Text parsing is in active development and is not feature complete yet.</br>\n<sup>2</sup>: The following sections are currently not supported : `Notes`, `See Also`, `Warns` and `References`.\n\n### Details on `new_path_syntax`\n\nExample:\n\n<table>\n <tr>\n <td>New syntax</td>\n <td><code>package.module:Class.attribute</code></td>\n </tr>\n <tr>\n <td>Old syntax</td>\n <td><code>package.module.Class.attribute</code></td>\n </tr>\n</table>\n\n- If there is a colon is an object's path, `pytkdocs` splits the path accordingly,\n regardless of the value of `new_path_syntax`.\n- If there isn't a colon, and `new_path_syntax` is false, `pytkdocs` uses the\n old importing behavior.\n- If there isn't a colon, and `new_path_syntax` is true, `pytkdocs` uses the new\n importing behavior and therefore considers that the path points to a module.\n",
"bugtrack_url": null,
"license": "ISC",
"summary": "Load Python objects documentation.",
"version": "0.16.2",
"project_urls": {
"Changelog": "https://mkdocstrings.github.io/pytkdocs/changelog",
"Discussions": "https://github.com/mkdocstrings/pytkdocs/discussions",
"Documentation": "https://mkdocstrings.github.io/pytkdocs",
"Funding": "https://github.com/sponsors/pawamoy",
"Gitter": "https://gitter.im/mkdocstrings/pytkdocs",
"Homepage": "https://mkdocstrings.github.io/pytkdocs",
"Issues": "https://github.com/mkdocstrings/pytkdocs/issues",
"Repository": "https://github.com/mkdocstrings/pytkdocs"
},
"split_keywords": [
"python",
" source",
" signature",
" docs"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b155b9a5412f5ffae09839e0c2d0754893ab4aa4239b65ec038924f5084564d2",
"md5": "60dc9431ed929824581fd7423de6db87",
"sha256": "36450316d004f6399402d044f122f28f88ff4a069899d10de3d28ad6b4ba5799"
},
"downloads": -1,
"filename": "pytkdocs-0.16.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "60dc9431ed929824581fd7423de6db87",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 38834,
"upload_time": "2024-09-07T14:58:50",
"upload_time_iso_8601": "2024-09-07T14:58:50.926647Z",
"url": "https://files.pythonhosted.org/packages/b1/55/b9a5412f5ffae09839e0c2d0754893ab4aa4239b65ec038924f5084564d2/pytkdocs-0.16.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6e69103d84dafac1dd3a892127999ebbe48019ae27c33d6ea1d35aa46be6c6bc",
"md5": "f0ad3bdb44c8ab7b153874f604efc61c",
"sha256": "e75538a34932996b8803fbad4e4f6851fc0e9fd9aea86fc6602d6582c12098f3"
},
"downloads": -1,
"filename": "pytkdocs-0.16.2.tar.gz",
"has_sig": false,
"md5_digest": "f0ad3bdb44c8ab7b153874f604efc61c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 82673,
"upload_time": "2024-09-07T14:58:53",
"upload_time_iso_8601": "2024-09-07T14:58:53.018018Z",
"url": "https://files.pythonhosted.org/packages/6e/69/103d84dafac1dd3a892127999ebbe48019ae27c33d6ea1d35aa46be6c6bc/pytkdocs-0.16.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-07 14:58:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mkdocstrings",
"github_project": "pytkdocs",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pytkdocs"
}