{"id":21524,"library":"license-header-check","title":"License Header Check","description":"A Python tool to check that source files have a license header. It scans files for a given regex pattern and reports files missing the header. Current version 0.2.1, released irregularly.","status":"active","version":"0.2.1","language":"python","source_language":"en","source_url":"https://github.com/TobiasSchaffner/license_header_check","tags":["license","header","checker","compliance"],"install":[{"cmd":"pip install license-header-check","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Hyphen in package name becomes underscore in module.","wrong":"from license-header-check import LicenseHeaderCheck","symbol":"LicenseHeaderCheck","correct":"from license_header_check import LicenseHeaderCheck"}],"quickstart":{"code":"from license_header_check import LicenseHeaderCheck\nchecker = LicenseHeaderCheck('.', patterns=['\\.py$'], comment='#')\nmissing = checker.check(headers=['# SPDX-License-Identifier: MIT'])\nprint('Missing headers in:', missing)","lang":"python","description":"Create a checker instance, run check on current directory for Python files, ensuring they contain the SPDX MIT header."},"warnings":[{"fix":"Use `if len(missing) > 0:` or `if missing:`.","message":"The `check` method returns a list of file paths missing the header, not a boolean. Do not use `if checker.check(...):` expecting True/False.","severity":"gotcha","affected_versions":"all"},{"fix":"Wrap in list: `headers=['# License ...']`.","message":"The `headers` parameter must be a list of strings. Passing a single string will iterate over characters.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `checker.check(headers=...)` instead of `checker(...)`.","cause":"Trying to call the string instead of the checker object, e.g., `checker = LicenseHeaderCheck(...)` then `checker('...')`.","error":"TypeError: 'str' object is not callable"},{"fix":"Use `import license_header_check` or `from license_header_check import ...`.","cause":"Trying to import with hyphens, but Python modules use underscores.","error":"ModuleNotFoundError: No module named 'license-header-check'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}