Skip to content
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

Add forward compatibility with Altair 5 #230

Merged
merged 1 commit into from
Jan 21, 2023
Merged

Conversation

jonmmease
Copy link
Collaborator

Adds forward compatibility with Altair 5 (which is not yet released)

@jonmmease jonmmease merged commit c3faae5 into main Jan 21, 2023
Comment on lines +39 to +44
try:
# Altair 5
from altair.vegalite.v5 import SCHEMA_VERSION
except ImportError:
# Altair 4
from altair.vegalite.v4 import SCHEMA_VERSION
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonmmease You can get the current schema version by importing it from top-level altair directly:

from altair import SCHEMA_VERSION

This way, it's compatible with future versions of Altair without having to modify this part of the code.

Comment on lines +6 to +11
try:
# Altair 5 imports
from altair.vegalite.v5.api import Chart, FacetChart
except ImportError:
# Altair 4 imports
from altair.vegalite.v4.api import Chart, FacetChart
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonmmease Same here as described in the other comment:

from altair import Chart, FacetChart

@jonmmease
Copy link
Collaborator Author

Thanks for the comments @binste, that is much easier 👍

@jonmmease jonmmease mentioned this pull request Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants