Skip to content

Commit

Permalink
Use Burocrata to check/add license notices
Browse files Browse the repository at this point in the history
Replace our custom script in `tools` with Burocrata. Simply the Makefile
and the Actions checks and add the license notice configuration to
pyproject.toml.
  • Loading branch information
leouieda committed Mar 1, 2024
1 parent 05b169c commit bcba325
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 118 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: python -m pip freeze

- name: Check code format
run: make black-check isort-check license-check
run: make check-format

style:
runs-on: ubuntu-latest
Expand All @@ -58,4 +58,4 @@ jobs:
run: python -m pip freeze

- name: Check code style
run: make flake8
run: make check-style
28 changes: 9 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
PROJECT=verde
TESTDIR=tmp-test-dir-with-unique-name
PYTEST_ARGS=--cov-config=../.coveragerc --cov-report=term-missing --cov=$(PROJECT) --doctest-modules -v --pyargs
CHECK_STYLE=$(PROJECT) doc tools
CHECK_STYLE=$(PROJECT) doc

help:
@echo "Commands:"
Expand All @@ -28,29 +28,19 @@ test:
cp $(TESTDIR)/.coverage* .
rm -rvf $(TESTDIR)

format: license isort black

check: black-check isort-check license-check flake8

black:
format:
isort $(CHECK_STYLE)
black $(CHECK_STYLE)
burocrata --extension=py $(PROJECT)

black-check:
black --check $(CHECK_STYLE)

license:
python tools/license_notice.py
check: check-format check-style

license-check:
python tools/license_notice.py --check

isort:
isort $(CHECK_STYLE)

isort-check:
check-format:
black --check $(CHECK_STYLE)
isort --check $(CHECK_STYLE)
burocrata --check --extension=py $(PROJECT)

flake8:
check-style:
flake8 $(CHECK_STYLE)

clean:
Expand Down
1 change: 1 addition & 0 deletions env/requirements-style.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ flake8-rst-docstrings
flake8-simplify
flake8-unused-arguments
pep8-naming
burocrata
5 changes: 2 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ dependencies:
- flake8-mutable
- flake8-rst-docstrings
- flake8-simplify
- flake8-unused-arguments
- pep8-naming
- pip:
# Install flake8-unused-arguments through pip
# (not available through conda yet)
- flake8-unused-arguments
- burocrata
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,12 @@ write_to = "verde/_version_generated.py"
[tool.isort]
profile = "black"
multi_line_output = 3

[tool.burocrata]
notice = '''
# Copyright (c) 2017 The Verde Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
#
# This code is part of the Fatiando a Terra project (https://www.fatiando.org)
#'''
94 changes: 0 additions & 94 deletions tools/license_notice.py

This file was deleted.

0 comments on commit bcba325

Please sign in to comment.