Skip to content

Commit

Permalink
Move apps schema to it's own python package
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicaj committed May 5, 2024
1 parent de161b3 commit 279e4a4
Show file tree
Hide file tree
Showing 31 changed files with 32 additions and 25 deletions.
1 change: 1 addition & 0 deletions apps_schema/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# FIXME: We need to account for migration apps_schema
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, data):
self._skip_data_values = ['items']

def initialize_values(self, data):
from apps_validation.schema.variable import Variable
from apps_schema.variable import Variable
super().initialize_values(data)
self.items = [Variable(d) for d in (data.get('items') or [])]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def validate(self, schema, data=None):
verrors.check()

if '$ref' in self._schema_data:
from apps_validation.schema.features import FEATURES
from apps_schema.features import FEATURES
for index, ref in enumerate(self._schema_data['$ref']):
if not isinstance(ref, str):
verrors.add(f'{schema}.$ref.{index}', 'Must be a string')
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, data):
self._skip_data_values = ['attrs']

def initialize_values(self, data):
from apps_validation.schema.variable import Variable
from apps_schema.variable import Variable
super().initialize_values(data)
self.attrs = [Variable(d) for d in (data.get('attrs') or [])]

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from apps_validation.schema.attrs import DictSchema
from apps_schema.attrs import DictSchema

from .base import BaseFeature

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from apps_validation.schema.attrs import DictSchema, StringSchema
from apps_schema.attrs import DictSchema, StringSchema

from .base import BaseFeature

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from apps_validation.schema.attrs import IntegerSchema
from apps_schema.attrs import IntegerSchema

from .base import BaseFeature

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from apps_validation.schema.attrs import DictSchema, StringSchema
from apps_schema.attrs import DictSchema, StringSchema

from .base import BaseFeature

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from apps_validation.schema.attrs import DictSchema, StringSchema
from apps_schema.attrs import DictSchema, StringSchema

from .base import BaseFeature

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from apps_validation.schema.attrs import DictSchema, StringSchema
from apps_schema.attrs import DictSchema, StringSchema

from .base import BaseFeature

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from apps_validation.schema.attrs import IntegerSchema, StringSchema
from apps_schema.attrs import IntegerSchema, StringSchema

from .base import BaseFeature

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion apps_validation/ci/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import subprocess
from collections import defaultdict

from apps_validation.exceptions import CatalogDoesNotExist
from catalog_reader.dev_directory import (
DEV_DIRECTORY_RELATIVE_PATH, get_ci_development_directory, OPTIONAL_METADATA_FILES
)
from catalog_reader.train_utils import is_train_valid
from apps_validation.exceptions import CatalogDoesNotExist


def get_changed_apps(catalog_path: str, base_branch: str = 'master') -> dict:
Expand Down
2 changes: 1 addition & 1 deletion apps_validation/pytest/unit/test_attr_schema.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from apps_schema.attrs import get_schema
from apps_validation.exceptions import ValidationErrors
from apps_validation.schema.attrs import get_schema


