Skip to main content

Generate a file containing all (locally found) licenses from your project.

Project description

licenses-generator

Generate a file containing all (locally found) licenses from your project.

About

This script is used in production @ Prisma to generate the required attributions for our license page.

How?

It walks the given directory and searches for license files, and after it's done, it will write all of them to a new file, following the given template.

Compatibility

At this time, it's only been tested on JS project (the default folder is node_modules), but it should be compatible with anything that stores licenses locally.

Usage

Recomanded

from generate_licenses import Generator, Template # <- Or you can use DefaultTemplate

template = Template(
    wrapper_template='<div>\n$ctnt\n</div>',
    title_template='<h1>$ctnt</h1>\n',
    license_template='<pre>\n<code>\n$ctnt\n</code>\n</pre>'
)

generator = Generator(template, <initial_dir>, <out_file>, <out_separator>)
generator.write_licenses()

CLI (Not recomanded)

See help: generate_licenses.py -h


How does the Templating work?

Let's start with the given example (from above) - That will generate the following:

<div>
<h1>PACKAGE_NAME</h1>
<pre>
<code>
LICENSE
</code>
</pre>
</div>

Basically you can write whatever you want, and put $ctnt where you want the actual "content" to be put


Contributing Guide

If you wish to contribute to generate_licenses please see CONTRIBUTING.md

Code of Conduct

Please respect our Code of Conduct. It can be found here


Authors

License

Copyright 2021 Prisma

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

(C) Prisma 2021 - https://buyprisma.netlify.app/

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

generate_licenses-1.2.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

generate_licenses-1.2.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file generate_licenses-1.2.0.tar.gz.

File metadata

  • Download URL: generate_licenses-1.2.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9

File hashes

Hashes for generate_licenses-1.2.0.tar.gz
Algorithm Hash digest
SHA256 4da1b3000fb38f2369ab6687cc3eebcf7decfccfb0b7c9be7ba6f233c092c752
MD5 a13eab9f1eb61324101af48cc77ad01f
BLAKE2b-256 b24a0c61c7641443fff5d26cf7181bbf4395bd059748d9032ac5a7ff92c3a90e

See more details on using hashes here.

File details

Details for the file generate_licenses-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: generate_licenses-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9

File hashes

Hashes for generate_licenses-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f57428ae03fd217704ab971313a844ba0e4b49f2b3e2cae89f2a6d060da48cb
MD5 f05fedbc2a5894fd2bb032e66e788e39
BLAKE2b-256 3043d405631a837cdb1f56870967cc921982e52eb86f39c399ed2d2889a8a100

See more details on using hashes here.

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