andreas-stuerz / opn-cli

CLI for OPNsense Firewall using API Requests
BSD 2-Clause "Simplified" License
45 stars 8 forks source link

add missing dependency: dataclasses #40

Closed fraenki closed 1 year ago

fraenki commented 1 year ago

When running the most recent version of opn-cli, the following error message is shown:

$ opn-cli openvpn download 1 1234567890 --hostname vpn.example.com --output json 
Traceback (most recent call last):
  File "/usr/local/bin/opn-cli", line 7, in <module>
    from opnsense_cli.cli import cli
  File "/usr/local/lib/python3.6/site-packages/opnsense_cli/cli.py", line 8, in <module>
    from opnsense_cli.commands.new.api import api as new_api
  File "/usr/local/lib/python3.6/site-packages/opnsense_cli/commands/new/api.py", line 4, in <module>
    from opnsense_cli.facades.code_generator.api import ApiCodeGenerator
  File "/usr/local/lib/python3.6/site-packages/opnsense_cli/facades/code_generator/api.py", line 2, in <module>
    from opnsense_cli.facades.template_engines.base import TemplateEngine
  File "/usr/local/lib/python3.6/site-packages/opnsense_cli/facades/template_engines/base.py", line 2, in <module>
    from dataclasses import dataclass
ModuleNotFoundError: No module named 'dataclasses'

It looks like opn-cli recently introduced a new dependency, that is not specified in the Python package list. After manually installing the dataclasses PIP the error was gone.

(FWIW, I'm preparing another PR, so maybe wait until my 2nd PR before issueing a new release.)

codecov[bot] commented 1 year ago

Codecov Report

Base: 99.92% // Head: 99.92% // No change to project coverage :thumbsup:

Coverage data is based on head (bfda0fb) compared to base (a28c4e4). Patch has no changes to coverable lines.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #40 +/- ## ======================================= Coverage 99.92% 99.92% ======================================= Files 169 169 Lines 6916 6916 ======================================= Hits 6911 6911 Misses 5 5 ``` Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Andreas+St%C3%BCrz). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Andreas+St%C3%BCrz)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

andreas-stuerz commented 1 year ago

Hi Fraenki, Dataclasses are included in Python 3.7. Please Upgrade your Installation or install the dependency manually.

Min. python version for opn-cli is 3.7.

fraenki commented 1 year ago

Oh, that's a pity. :(

Could this requirement be documented somewhere? Maybe in the changelog, or is there a "Python way" to document this...?

andreas-stuerz commented 1 year ago

Good Point.

I will create an issue for that.

thx 😊