@pytest.mark.parametrize('schema,should_work', [
Expand Down
1 change: 0 additions & 1 deletion apps_validation/schema/__init__.py

This file was deleted.

8 changes: 4 additions & 4 deletions apps_validation/scripts/catalog_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@

from jsonschema import validate as json_schema_validate, ValidationError as JsonValidationError

from apps_validation.ci.names import CACHED_CATALOG_FILE_NAME, CACHED_VERSION_FILE_NAME
from apps_validation.exceptions import ValidationErrors
from apps_validation.validation.json_schema_utils import CATALOG_JSON_SCHEMA
from apps_validation.validation.validate_app_version import validate_catalog_item_version_data
from catalog_reader.catalog import retrieve_train_names, retrieve_trains_data, get_apps_in_trains
from catalog_reader.dev_directory import (
get_app_version, get_ci_development_directory, get_to_keep_versions, OPTIONAL_METADATA_FILES,
REQUIRED_METADATA_FILES, version_has_been_bumped,
)
from catalog_reader.train_utils import get_train_path
from apps_validation.ci.names import CACHED_CATALOG_FILE_NAME, CACHED_VERSION_FILE_NAME
from apps_validation.exceptions import ValidationErrors
from apps_validation.validation.json_schema_utils import CATALOG_JSON_SCHEMA
from apps_validation.validation.validate_app_version import validate_catalog_item_version_data


def get_trains(location: str) -> typing.Tuple[dict, dict]:
Expand Down
2 changes: 1 addition & 1 deletion apps_validation/validation/validate_app_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from jsonschema import validate as json_schema_validate, ValidationError as JsonValidationError
from semantic_version import Version

from catalog_reader.questions_util import CUSTOM_PORTALS_KEY
from apps_validation.exceptions import ValidationErrors
from catalog_reader.questions_util import CUSTOM_PORTALS_KEY

from .app_version import validate_app_version_file
from .ix_values import validate_ix_values_schema
Expand Down
2 changes: 1 addition & 1 deletion apps_validation/validation/validate_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from jsonschema import validate as json_schema_validate, ValidationError as JsonValidationError

from apps_validation.ci.names import CACHED_CATALOG_FILE_NAME
from catalog_reader.train_utils import get_train_path
from apps_validation.exceptions import CatalogDoesNotExist, ValidationErrors
from catalog_reader.train_utils import get_train_path

from .json_schema_utils import CATALOG_JSON_SCHEMA
from .validate_app_rename_migrations import validate_migrations
Expand Down
2 changes: 1 addition & 1 deletion apps_validation/validation/validate_dev_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

from jsonschema import ValidationError as JsonValidationError

from apps_validation.exceptions import ValidationErrors
from catalog_reader.dev_directory import (
get_app_version, get_ci_development_directory, get_to_keep_versions, REQUIRED_METADATA_FILES,
version_has_been_bumped,
)
from catalog_reader.names import UPGRADE_STRATEGY_FILENAME, TO_KEEP_VERSIONS
from apps_validation.exceptions import ValidationErrors

from .app_version import validate_app_version_file
from .validate_app_version import validate_catalog_item_version
Expand Down
4 changes: 2 additions & 2 deletions apps_validation/validation/validate_questions.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import typing
import yaml

from apps_schema.variable import Variable
from apps_validation.exceptions import ValidationErrors
from catalog_reader.questions import CUSTOM_PORTALS_ENABLE_KEY, CUSTOM_PORTAL_GROUP_KEY
from catalog_reader.questions_util import CUSTOM_PORTALS_KEY
from apps_validation.exceptions import ValidationErrors
from apps_validation.schema.variable import Variable

from .utils import validate_key_value_types

Expand Down
2 changes: 1 addition & 1 deletion apps_validation/validation/validate_recommended_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from jsonschema import validate as json_schema_validate, ValidationError as JsonValidationError

from catalog_reader.names import RECOMMENDED_APPS_FILENAME
from apps_validation.exceptions import ValidationErrors
from catalog_reader.names import RECOMMENDED_APPS_FILENAME

from .json_schema_utils import RECOMMENDED_APPS_JSON_SCHEMA

Expand Down
2 changes: 1 addition & 1 deletion catalog_reader/supported_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from apps_validation.schema.features import FEATURES
from apps_schema.features import FEATURES


def version_supported(version_details: dict) -> bool:
Expand Down
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
description='Validate TrueNAS Apps Catalog',
version=VERSION,
include_package_data=True,
packages=find_packages(include=['apps_validation', 'catalog_reader', 'apps_validation.*', 'catalog_reader.*']),
packages=find_packages(include=[
'apps_schema',
'apps_schema.*',
'apps_validation',
'apps_validation.*',
'catalog_reader',
'catalog_reader.*'
]),
license='GNU3',
platforms='any',
entry_points={
Expand Down

0 comments on commit 279e4a4

Please sign in to comment.