Skip to content

Commit

Permalink
Preparation for PyPI release (#25)
Browse files Browse the repository at this point in the history
* metadata by pyproject.toml
* no ref to the bin file any more
* proper handling of missing args
* updating linter call list
* coverage seems to be broken
Signed-off-by: Christian Henkel <[email protected]>
  • Loading branch information
ct2034 committed Jul 18, 2023
1 parent 6dd3722 commit 730fdcc
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 110 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
run: pip install .
- uses: ricardochaves/[email protected]
with:
python-root-list: "src/ test/ bin/ros_license_toolkit setup.py"
python-root-list: "src/ test/"
use-pylint: false
use-pycodestyle: true
use-flake8: true
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ jobs:
run: pip install .
- uses: pavelzw/pytest-action@v2
with:
custom-arguments: "--cov=src/ros_license_toolkit --cov-report=xml"
custom-arguments: "--cov=src/ros_license_toolkit"
emoji: true
verbose: true
job-summary: true
- uses: orgoro/coverage@v3
with:
coverageFile: "coverage.xml"
token: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'pull_request'
# - uses: orgoro/coverage@v3
# with:
# coverageFile: "coverage.xml"
# token: ${{ secrets.GITHUB_TOKEN }}
# if: github.event_name == 'pull_request'
# - uses: MishaKav/pytest-coverage-comment@main
# with:
# pytest-xml-coverage-path: "coverage.xml"
42 changes: 0 additions & 42 deletions bin/ros_license_toolkit

This file was deleted.

43 changes: 43 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[build-system]
requires = ["setuptools>=61.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "ros_license_toolkit"
version = "1.0.0"
description = "Checks ROS packages for correct license declaration."
readme = "README.md"
authors = [
{name = "Christian Henkel", email = "[email protected]"},
]
license = {file = "LICENSE"}
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Framework :: Robot Framework :: Tool",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Software Development :: Libraries :: Python Modules",
]
keywords = ["ros", "license", "toolkit", "oss", "packages"]
dependencies = [
"gitpython",
"rospkg",
# TODO v32 changes things, see
# https://github.com/nexB/scancode-toolkit/blob/develop/
# CHANGELOG.rst#v3200---2023-05-23
"scancode-toolkit<=31.2.6",
"spdx-tools"
]
requires-python = ">=3.7"

[project.urls]
homepage = "https://github.com/boschresearch/ros_license_toolkit"
repository = "https://github.com/boschresearch/ros_license_toolkit"

[project.scripts]
ros_license_toolkit = "ros_license_toolkit.main:main"
54 changes: 0 additions & 54 deletions setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions src/ros_license_toolkit/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import os
import sys
import timeit
from typing import Sequence
from typing import Optional, Sequence

from ros_license_toolkit.checks import LicensesInCodeCheck
from ros_license_toolkit.checks import LicenseTagExistsCheck
Expand All @@ -39,7 +39,7 @@
from ros_license_toolkit.ui_elements import Verbosity


def main(args: Sequence[str]) -> int:
def main(args: Optional[Sequence[str]] = None) -> int:
"""Main entry point for the ros_license_toolkit CLI.
:param args: the command line arguments, defaults to sys.argv[1:]
Expand Down
2 changes: 1 addition & 1 deletion test/systemtest/test_all_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_all(self):
Check that the output contains all package names.
"""
with subprocess.Popen(
["bin/ros_license_toolkit", "test/_test_data"],
["ros_license_toolkit", "test/_test_data"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
) as process:
Expand Down
2 changes: 1 addition & 1 deletion test/systemtest/test_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TestDocumentation(unittest.TestCase):
def test_readme(self):
"""Check if the help text is up to date."""
with subprocess.Popen(
["bin/ros_license_toolkit", "-h"],
["ros_license_toolkit", "-h"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
) as process:
Expand Down
2 changes: 1 addition & 1 deletion test/systemtest/test_license_per_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def _test_repo(self, repo_name, pkg_names, license_name):
make_repo(repo_path)
# test
with subprocess.Popen(
["bin/ros_license_toolkit", repo_path],
["ros_license_toolkit", repo_path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
) as process:
Expand Down
4 changes: 2 additions & 2 deletions test/systemtest/test_separate_pkgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_deep_package_folder(self):
"test/_test_data/test_deep_package_folder/deeper/test_pkg_deep"
]:
with subprocess.Popen(
["bin/ros_license_toolkit", call_path],
["ros_license_toolkit", call_path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
) as process:
Expand Down Expand Up @@ -105,7 +105,7 @@ def test_pkg_unknown_license(self):
package.xml."""
# using subprocess.Popen instead of main() to capture stdout
with subprocess.Popen(
["bin/ros_license_toolkit",
["ros_license_toolkit",
"test/_test_data/test_pkg_unknown_license"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
Expand Down

0 comments on commit 730fdcc

Please sign in to comment.