trailrunner


Nametrailrunner JSON
Version 1.4.0 PyPI version JSON
download
home_pageNone
SummaryRun things on paths
upload_time2023-03-27 07:54:35
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # trailrunner

Walk paths and run things

[![version](https://img.shields.io/pypi/v/trailrunner.svg)](https://pypi.org/project/trailrunner)
[![documentation](https://readthedocs.org/projects/trailrunner/badge/?version=latest)](https://trailrunner.omnilib.dev)
[![changelog](https://img.shields.io/badge/change-log-blue)](https://trailrunner.omnilib.dev/en/latest/changelog.html)
[![license](https://img.shields.io/pypi/l/trailrunner.svg)](https://github.com/omnilib/trailrunner/blob/master/LICENSE)
[![build status](https://github.com/omnilib/trailrunner/workflows/Build/badge.svg?branch=main)](https://github.com/omnilib/trailrunner/actions)
[![code coverage](https://img.shields.io/codecov/c/gh/omnilib/trailrunner)](https://codecov.io/gh/omnilib/trailrunner)

trailrunner is a simple library for walking paths on the filesystem, and executing
functions for each file found. trailrunner obeys project level `.gitignore` files,
and runs functions on a process pool for increased performance. trailrunner is designed
for use by linting, formatting, and other developer tools that need to find and operate
on all files in project in a predictable fashion with a minimal API:

`walk()` takes a single `Path`, and generates a list of significant files in that tree:

```pycon
>>> from trailrunner import walk
>>> sorted(walk(Path("trailrunner")))
[
    PosixPath('trailrunner/__init__.py'),
    PosixPath('trailrunner/__version__.py'),
    PosixPath('trailrunner/core.py'),
    PosixPath('trailrunner/tests/__init__.py'),
    PosixPath('trailrunner/tests/__main__.py'),
    PosixPath('trailrunner/tests/core.py'),
]
```

`run()` takes a list of `Path` objects and a function, and runs that function once
for each path given. It runs these functions on a process pool, and returns a mapping
of paths to results:

```pycon
>>> from trailrunner import run
>>> paths = [Path('trailrunner/core.py'), Path('trailrunner/tests/core.py')]
>>> run(paths, str)
{
    PosixPath('trailrunner/core.py'): 'trailrunner/core.py',
    PosixPath('trailrunner/tests/core.py'): 'trailrunner/tests/core.py',
}
```

`walk_and_run()` does exactly what you would expect:

```pycon
>>> from trailrunner import walk_and_run
>>> walk_and_run([Path('trailrunner/tests')], str)
{
    PosixPath('trailrunner/tests/__init__.py'): 'trailrunner/tests/__init__.py',
    PosixPath('trailrunner/tests/__main__.py'): 'trailrunner/tests/__main__.py',
    PosixPath('trailrunner/tests/core.py'): 'trailrunner/tests/core.py',
}
```


Install
-------

trailrunner requires Python 3.6 or newer. You can install it from PyPI:

```shell-session
$ pip install trailrunner
```


License
-------

trailrunner is copyright [Amethyst Reese](https://noswap.com), and licensed under
the MIT license.  I am providing code in this repository to you under an open
source license.  This is my personal repository; the license you receive to
my code is from me and not from my employer. See the `LICENSE` file for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "trailrunner",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Amethyst Reese <amy@n7.gg>",
    "download_url": "https://files.pythonhosted.org/packages/4d/93/630e10bacd897daeb9ff5a408f4e7cb0fc2f243e7e3ef00f9e6cf319b11c/trailrunner-1.4.0.tar.gz",
    "platform": null,
    "description": "# trailrunner\n\nWalk paths and run things\n\n[![version](https://img.shields.io/pypi/v/trailrunner.svg)](https://pypi.org/project/trailrunner)\n[![documentation](https://readthedocs.org/projects/trailrunner/badge/?version=latest)](https://trailrunner.omnilib.dev)\n[![changelog](https://img.shields.io/badge/change-log-blue)](https://trailrunner.omnilib.dev/en/latest/changelog.html)\n[![license](https://img.shields.io/pypi/l/trailrunner.svg)](https://github.com/omnilib/trailrunner/blob/master/LICENSE)\n[![build status](https://github.com/omnilib/trailrunner/workflows/Build/badge.svg?branch=main)](https://github.com/omnilib/trailrunner/actions)\n[![code coverage](https://img.shields.io/codecov/c/gh/omnilib/trailrunner)](https://codecov.io/gh/omnilib/trailrunner)\n\ntrailrunner is a simple library for walking paths on the filesystem, and executing\nfunctions for each file found. trailrunner obeys project level `.gitignore` files,\nand runs functions on a process pool for increased performance. trailrunner is designed\nfor use by linting, formatting, and other developer tools that need to find and operate\non all files in project in a predictable fashion with a minimal API:\n\n`walk()` takes a single `Path`, and generates a list of significant files in that tree:\n\n```pycon\n>>> from trailrunner import walk\n>>> sorted(walk(Path(\"trailrunner\")))\n[\n    PosixPath('trailrunner/__init__.py'),\n    PosixPath('trailrunner/__version__.py'),\n    PosixPath('trailrunner/core.py'),\n    PosixPath('trailrunner/tests/__init__.py'),\n    PosixPath('trailrunner/tests/__main__.py'),\n    PosixPath('trailrunner/tests/core.py'),\n]\n```\n\n`run()` takes a list of `Path` objects and a function, and runs that function once\nfor each path given. It runs these functions on a process pool, and returns a mapping\nof paths to results:\n\n```pycon\n>>> from trailrunner import run\n>>> paths = [Path('trailrunner/core.py'), Path('trailrunner/tests/core.py')]\n>>> run(paths, str)\n{\n    PosixPath('trailrunner/core.py'): 'trailrunner/core.py',\n    PosixPath('trailrunner/tests/core.py'): 'trailrunner/tests/core.py',\n}\n```\n\n`walk_and_run()` does exactly what you would expect:\n\n```pycon\n>>> from trailrunner import walk_and_run\n>>> walk_and_run([Path('trailrunner/tests')], str)\n{\n    PosixPath('trailrunner/tests/__init__.py'): 'trailrunner/tests/__init__.py',\n    PosixPath('trailrunner/tests/__main__.py'): 'trailrunner/tests/__main__.py',\n    PosixPath('trailrunner/tests/core.py'): 'trailrunner/tests/core.py',\n}\n```\n\n\nInstall\n-------\n\ntrailrunner requires Python 3.6 or newer. You can install it from PyPI:\n\n```shell-session\n$ pip install trailrunner\n```\n\n\nLicense\n-------\n\ntrailrunner is copyright [Amethyst Reese](https://noswap.com), and licensed under\nthe MIT license.  I am providing code in this repository to you under an open\nsource license.  This is my personal repository; the license you receive to\nmy code is from me and not from my employer. See the `LICENSE` file for details.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Run things on paths",
    "version": "1.4.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b12921001afea86bac5016c3940b43de3ce4786b0d8337d4ea79bb903c649ce3",
                "md5": "a1fb077ad0302c9e61dddf130d7c03fc",
                "sha256": "a286d39f2723f28d167347f41cf8f232832648709366e722f55cf5545772a48e"
            },
            "downloads": -1,
            "filename": "trailrunner-1.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a1fb077ad0302c9e61dddf130d7c03fc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 11071,
            "upload_time": "2023-03-27T07:54:32",
            "upload_time_iso_8601": "2023-03-27T07:54:32.514628Z",
            "url": "https://files.pythonhosted.org/packages/b1/29/21001afea86bac5016c3940b43de3ce4786b0d8337d4ea79bb903c649ce3/trailrunner-1.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4d93630e10bacd897daeb9ff5a408f4e7cb0fc2f243e7e3ef00f9e6cf319b11c",
                "md5": "ba046917f1562397306b167a6ae62c83",
                "sha256": "3fe61e259e6b2e5192f321c265985b7a0dc18497ced62b2da244f08104978398"
            },
            "downloads": -1,
            "filename": "trailrunner-1.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ba046917f1562397306b167a6ae62c83",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 15836,
            "upload_time": "2023-03-27T07:54:35",
            "upload_time_iso_8601": "2023-03-27T07:54:35.515278Z",
            "url": "https://files.pythonhosted.org/packages/4d/93/630e10bacd897daeb9ff5a408f4e7cb0fc2f243e7e3ef00f9e6cf319b11c/trailrunner-1.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-27 07:54:35",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "trailrunner"
}
        
Elapsed time: 0.10986s