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

automate schema version naming #110

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
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
8 changes: 5 additions & 3 deletions src/yt_napari/_schema_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
schema_version = "0.2.0"
schema_version_tuple = (0, 2, 0)
schema_name = "yt-napari_" + schema_version + ".json"
from yt_napari._version import version, version_tuple

schema_version_tuple = version_tuple[:3]
schema_version = ".".join([str(i) for i in schema_version_tuple])
schema_name = "yt-napari_" + version + ".json"
2 changes: 1 addition & 1 deletion src/yt_napari/_tests/_test_json.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"$schema": "yt-napari_0.2.0.json",
{"$schema": "yt-napari_0.2.0.dev.json",
"dataset": [{"filename": "IsolatedGalaxy/galaxy0030/galaxy0030",
"selections": {
"regions": [
Expand Down
2 changes: 1 addition & 1 deletion src/yt_napari/_tests/_test_json_slice.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"$schema": "yt-napari_0.2.0.json",
{"$schema": "yt-napari_0.2.0.dev.json",
"datasets": [{"filename": "IsolatedGalaxy/galaxy0030/galaxy0030/",
"selections": {
"slices": [
Expand Down
2 changes: 1 addition & 1 deletion src/yt_napari/_tests/_test_json_timeseries.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "yt-napari_0.2.0.json",
"$schema": "yt-napari_0.2.0.dev.json",
"datasets": [],
"timeseries": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/yt_napari/_tests/_test_json_timeseries_stack.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "yt-napari_0.2.0.json",
"$schema": "yt-napari_0.2.0.dev.json",
"datasets": [],
"timeseries": [
{
Expand Down
1 change: 1 addition & 0 deletions src/yt_napari/_tests/test_schema_version_comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def test_version_tupling(string_to_test, expected):
("yt-napari_0.0.1.json", True),
("yt-napari_1000.1.0.json", False),
("/blah/blah/yt-napari_latest.json", True),
("yt-napari_0.2.1.dev.json", True),
],
)
def test_schema_str_validation(string_to_test, expected):
Expand Down
5 changes: 5 additions & 0 deletions src/yt_napari/schemas/_version_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ def schema_version_is_valid(

# now we check the actual version. since the schema prefix (yt-napari) is
# in the supplied schema_version, we can assume a form of yt-napari_x.x.x.json
# or yt-napari_x.x.x.dev+.json
if "dev" in schema_version:
ytnapari_log.info("Using development schema.")
return True

sc_version = _schema_version_tuple_from_str(schema_version)
_version_tuple = _get_version_tuple()
if sc_version < _version_tuple:
Expand Down
Loading