pylic icon indicating copy to clipboard operation
pylic copied to clipboard

Either allow `check` without pyproject.toml file or give a nicer error

Open ubersan opened this issue 3 years ago • 0 comments

It might be ok to let people run the check command without needing to create a pyproject.toml. Then the check will just always fail. Then it would probably be best to also add a warning.

Else, currently there is the error printed

root@568b0a5e39fd:/# pylic check

  FileNotFoundError

  [Errno 2] No such file or directory: 'pyproject.toml'

  at /usr/local/lib/python3.8/dist-packages/pylic/toml.py:20 in _read_pyproject_file
      16│     return (safe_licenses, unsafe_packages)
      17│ 
      18│ 
      19│ def _read_pyproject_file(filename: str) -> MutableMapping[str, Any]:
    → 20│     with open(filename, "r") as pyproject_file:
      21│         try:
      22│             return toml.load(pyproject_file)
      23│         except Exception as exception:
      24│             raise exception

It might be nicer to have something like

root@568b0a5e39fd:/# pylic check

  FileNotFoundError: Please create a pyproject.toml file.

ubersan avatar Nov 03 '21 23:11 ubersan