Skip to content

Commit

Permalink
Use Burocrata to check/add license notices (#23)
Browse files Browse the repository at this point in the history
Add the check and format rules to the Makefile and use the tool to
update the copyright notice to Dependente Developers instead of me
personally.
  • Loading branch information
leouieda authored Mar 1, 2024
1 parent 65cbc9e commit 17c9876
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ test:
format:
isort $(CHECK_STYLE)
black $(CHECK_STYLE)
burocrata --extension=py $(CHECK_STYLE)

check: check-format check-style

Expand All @@ -40,6 +41,7 @@ check-style:
check-format:
isort --check $(CHECK_STYLE)
black --check $(CHECK_STYLE)
burocrata --check --extension=py $(CHECK_STYLE)

clean:
find . -name "*.pyc" -exec rm -v {} \;
Expand Down
4 changes: 3 additions & 1 deletion dependente/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Copyright (c) 2021 Leonardo Uieda.
# Copyright (c) 2021 The Dependente Developers.
# Distributed under the terms of the MIT License.
# SPDX-License-Identifier: MIT
# This code is part of the Fatiando a Terra project (https://www.fatiando.org).
"""
Dependente: Extract Python package dependencies from configuration files.
The _version module is generated automatically by setuptools_scm at build time.
"""

from . import _version

__version__ = f"v{_version.version}"
4 changes: 3 additions & 1 deletion dependente/cli.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Copyright (c) 2021 Leonardo Uieda.
# Copyright (c) 2021 The Dependente Developers.
# Distributed under the terms of the MIT License.
# SPDX-License-Identifier: MIT
# This code is part of the Fatiando a Terra project (https://www.fatiando.org).
"""
Defines the command line interface.
Uses click to define a CLI around the ``main`` function.
"""

import sys
import traceback
from pathlib import Path
Expand Down
3 changes: 2 additions & 1 deletion dependente/converters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2021 Leonardo Uieda.
# Copyright (c) 2021 The Dependente Developers.
# Distributed under the terms of the MIT License.
# SPDX-License-Identifier: MIT
# This code is part of the Fatiando a Terra project (https://www.fatiando.org).
"""
Functions for manipulating/converting dependency lists.
"""
Expand Down
4 changes: 3 additions & 1 deletion dependente/parsers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Copyright (c) 2021 Leonardo Uieda.
# Copyright (c) 2021 The Dependente Developers.
# Distributed under the terms of the MIT License.
# SPDX-License-Identifier: MIT
# This code is part of the Fatiando a Terra project (https://www.fatiando.org).
"""
Functions for extracting the dependency information from files.
"""

import configparser
from pathlib import Path

Expand Down
4 changes: 4 additions & 0 deletions dependente/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2021 The Dependente Developers.
# Distributed under the terms of the MIT License.
# SPDX-License-Identifier: MIT
# This code is part of the Fatiando a Terra project (https://www.fatiando.org).
4 changes: 3 additions & 1 deletion dependente/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Copyright (c) 2021 Leonardo Uieda.
# Copyright (c) 2021 The Dependente Developers.
# Distributed under the terms of the MIT License.
# SPDX-License-Identifier: MIT
# This code is part of the Fatiando a Terra project (https://www.fatiando.org).
"""
Fixtures for pytest
"""

from pathlib import Path

import pytest
Expand Down
4 changes: 4 additions & 0 deletions dependente/tests/test_cli_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright (c) 2021 The Dependente Developers.
# Distributed under the terms of the MIT License.
# SPDX-License-Identifier: MIT
# This code is part of the Fatiando a Terra project (https://www.fatiando.org).
"""
Test utility functions from cli.py
"""
Expand Down
4 changes: 3 additions & 1 deletion dependente/tests/test_converters.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Copyright (c) 2021 Leonardo Uieda.
# Copyright (c) 2021 The Dependente Developers.
# Distributed under the terms of the MIT License.
# SPDX-License-Identifier: MIT
# This code is part of the Fatiando a Terra project (https://www.fatiando.org).
"""
Test functions for converting/transforming dependencies.
"""

import pytest

from ..converters import pin_to_oldest
Expand Down
4 changes: 3 additions & 1 deletion dependente/tests/test_parsers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Copyright (c) 2021 Leonardo Uieda.
# Copyright (c) 2021 The Dependente Developers.
# Distributed under the terms of the MIT License.
# SPDX-License-Identifier: MIT
# This code is part of the Fatiando a Terra project (https://www.fatiando.org).
"""
Test the functions that extract content from configuration files.
The fixtures (arguments to the test functions) are defined in conftest.py
"""

import pytest

from ..parsers import ParserPyprojectToml, ParserSetupCfg, get_parser, validate_sources
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
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ dependencies:
- flake8-simplify
- flake8-unused-arguments
- pep8-naming
- pip:
- burocrata
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,10 @@ write_to = "dependente/_version.py"
[tool.isort]
profile = "black"
multi_line_output = 3

[tool.burocrata]
notice = '''
# Copyright (c) 2021 The Dependente Developers.
# Distributed under the terms of the MIT License.
# SPDX-License-Identifier: MIT
# This code is part of the Fatiando a Terra project (https://www.fatiando.org).'''

0 comments on commit 17c9876

Please sign in to comment.