How do I resolve the PAT error "name 'Optional' is not defined"?
Issue
When trying to merge our repo with Panther upstream, the following error occurs with my PAT tests:
name 'Optional' is not defined
Resolution
To resolve this issue:
- Verify that you are using the most current versions of
panther-analysis-tool
andpanther-analysis
. If not, please upgrade and try merging again. - Make sure you are using a recent version of Python, as
Optional
was added relatively recently. If you’re usingpipenv
, it should manage the update for you. - Run
make install
from thepanther-analysis
root to obtain the correctpanther-analysis-tool
dependency.
Cause
This Python error occurs when from typing import Optional
is not set correctly. Running the make install
command ensures that you incorporate any new dependencies we've added, such as detection helpers.