Extract/summarize all licenses in an environment
conda install -c ilastik-forge -c conda-forge conda-3rdparty
# generate text file with all licenses, sorted by package name
conda 3rdparty -n <environment_name> > 3rdparty.txt
# check if all licenses are present
conda 3rdparty -n <environment_name> --check
conda 3rdparty -n <environment_name> --fallback-file <path-to-fallback.json>
# json file assumed to be a dictionary of
# dict["<package_name>"]["license_file"] = ["list_of_license", "files_relative_to_the_json_file"]
from conda3rdparty import render_license_info
from pathlib import Path
license_texts = render_license_info(env_name="myenvname")
# also takes `template_file: Path` and `fallback_file: Path` kwargs
A template for rendering can be supplied to the cli with --template
.
All keys from conda-meta/<package>.json
are available for rendering via elements the license_infos
list.
Each license_info
has the additional '3rd_party_license_info'
key, with the following keys:
license
: name of the licenselicense_family
: name of the license familylicense_texts
: list of license texts (some packages have multiple)
This is also the default template if no template file is supplied to cli:
3rd-party licenses
{% for info in license_infos %}
License for {{ info['name'] }} {{ info['version'] }}
{% for license_text in info['3rd_party_license_info']['license_texts'] %}
{{ license_text }}
{% endfor %}
{% endfor %}
This is also the default template if no template file is supplied to cli:
# 3rd-party licenses
{% for info in license_infos %}
## {{ info['name'] }} {{ info['version'] }} {{ info['build'] }}
{% for license_text in info['3rd_party_license_info']['license_texts'] %}
{{ license_text }}
{% endfor %}
{% endfor %}