find_url_info
- find_url_info(distribution_name: str, dist_time: datetime | None = None) VerboseVersionInfo | None [source]
Extract package information for packages installed from an url or locally.
If the packages was installed using an url ‘direct_url.json’ will be parsed and the information extracted. If a
vcs
(e.g.git
) was used, the usedvcs
andcommit_id
will be retrieved as well.- Parameters:
distribution_name (str) – The name of the distribution package as a string.
dist_time (datetime) – Datetime instance of when the distribution was created.
Examples
If the package was installed using git:
pip install git+https://github.com/s-weigand/git-install-test-distribution.git
>>> find_url_info("git-install-test-distribution", datetime(2021, 2, 28)) VcsInfo( release_version="0.0.2", dist_time=datetime(2021, 2, 28), url="https://github.com/s-weigand/git-install-test-distribution.git", commit_id="a7f7bf28dbe9bfceba1af8a259383e398a942ad0", vcs="git", )
If the package was installed by an url to an archive on ‘2021-02-27’:
pip install https://github.com/s-weigand/git-install-test-distribution/archive/main.zip
>>> find_url_info("git-install-test-distribution") VcsInfo( release_version="0.0.2", dist_time=datetime(2021, 2, 27), url="https://github.com/s-weigand/git-install-test-distribution/archive/main.zip", commit_id="", vcs="", )
If the package was not installed from an url or locally:
pip install package-on-pypi
>>> find_url_info("package-on-pypi") None
- Returns:
- VerboseVersionInfo
If the package was installed from a url resource.
- None
If the package was installed from as editable or PyPi.
- Return type:
VerboseVersionInfo | None