Skip to main content

Python License Update (PyLicUp). Updates all the python headers of your project with the provided license text.

Project description

Python 3.13 Code style: black

PythonLicenseUpdater

Simple tool that updates your python files license headers for the given directories. By default it will skip init.py.

How to use it?

As Docker container

  1. Checkout or clone our repository.

  2. Build the container (with podman or docker):

podman build -t pylicup
  1. Run the container mounting the license and the directories to update at the given locations:
podman run -v path/to/your/license/file:/mnt/license -v path/to/your/directory/to/update:/mnt/update pylicup
  1. If you want to update multiple directories you can do it as:
podman run -v path/to/your/license/file:/mnt/license -v path/to/your/directory/to/update:/mnt/update/dir_1 -v path/to/your/other/directory/to/update:/mnt/update/dir_2  pylicup

[!IMPORTANT] Our docker container does not support (yet) replacing of an old license.

As Python package

Installation.

  1. With pip:
pip install pylicup
  1. With latest version from GitHub:
pip install git+https://github.com/Carsopre/PythonLicenseUpdater.git 
  1. With custom version from GitHub:
pip install git+https://github.com/Deltares/PythonLicenseUpdater.git@v0.0.1

Python usage

The following command should be used.

python pylicup -l <path_to_your_license_file> -d <path_to_directory_with_python_files>
  • <path_to_your_licenses_file> List of licenses, the first one will replace the ones that follow (in case present) or simply added at the top.
  • <path_to_directory_with_python_files> List of arguments representing paths to the directories containing python files.

Examples

Given the following directory hierarchy:

license_manager.py
|-src\
    |-__init__.py
    |-main.py
    |-utils.py
|-test\
    |-__init__.py
    |-test_main.py
    |-test_utils.py
|-setup.py
|-my_license.txt
|-my_newer_license.txt
  1. The following command will update the license for src\main.py and src\utils.py:
python license_manager.py -l my_license.txt -d src
  1. Whereas executing the following command will result in updating the license header for src\main.py, src\utils.py, test\test_main.py and test\test_utils.py:
python license_manager.py -l my_license.txt -d src test
  1. Last, if we want to replace an existing license header with a new one, we would do the following command:
python license_manager.py -l {NEW_LICENSE} {OLD_LICENSE} -d src

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

pylicup-0.2.0.tar.gz (25.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylicup-0.2.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file pylicup-0.2.0.tar.gz.

File metadata

  • Download URL: pylicup-0.2.0.tar.gz
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for pylicup-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5f5ede0bfa57b3671241739163c296bb835cce21ae8de14ac65046fce7a347d2
MD5 0be5fc28a72ad50b7166f601acddbfd3
BLAKE2b-256 ad3fe3b00b86f49867d94140c2ad2dba8c7fca859dc507a0767a69f198aebca9

See more details on using hashes here.

File details

Details for the file pylicup-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pylicup-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for pylicup-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30e4762f4ca6a76627c50aeb8fbf1107cb46f9883eab4a7ba44e589d89187542
MD5 cdd3cf5c01a51ff90a9d4bc38f03d8c5
BLAKE2b-256 cafb47edbf231b0d806f50cb9e83463c8fe8296718b7197a4db9c7cd9d764943

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page