-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Visualization methods called from command line installation #222
Comments
I'm a little confused as well, this seems to match the behavior when running in a jupyter notebook without the visualization dependencies installed, but not purely on the command line. Maybe the Mac command line automatically tries to render objects with these methods present? I suppose we could raise a warning and then the functions will be a noop if these dependencies aren't present? I'm not really sure what other libraries do. @caleb531 any thoughts about this behavior? |
@irisdyoung @eliotwrobson I'm not sure I understand the issue here. I # example1.py
from automata.fa.dfa import DFA
# DFA which matches all binary strings ending in an odd number of '1's
my_dfa = DFA(
states={'q0', 'q1', 'q2'},
input_symbols={'0', '1'},
transitions={
'q0': {'0': 'q0', '1': 'q1'},
'q1': {'0': 'q0', '1': 'q2'},
'q2': {'0': 'q2', '1': 'q1'}
},
initial_state='q0',
final_states={'q1'}
)
try:
while True:
if my_dfa.accepts_input(input('Please enter your input: ')):
print('Accepted')
else:
print('Rejected')
except KeyboardInterrupt:
print('') |
linking this to our review - friends can you please link any issues / pr's related to the review back to the review issue so we have a traceable review? many many thanks!! these issues and discussion are fantastic! |
@caleb531 I realize we haven't really come to a conclusion here, but should we close this as not planned and reopen if this comes up again? Neither of us was able to reproduce this issue, and nobody else has reported it, so I'm not sure we can really do anything at this point. |
@eliotwrobson Agreed to close as not planned—we can always reopen if need be. |
Examining the object
my_dfa
from the first example directly (nostr
ordir
or anything else) throws an error in the command line only installation (latest, on python 3.12.3, on mac):ImportError: Missing visualization packages; please install coloraide and pygraphviz.
Is this for sure what you want? It also does return the
str
representation afterward, so it seems like the error could be downgraded to a warning that you're operating without visualization capabilities, and a pointer to the installation option with the necessary dependencies. Separate issue incoming on that note...The text was updated successfully, but these errors were encountered: