docify


Namedocify JSON
Version 1.1.0 PyPI version JSON
download
home_pageNone
SummaryA script to add docstrings to Python type stubs using reflection
upload_time2024-12-07 15:05:07
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # docify

A script to add docstrings to Python type stubs using reflection

## Features

- Uses [LibCST](https://github.com/Instagram/LibCST) to parse and modify the stub file
- Dynamically imports the actual module to get the runtime docstring
- Handles most `sys.version` and `sys.platform` conditional blocks, will only add docstrings to the correct branch
- Able to modify files in-place with `-i` or `--in-place`
- Won't overwrite existing docstrings
- With `-b` or `--builtins-only`, will only add docstrings for modules found in `sys.builtin_module_names` (stdlib modules written in C).
- With `--if-needed`, will only add docstrings if the object's (Python) source code is unavailable. Useful for language servers like [basedpyright](https://github.com/DetachHead/basedpyright) that are able to extract docstrings from source code.

## Installation

Install from [PyPI](https://pypi.org/project/docify/):

```sh
pip install docify

docify
# or
python -m docify
```

Or from [conda-forge](https://anaconda.org/conda-forge/docify):

```sh
conda install conda-forge::docify

docify
# or
python -m docify
```

Or just download and run the script directly:

```sh
# Install dependencies
pip install libcst tqdm  # tqdm is optional, and is only used if not running with -q

python docify.py
# or
python -m docify
# or
chmod +x docify.py
./docify.py
```

## Usage

```
docify [-h] [-V] [-v] [-q] [-b] [--if-needed] (-i | -o OUTPUT_DIR) INPUT_DIR [INPUT_DIR ...]

A script to add docstrings to Python type stubs using reflection

positional arguments:
  INPUT_DIR             directory to read stubs from

options:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -v, --verbose         increase verbosity
  -q, --quiet           decrease verbosity
  -b, --builtins-only   only add docstrings to modules found in `sys.builtin_module_names`
  --if-needed           only add a docstring if the object's source code cannot be found
  -i, --in-place        modify stubs in-place
  -o, --output OUTPUT_DIR
                        directory to write modified stubs to
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "docify",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "AThePeanut4 <andre.toerien8@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/5c/43/b6b3ed504910ce076e6b7b6659aba4d26e51da3d3116393232278df22284/docify-1.1.0.tar.gz",
    "platform": null,
    "description": "# docify\n\nA script to add docstrings to Python type stubs using reflection\n\n## Features\n\n- Uses [LibCST](https://github.com/Instagram/LibCST) to parse and modify the stub file\n- Dynamically imports the actual module to get the runtime docstring\n- Handles most `sys.version` and `sys.platform` conditional blocks, will only add docstrings to the correct branch\n- Able to modify files in-place with `-i` or `--in-place`\n- Won't overwrite existing docstrings\n- With `-b` or `--builtins-only`, will only add docstrings for modules found in `sys.builtin_module_names` (stdlib modules written in C).\n- With `--if-needed`, will only add docstrings if the object's (Python) source code is unavailable. Useful for language servers like [basedpyright](https://github.com/DetachHead/basedpyright) that are able to extract docstrings from source code.\n\n## Installation\n\nInstall from [PyPI](https://pypi.org/project/docify/):\n\n```sh\npip install docify\n\ndocify\n# or\npython -m docify\n```\n\nOr from [conda-forge](https://anaconda.org/conda-forge/docify):\n\n```sh\nconda install conda-forge::docify\n\ndocify\n# or\npython -m docify\n```\n\nOr just download and run the script directly:\n\n```sh\n# Install dependencies\npip install libcst tqdm  # tqdm is optional, and is only used if not running with -q\n\npython docify.py\n# or\npython -m docify\n# or\nchmod +x docify.py\n./docify.py\n```\n\n## Usage\n\n```\ndocify [-h] [-V] [-v] [-q] [-b] [--if-needed] (-i | -o OUTPUT_DIR) INPUT_DIR [INPUT_DIR ...]\n\nA script to add docstrings to Python type stubs using reflection\n\npositional arguments:\n  INPUT_DIR             directory to read stubs from\n\noptions:\n  -h, --help            show this help message and exit\n  -V, --version         show program's version number and exit\n  -v, --verbose         increase verbosity\n  -q, --quiet           decrease verbosity\n  -b, --builtins-only   only add docstrings to modules found in `sys.builtin_module_names`\n  --if-needed           only add a docstring if the object's source code cannot be found\n  -i, --in-place        modify stubs in-place\n  -o, --output OUTPUT_DIR\n                        directory to write modified stubs to\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A script to add docstrings to Python type stubs using reflection",
    "version": "1.1.0",
    "project_urls": {
        "Repository": "https://github.com/AThePeanut4/docify"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d1b4a5ea211025bf8544a1366e04c57efca6c9d1ba45028e53269ce1182bb49d",
                "md5": "77fc2433daf07e4a23610d7e6174e558",
                "sha256": "9b45a82f0da74e97f80d5ace255b417ec289cb2d22d321bfe3124f38a42df68b"
            },
            "downloads": -1,
            "filename": "docify-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "77fc2433daf07e4a23610d7e6174e558",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8652,
            "upload_time": "2024-12-07T15:05:06",
            "upload_time_iso_8601": "2024-12-07T15:05:06.041973Z",
            "url": "https://files.pythonhosted.org/packages/d1/b4/a5ea211025bf8544a1366e04c57efca6c9d1ba45028e53269ce1182bb49d/docify-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5c43b6b3ed504910ce076e6b7b6659aba4d26e51da3d3116393232278df22284",
                "md5": "23a3cba7c43d6192cff86aaad609e5ae",
                "sha256": "d9475055a330b4edc31be5854d78704a9c231dcf29b4c6e79421e4ce2adb90aa"
            },
            "downloads": -1,
            "filename": "docify-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "23a3cba7c43d6192cff86aaad609e5ae",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8610,
            "upload_time": "2024-12-07T15:05:07",
            "upload_time_iso_8601": "2024-12-07T15:05:07.958204Z",
            "url": "https://files.pythonhosted.org/packages/5c/43/b6b3ed504910ce076e6b7b6659aba4d26e51da3d3116393232278df22284/docify-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-07 15:05:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AThePeanut4",
    "github_project": "docify",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "docify"
}
        
Elapsed time: 0.39189s