Check if files have a proper copyright header.
Project description
Copycheck
Copyright 2016 Janus Friis Nielsen.
This file is part of copycheck.
Introduction
Copycheck inspects the beginning of all files reports any file without a copyright header.
The recognition of copyright headers is very rudimentary. Copycheck scans the 10 first lines for occurrences of the word “copyright” in any casing.
Installation
copycheck is available for install through PyPI:
.. code-block:: bash
$ pip install copycheck
copycheck can also be installed from source with:
python setup.py install
Usage
The tool will show a description of usage when given the –help option:
$ copycheck --help
usage: copycheck [-h] [-v] [--debug DEBUG] {check} ...
Check source files for missing copyright headers
positional arguments:
{check} sub-commands
check check for missing copyright headers
optional arguments:
-h, --help show this help message and exit
-v, --verbose Enable verbose output
--debug DEBUG Enable debug output
Check all files in a directory
$ copycheck check path/to/directory
Check all files in a number of directories
$ copycheck check path/to/directory path/to/another/directory /and/so/on/..
Ignore files
You can put a files called .copycheckignore in the base directory of your project.
The syntax of the files is Git wildmatch. The same as used in .gitignore.
Get files sorted
$ copycheck check path/to/directory | sort
Add copyright header
Add copyright header to all Python files available from current directory”
$ copycheck check . | sort | grep "\.py" | xargs -L1 sed -i '' '1i\
# Copyright 2016 (c) Janus Friis Nielsen, all rights reserved. \
\
'
License
copycheck is licensed under the Mozilla Public License Version 2.0. See LICENSE or the FAQ for more information.
In summary, you may use copycheck with any closed or open source project without affecting the license of the larger work so long as you:
give credit where credit is due,
and release any custom changes made to copycheck.
Source
The source code for copycheck is available from the GitHub repo janusdn/copycheck.
Contributing
When contributing changes remember to update the CHANGELOG.rst.
Building copycheck
Make sure you have a Python 3.5 environment with the requirements.
E.g. use pyenv:
$ pyenv virtualenv 3.5.0 copycheck-venv
$ pyenv activate copycheck-venv
Make sure pip is up-to-date:
$ pip install --upgrade pip
Install requirements:
$ pip install --upgrade -r requirements.txt
Build the wheel:
$ make
Development
Use the following command to install the package in the local environment during development.
$ pip install -e .
This allows you to change the code and test copycheck directly.
Releasing
Do the following to release a new version:
Commit changes
Push changes
Merge with master
Update local master
Find the next release version, e.g. 6.6.6
Create new branch with name core/release-6.6.6
Bump version in __about__.py
Run ./release.sh 6.6.6
Upload to Pypi
First, perform a test upload to verify everything is nice and dandy. Then perform the real upload.
Make sure the following environment variables have been properly defined:
$ export PYPI_TEST_USERNAME="<username>"
$ export PYPI_TEST_PASSWORD="<your_test_password>"
$ export PYPI_USERNAME="<your_password>"
$ export PYPI_PASSWORD="<username>"
Test upload to pypi
You may need to register on the Pypi test server. This can be done here:
$ https://testpypi.python.org/pypi
Register:
$ twine register -u ${PYPI_TEST_USERNAME} -p ${PYPI_TEST_PASSWORD} -r https://testpypi.python.org/pypi dist/Copycheck-6.6.6-py3-none-any.whl
Upload
$ twine upload -u ${PYPI_TEST_USERNAME} -p ${PYPI_TEST_PASSWORD} -r https://testpypi.python.org/pypi dist/Copycheck-6.6.6-py3-none-any.whl
Goto:
$ https://testpypi.python.org/pypi/Copycheck/6.6.6
An check that everything looks nice.
You can check the HTML by running:
$ python setup.py --long-description | rst2html.py --no-raw > output.html
Test if it installs (do it in a different environment):
$ pip install -i https://testpypi.python.org/pypi copycheck
Real upload to Pypi
Upload
$ twine upload -u ${PYPI_USERNAME} -p ${PYPI_PASSWORD} -r https://pypi.python.org/pypi dist/copycheck-6.6.6-py3-none-any.whl
Goto:
$ https://pypi.python.org/pypi/copycheck/6.6.6
And check that everything looks nice.
Thanks
A bug thank you goes to the author of the pathspec package. Using pathspec made it a lot easier to build this tool.
Change Log
All notable changes to the copycheck tool will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
See http://keepachangelog.com for information on how to update this file.
[Unreleased]
[1.0.1]
Fixed
Typos and formatting in README
[1.0.1]
Added
Initial version
[1.0.0]
Added
Initial version
Changed
No changes
Deprecated
No changes
Removed
No changes
Fixed
No changes
Security
No changes
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for copycheck-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c95d94b2347e1e2b643f5d76fa68ca55194e5a869076f30e3d6584c0f28082ba |
|
MD5 | 81938abfd04400ee659e04b5914d3fd0 |
|
BLAKE2b-256 | 6e31ac1cf793335d70cf722da89fbb5952a8aa67a9c38f545642a9b50a37bf89 |