wads.licensing¶
Licensing
Functions
|
|
get_licenses_json_from_github You need to have a github token placed in the right place for this! See pygithub for details. |
|
|
|
|
|
|
|
|
Resolve the author name following a priority chain. |
|
Replace placeholders in license text with actual values. |
- wads.licensing.get_licenses_from_github()[source]¶
get_licenses_json_from_github You need to have a github token placed in the right place for this! See pygithub for details.
license_jsons = get_licenses_json_from_github()
- wads.licensing.resolve_author(author=None, pyproject_authors=None, url=None)[source]¶
Resolve the author name following a priority chain.
Priority order:
If author is explicitly provided, use it
If pyproject_authors is provided, use the first author’s name
If url is a GitHub URL, extract the org/user from it
If WADS_DFLT_AUTHOR env variable is set, use it
Return placeholder if nothing else works
- Parameters:
- Return type:
- Returns:
Resolved author name or placeholder
>>> resolve_author(author='John Doe') 'John Doe' >>> resolve_author(pyproject_authors=[{'name': 'Jane Smith'}]) 'Jane Smith' >>> resolve_author(url='https://github.com/myorg/myrepo') 'myorg'
- wads.licensing.substitute_license_placeholders(license_text, author=None, year=None)[source]¶
Replace placeholders in license text with actual values.
Common placeholders:
[yyyy], [year] -> current year
[fullname], [name of copyright owner] -> author name
-> © (optional enhancement)
- Parameters:
- Return type:
- Returns:
License text with substituted values
>>> text = "Copyright [yyyy] [fullname]" >>> result = substitute_license_placeholders(text, author='John', year=2025) >>> result 'Copyright 2025 John'