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

Fix Altair import in tools scripts #2872

Merged
merged 3 commits into from
Feb 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions tools/generate_schema_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@

import m2r

# import schemapi from here
sys.path.insert(0, abspath(dirname(__file__)))

# Add path so that schemapi can be imported from the tools folder
current_dir = dirname(__file__)
sys.path.insert(0, abspath(current_dir))
# And another path so that Altair can be imported from head. This is relevant when
# generate_api_docs is imported in the main function
sys.path.insert(0, abspath(join(current_dir, "..")))
from schemapi import codegen # noqa: E402
from schemapi.codegen import CodeSnippet # noqa: E402
from schemapi.utils import ( # noqa: E402
Expand All @@ -22,7 +27,6 @@
indent_arglist,
resolve_references,
)
import generate_api_docs # noqa: E402

# Map of version name to github branch name.
SCHEMA_VERSION = {
Expand Down Expand Up @@ -627,6 +631,10 @@ def main():
copy_schemapi_util()
vegalite_main(args.skip_download)

# Altair is imported after the generation of the new schema files so that
# the API docs reflect the newest changes
import generate_api_docs # noqa: E402

generate_api_docs.write_api_file()


Expand Down