How do I resolve the PAT error "name 'Optional' is not defined"?
Last updated: September 3, 2024
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-toolandpanther-analysis. If not, please upgrade and try merging again.Make sure you are using a recent version of Python, as
Optionalwas added relatively recently. If you’re usingpipenv, it should manage the update for you.Run
make installfrom thepanther-analysisroot to obtain the correctpanther-analysis-tooldependency.
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.