licensepy


Namelicensepy JSON
Version 1.1.2 PyPI version JSON
download
home_pageNone
SummaryA Rust CLI packaged for Python project dependency license check and license header formatting.
upload_time2025-08-21 03:19:55
maintainerNathnael (Nati) Bekele
docs_urlNone
authorNone
requires_pythonNone
licenseNone
keywords license license header license header formatter license check project dependency
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # licensepy
## Python Depedency License Check and License Header Formating.

**_licensepy_** is a Python dependency license check and license header check/format library written in Rust. This package has recursive dependency checks that are not offered by many existing license check libraries. By default, the output will group packages by their licenses.

<!--![](https://raw.githubusercontent.com/natibek/licensepy/main/imgs/licensepy_output.png)-->

Configure the tool with a _pyproject.toml_ file at the root directory of the project with a list of licenses to avoid. If dependencies of the project are found to use these flagged licenses, **licensepy** will exit with the count of these projects. Otherwise, it will exit with code 0. For the license header formatter, the exit code will be the count of the source code files with incorrect header.

## Installing

Use pip to install **licensepy** in your project.

```bash
$ pip3 install licensepy
```

## Command Line Arguments

### Dependency license check
For the dependency license check, the following are the command line arguments.

```bash
$ licensepy check
```
1. -r, --recursive: Recursively find all the dependencies of the project and their licences.
   <!--![](https://raw.githubusercontent.com/natibek/licensepy/main/imgs/licensepy_recursive.png)-->
   - Recursive dependencies will have the color red if they have licenses that have been flagged to avoid and green otherwise.
     <!--![](https://raw.githubusercontent.com/natibek/licensepy/main/imgs/licensepy_recursive_avoid_mit.png)-->
1. -by-package: Group output by packages in alphabetical order.
   <!--![](https://raw.githubusercontent.com/natibek/licensepy/main/imgs/licensepy_output_by_package.png)-->
1. -s, silent: Silence all outputs.
1. -f, print-fails: Only print the packages whose licenses are flagged to be avoided.
1. -j, --num-threads: Number of threads to use. Default is 1. Max is 32 [default: 1].

### License header checker and formatter

For the license
```bash
$ licensepy format
```

1. files: Positional arguments are the Python files to run license header checker/formatter.
1. -l, --licensee: Licensee. Has precedence over value from config.
1. -y, --license-year: License year. Has precedence over value from config.
1. -s, --silent: Don't print any outputs. Default if false.
1. -d, --dry-run: Don't run formatter. Only print outputs. Default if false.
1. -j, --num-threads: Number of threads to use. Default is 1. Max is 32 [default: 1].

## Configuration

Licenses can be flagged to avoid in a pyproject.toml files saved in the root of the project directory. Licenses should be stored in a list.

```toml
# In the pyproject.toml file

[tool.licensepy]
# List of licenses to avoid.
avoid = ["MIT"]

# header template: The template for the license header. {year}, {licensee}
# are placeholders that will be populated with values from command line
# or the config. The template can have the # at the beginning or not.
license_header_template = "# Copyright {year} {licensee}"

# license_year: The value to replace the {year} in the license_header_template.
# Default value is the current year.
license_year = 2025

# licensee: The value to replace the {licensee} in the license_header_template.
# If the {licensee} placeholder is found in the template and the licensee field
# or the command line argument are
licensee = "Nati"
```

This is the output when the above configuration is used for:

```bash
$ licensepy check
```

![](https://raw.githubusercontent.com/natibek/licensepy/main/imgs/licensepy_avoid_mit.png)

```bash
$ licensepy check --by-package
```

![](https://raw.githubusercontent.com/natibek/licensepy/main/imgs/licensepy_by_package_avoid_MIT.png)


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "licensepy",
    "maintainer": "Nathnael (Nati) Bekele",
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "license, license header, license header formatter, license check, project dependency",
    "author": null,
    "author_email": "Nathnael Bekele <nwtbekele@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/d3/7b/cf0f548f0f495e821d53352723eebac93055b363102cd2ff62eab7914a28/licensepy-1.1.2.tar.gz",
    "platform": null,
    "description": "# licensepy\n## Python Depedency License Check and License Header Formating.\n\n**_licensepy_** is a Python dependency license check and license header check/format library written in Rust. This package has recursive dependency checks that are not offered by many existing license check libraries. By default, the output will group packages by their licenses.\n\n<!--![](https://raw.githubusercontent.com/natibek/licensepy/main/imgs/licensepy_output.png)-->\n\nConfigure the tool with a _pyproject.toml_ file at the root directory of the project with a list of licenses to avoid. If dependencies of the project are found to use these flagged licenses, **licensepy** will exit with the count of these projects. Otherwise, it will exit with code 0. For the license header formatter, the exit code will be the count of the source code files with incorrect header.\n\n## Installing\n\nUse pip to install **licensepy** in your project.\n\n```bash\n$ pip3 install licensepy\n```\n\n## Command Line Arguments\n\n### Dependency license check\nFor the dependency license check, the following are the command line arguments.\n\n```bash\n$ licensepy check\n```\n1. -r, --recursive: Recursively find all the dependencies of the project and their licences.\n   <!--![](https://raw.githubusercontent.com/natibek/licensepy/main/imgs/licensepy_recursive.png)-->\n   - Recursive dependencies will have the color red if they have licenses that have been flagged to avoid and green otherwise.\n     <!--![](https://raw.githubusercontent.com/natibek/licensepy/main/imgs/licensepy_recursive_avoid_mit.png)-->\n1. -by-package: Group output by packages in alphabetical order.\n   <!--![](https://raw.githubusercontent.com/natibek/licensepy/main/imgs/licensepy_output_by_package.png)-->\n1. -s, silent: Silence all outputs.\n1. -f, print-fails: Only print the packages whose licenses are flagged to be avoided.\n1. -j, --num-threads: Number of threads to use. Default is 1. Max is 32 [default: 1].\n\n### License header checker and formatter\n\nFor the license\n```bash\n$ licensepy format\n```\n\n1. files: Positional arguments are the Python files to run license header checker/formatter.\n1. -l, --licensee: Licensee. Has precedence over value from config.\n1. -y, --license-year: License year. Has precedence over value from config.\n1. -s, --silent: Don't print any outputs. Default if false.\n1. -d, --dry-run: Don't run formatter. Only print outputs. Default if false.\n1. -j, --num-threads: Number of threads to use. Default is 1. Max is 32 [default: 1].\n\n## Configuration\n\nLicenses can be flagged to avoid in a pyproject.toml files saved in the root of the project directory. Licenses should be stored in a list.\n\n```toml\n# In the pyproject.toml file\n\n[tool.licensepy]\n# List of licenses to avoid.\navoid = [\"MIT\"]\n\n# header template: The template for the license header. {year}, {licensee}\n# are placeholders that will be populated with values from command line\n# or the config. The template can have the # at the beginning or not.\nlicense_header_template = \"# Copyright {year} {licensee}\"\n\n# license_year: The value to replace the {year} in the license_header_template.\n# Default value is the current year.\nlicense_year = 2025\n\n# licensee: The value to replace the {licensee} in the license_header_template.\n# If the {licensee} placeholder is found in the template and the licensee field\n# or the command line argument are\nlicensee = \"Nati\"\n```\n\nThis is the output when the above configuration is used for:\n\n```bash\n$ licensepy check\n```\n\n![](https://raw.githubusercontent.com/natibek/licensepy/main/imgs/licensepy_avoid_mit.png)\n\n```bash\n$ licensepy check --by-package\n```\n\n![](https://raw.githubusercontent.com/natibek/licensepy/main/imgs/licensepy_by_package_avoid_MIT.png)\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Rust CLI packaged for Python project dependency license check and license header formatting.",
    "version": "1.1.2",
    "project_urls": {
        "Changelog": "https://github.com/natibek/licensepy/blob/main/CHANGELOG",
        "Homepage": "https://github.com/natibek/licensepy",
        "Issues": "https://github.com/natibek/licensepy/issues",
        "Readme": "https://github.com/natibek/licensepy/blob/main/README.md",
        "Repository": "https://github.com/natibek/licensepy"
    },
    "split_keywords": [
        "license",
        " license header",
        " license header formatter",
        " license check",
        " project dependency"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0e7222223ccde97b87a16069a18bc9733755e3239473a592e657fabfdd351c03",
                "md5": "509f8cddf0c42124e12936b7de58086c",
                "sha256": "7b3f812eb2598d0f053cdf88edbd8190fbe721cd447ba1ea8dd5564029c99f4d"
            },
            "downloads": -1,
            "filename": "licensepy-1.1.2-cp312-cp312-manylinux_2_39_x86_64.whl",
            "has_sig": false,
            "md5_digest": "509f8cddf0c42124e12936b7de58086c",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": null,
            "size": 1313079,
            "upload_time": "2025-08-21T03:19:53",
            "upload_time_iso_8601": "2025-08-21T03:19:53.332301Z",
            "url": "https://files.pythonhosted.org/packages/0e/72/22223ccde97b87a16069a18bc9733755e3239473a592e657fabfdd351c03/licensepy-1.1.2-cp312-cp312-manylinux_2_39_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d37bcf0f548f0f495e821d53352723eebac93055b363102cd2ff62eab7914a28",
                "md5": "18e443c9a0fe890f7ef7d550f88fc6e6",
                "sha256": "dde7f1eeea1544efb25539a3ab9b4d92a7fb5c6172ada906d07f7a00bc88a53e"
            },
            "downloads": -1,
            "filename": "licensepy-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "18e443c9a0fe890f7ef7d550f88fc6e6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 397338,
            "upload_time": "2025-08-21T03:19:55",
            "upload_time_iso_8601": "2025-08-21T03:19:55.321383Z",
            "url": "https://files.pythonhosted.org/packages/d3/7b/cf0f548f0f495e821d53352723eebac93055b363102cd2ff62eab7914a28/licensepy-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-21 03:19:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "natibek",
    "github_project": "licensepy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "licensepy"
}
        
Elapsed time: 1.98444s