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

Some tooling experiments #4

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ianthomas23
Copy link

This is trying out a few experiments on tooling, and adding a few more example schemas. It is based on top of #1 so ideally that would be merged and this rebased on top of main.

There is a kernel spec schema based on jupyter/enhancement-proposals#105 and a couple of kernel message schemas so that we have one schema reusing another, but I don't think I have the $ref between the two working yet. The schema names follow that outlined in #2.

There is some pytest testing that validates each of the schemas against the meta schema (2020-12 Draft) and also checks that the directory and schema names are consistent and so on. There is a simple sphinx build (pip install .; cd docs; make html) of a single schema showing it rendered using sphinx-jsonschema and also in JSON, TOML and YAML formats. I we are going to allow submission of new schemas in those formats then we need to be able to display existing schemas in those formats to inform the user. The contents are hardcoded now but would be dynamically generated for each of the schemas in the repo. The sphinx-jsonschema output isn't excellent (it omits if-then clauses for example). TOML is also problematic as the dump functionality in toml reorders the elements so that the if and when are not longer in the correct order, so we would have to override the output-ordering of the toml writer.

schema.webm

Some of this is different to that proposed in #3 but 🤷.

@@ -59,3 +61,61 @@ def list_schemas(project: typing.Optional[str] = None) -> typing.List[str]:
logging.warning(f"Could not find an ID/URI in {fpath}.")
pass
return schema_uris


class Schema:
Copy link
Member

Choose a reason for hiding this comment

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

I wrote a very similar class to this in Jupyter Events here.

I wonder if we can consolidate some of this logic.

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