For a package, locate its source repository url and its relative path within the repository
Project description
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
, andCargo.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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file package-locator-0.4.3.tar.gz
.
File metadata
- Download URL: package-locator-0.4.3.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/21.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 229dedc3e575ae2262318833422078e92f485a6235192db771be806534fff156 |
|
MD5 | 43f3b417253999fad9bc3cc35f5fbac1 |
|
BLAKE2b-256 | 55da270020a2961d0dafbc08e56a91e88af298f3d25635a4fbe1e17bbdd2fa5c |
Provenance
File details
Details for the file package_locator-0.4.3-py3-none-any.whl
.
File metadata
- Download URL: package_locator-0.4.3-py3-none-any.whl
- Upload date:
- Size: 9.5 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ed42e1f96b8cb769d58214a35d7e1c1979919d196431c5f56f86501e9007124 |
|
MD5 | 0fe5df3fc0cef7edd60b09326fbe1874 |
|
BLAKE2b-256 | c6948b316599cf39dd5fcc7964d2bb109d6e0f34446274527e64423fb66db79d |