Skip to content

TeamSmil3y/LicenseLib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LicenseLib

Python

Library for fetching licenses and dependencies.

Install

python3 -m pip install --user licenselib

Usage

Retrieve package info from PyPI:

from licenselib import pypi, License

pkg = pypi.get_package('licenselib')
print(pkg) # all pkg data

dependencies = pkg.dependencies
print(dependencies) # pkg dependencies as list including version

# for locally installed packages you may use:
license: License = get_local_licenses(['requests'])[0]
print(license) # license metadata
print(license.licensetext) # full licensetext

# for remote packages you could use: (note: this will install the package temporarily though!)
license: License = get_licenses_unsafe(['django'])[0]
print(license)
print(license.licensetext)

Retrieve packages from GitHub:

from licenselib import github, License

# get github repo
repo = github.get_repo(owner='django', name='django') # like this
repo = github.get_repo(url='https://github.com/django/django') # or like this

dependencies = repo.dependencies
print(dependencies) # repo dependencies
print(dependency.name for dependency in repo.dependencies) # repo dependencies names as list

# get license
license: License = repo.license
print(license)
print(license.licensetext)

# or get even more data
license_data = repo.get_license()
print(license_data) # all license data

About

Library for fetching licenses and dependencies

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages