mandiant / capa

The FLARE team's open-source tool to identify capabilities in executable files.
Apache License 2.0
3.98k stars 499 forks source link

fix black and mypy #2146

Closed mr-tz closed 2 weeks ago

mr-tz commented 3 weeks ago

closes #2145

WIP

Checklist

mr-tz commented 3 weeks ago

only need to fix deptry:

scripts/capa2sarif.py:37:5: DEP001 'sarif_om' imported but missing from the dependency definitions
scripts/capa2sarif.py:46:5: DEP001 'jschema_to_python' imported but missing from the dependency definitions
Found 2 dependency issues.

@s-ff how do you recommend to handle these, add these to exclusions or elsewhere?

s-ff commented 3 weeks ago

only need to fix deptry:

scripts/capa2sarif.py:37:5: DEP001 'sarif_om' imported but missing from the dependency definitions
scripts/capa2sarif.py:46:5: DEP001 'jschema_to_python' imported but missing from the dependency definitions
Found 2 dependency issues.

@s-ff how do you recommend to handle these, add these to exclusions or elsewhere?

I believe we should not exlcude these, but instead introduce them as part of dev optional dependencies in pyproject.toml.

williballenthin commented 3 weeks ago

rather than dev let's introduce a new profile scripts, since this tool is meant to be invoked by end users.

mr-tz commented 3 weeks ago

not sure, I love the new scripts and updated install mechanism...

s-ff commented 3 weeks ago

This would require a documentation update as well, to inform users who want to use scripts

williballenthin commented 3 weeks ago

I agree, I don't want to add more steps for users. But the above profile can help with deptry checks.

The new script has an import guard, such that when a required dependency is not found, it explains to the user what to do. Given that we have so many scripts with different setups, maybe this is a reasonable pattern? Then the scripts profile would only be to satisfy deptry.

williballenthin commented 3 weeks ago

I'm definitely open to alternatives and further discussions.