nitpick.style.fetchers.pypackage module

Support for py schemes.

class nitpick.style.fetchers.pypackage.PythonPackageFetcher(cache_manager: cachy.cache_manager.CacheManager, cache_option: str, protocols: Tuple[str, ...] = ('py', 'pypackage'), domains: Tuple[str, ...] = ())[source]

Bases: nitpick.style.fetchers.base.StyleFetcher

Fetch a style from an installed Python package.

URL schemes: - py://import/path/of/style/file/<style_file_name> - pypackage://import/path/of/style/file/<style_file_name>

E.g. py://some_package/path/nitpick.toml.

cache_manager: CacheManager
cache_option: str
domains: Tuple[str, ...] = ()
fetch(url) Tuple[Optional[pathlib.Path], str]

Fetch a style form cache or from a specific fetcher.

protocols: Tuple[str, ...] = ('py', 'pypackage')
requires_connection = False
class nitpick.style.fetchers.pypackage.PythonPackageURL(import_path: str, resource_name: str)[source]

Bases: object

Represent a resource file in installed Python package.

import_path: str
classmethod parse_url(url: str) nitpick.style.fetchers.pypackage.PythonPackageURL[source]

Create an instance by parsing a URL string in any accepted format.

See the code for test_parsing_python_package_urls() for more examples.

property raw_content_url: importlib_resources.abc.Traversable

Raw path of resource file.

resource_name: str