Skip to main content

For a package, locate its source repository url and its relative path within the repository

Project description

PyPI Python Version License Read the documentation at https://package-locator.readthedocs.io/ Build Package Status Run Tests Status Codecov pre-commit Black

Features

  • For a given package, package-locator locates its source code repository and the sub-directory within the repository the package resides in.

  • Covers packages from npm, PyPI, RubyGems, Composer, and Cargo.

  • Locates repository from metadata collected from registry APIs.

  • Validates repository and locates sub-directory through a set of heuristics for each package ecosystem. For npm, Composer, and Cargo packages, package-locator looks at the manifest file (package.json, composer.json, and Cargo.toml) to locate package specific code. For RubyGems and PyPI packages, package-locator either looks at the manifest file (gemspec file) or compares the files present in the registry with the files present in the repository.

Installation

You can install package-locator via pip from PyPI:

$ pip install package-locator

Usage

from package_locator.locator import get_repository_url_and_subdir is the primary function offered by package-locator. The function takes two inputs - ecosystem and package. The ecosystem names need to be provided as per defined within package-locator. You can import from package-locator.common import CARGO, NPM, PYPI, COMPOSER, RUBYGEMS and then use the constant values to indicate the ecosystem name. The function returns the source code repository URL and the sub-directory within the repository where the input package resides in. For example, get_repository_url_and_subdir(NPM, "react") call returns ("https://github.com/facebook/react", "./packages/react").

Credits

This package was created with cookietemple using Cookiecutter based on Hypermodern_Python_Cookiecutter.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

package-locator-0.4.2.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

package_locator-0.4.2-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file package-locator-0.4.2.tar.gz.

File metadata

  • Download URL: package-locator-0.4.2.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/21.1.0

File hashes

Hashes for package-locator-0.4.2.tar.gz
Algorithm Hash digest
SHA256 3dd9e2aab05308475dd99b00ccf3e1ab4cb0a3cfbd5f89ef6d5b7e1c3cc95533
MD5 12d1b0ef4193e1eb30ae705b2cc6cd8b
BLAKE2b-256 182c52a398c4f1ff202e27b758371e58bc360723c97dc5b294f113380bc7bb7d

See more details on using hashes here.

Provenance

File details

Details for the file package_locator-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: package_locator-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/21.1.0

File hashes

Hashes for package_locator-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 161b6030bd53e8839ea20ae6e7dbc65fee9a00ba1e8b2f48543a541d7fe57cab
MD5 219b211dc4ecacd9acafd09250ae321c
BLAKE2b-256 03078b806b6acf642c5c38d3f598772476e9763c7268bfe75d4f50e534686bec

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page