Skip to content

Commit

Permalink
Merge pull request #16 from truenas/refactor-more-modules
Browse files Browse the repository at this point in the history
Refactor more modules to make more sense out of the whole structure
  • Loading branch information
sonicaj authored May 10, 2024
2 parents af60e1f + 62fae3f commit 63c8c80
Show file tree
Hide file tree
Showing 37 changed files with 44 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
*.egg-info/*
build/*
.idea/*
apps_ci/**/__pycache__/
apps_exceptions/**/__pycache__/
apps_schema/__pycache__/*
apps_schema/*/__pycache__/*
apps_validation/__pycache__/*
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion apps_validation/ci/git.py → apps_ci/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import subprocess
from collections import defaultdict

from apps_validation.exceptions import CatalogDoesNotExist
from apps_exceptions import CatalogDoesNotExist
from catalog_reader.dev_directory import (
DEV_DIRECTORY_RELATIVE_PATH, get_ci_development_directory, OPTIONAL_METADATA_FILES
)
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

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 apps_ci.names import CACHED_CATALOG_FILE_NAME, CACHED_VERSION_FILE_NAME
from apps_exceptions import ValidationErrors
from apps_validation.json_schema_utils import CATALOG_JSON_SCHEMA
from apps_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,
Expand Down
1 change: 1 addition & 0 deletions apps_exceptions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .exceptions import * # noqa
File renamed without changes.
2 changes: 1 addition & 1 deletion apps_schema/attrs/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from jsonschema import validate as json_schema_validate, ValidationError as JsonValidationError

from apps_validation.exceptions import ValidationErrors
from apps_exceptions import ValidationErrors

from .utils import ATTRIBUTES_SCHEMA

Expand Down
2 changes: 1 addition & 1 deletion apps_schema/features/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from apps_validation.exceptions import ValidationErrors
from apps_exceptions import ValidationErrors

from .utils import FEATURES

Expand Down
2 changes: 1 addition & 1 deletion apps_schema/variable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from apps_validation.exceptions import ValidationErrors
from apps_exceptions import ValidationErrors

from .attrs import get_schema

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from jsonschema import validate as json_schema_validate, ValidationError as JsonValidationError

from apps_validation.exceptions import ValidationErrors
from apps_exceptions import ValidationErrors

from .json_schema_utils import APP_METADATA_JSON_SCHEMA
from .scale_version import validate_min_max_version_values
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from jsonschema import validate as json_schema_validate, ValidationError as JsonValidationError

from apps_validation.exceptions import ValidationErrors
from apps_exceptions import ValidationErrors


CUSTOM_PORTALS_JSON_SCHEMA = {
Expand Down
File renamed without changes.
File renamed without changes.
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_exceptions import ValidationErrors


@pytest.mark.parametrize('schema,should_work', [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from middlewared.plugins.update_.utils import can_update

from apps_validation.exceptions import ValidationErrors
from apps_exceptions import ValidationErrors

from .names import RE_SCALE_VERSION
from .utils import validate_key_value_types
Expand Down
4 changes: 2 additions & 2 deletions apps_validation/scripts/catalog_validate.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python
import argparse

from apps_validation.exceptions import CatalogDoesNotExist, ValidationErrors
from apps_validation.validation.validate_catalog import validate_catalog
from apps_exceptions import CatalogDoesNotExist, ValidationErrors
from apps_validation.validate_catalog import validate_catalog


def validate(catalog_path):
Expand Down
4 changes: 2 additions & 2 deletions apps_validation/scripts/dev_apps_validate.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python
import argparse

from apps_validation.ci.git import get_changed_apps
from apps_validation.validation.validate_dev_directory import validate_dev_directory_structure
from apps_ci.git import get_changed_apps
from apps_validation.validate_dev_directory import validate_dev_directory_structure


def main():
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import json
import yaml

from apps_validation.ci.names import CACHED_VERSION_FILE_NAME
from apps_validation.exceptions import ValidationErrors
from apps_ci.names import CACHED_VERSION_FILE_NAME
from apps_exceptions import ValidationErrors

from .validate_app_version import validate_catalog_item_version_data, validate_catalog_item_version
from .utils import validate_key_value_types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import re

from apps_validation.exceptions import ValidationErrors
from apps_exceptions import ValidationErrors

from .json_schema_utils import APP_MIGRATION_SCHEMA

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from jsonschema import validate as json_schema_validate, ValidationError as JsonValidationError
from semantic_version import Version

from apps_validation.exceptions import ValidationErrors
from apps_exceptions import ValidationErrors
from catalog_reader.app_utils import get_app_basic_details
from catalog_reader.hash_utils import get_hash_of_directory
from catalog_reader.names import get_base_library_dir_name_from_version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

from jsonschema import validate as json_schema_validate, ValidationError as JsonValidationError

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

from .json_schema_utils import CATALOG_JSON_SCHEMA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from jsonschema import ValidationError as JsonValidationError

from apps_validation.exceptions import ValidationErrors
from apps_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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from jsonschema import validate as json_schema_validate, ValidationError as JsonValidationError

from apps_validation.exceptions import ValidationErrors
from apps_exceptions import ValidationErrors
from catalog_reader.library import get_library_hashes, get_hashes_of_base_lib_versions, RE_VERSION
from catalog_reader.names import get_library_path, get_library_hashes_path

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import yaml

from apps_schema.variable import Variable
from apps_validation.exceptions import ValidationErrors
from apps_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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from jsonschema import validate as json_schema_validate, ValidationError as JsonValidationError

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

from .json_schema_utils import RECOMMENDED_APPS_JSON_SCHEMA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import re
import yaml

from apps_validation.exceptions import ValidationErrors
from apps_exceptions import ValidationErrors
from catalog_reader.app_utils import get_app_basic_details, get_values
from catalog_templating.render import render_templates

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import typing

from apps_validation.exceptions import ValidationErrors
from apps_exceptions import ValidationErrors

from .names import RE_TRAIN_NAME

Expand Down
6 changes: 3 additions & 3 deletions catalog_reader/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

from pkg_resources import parse_version

from apps_validation.exceptions import ValidationErrors
from apps_validation.validation.validate_app import validate_catalog_item
from apps_validation.validation.validate_app_version import validate_catalog_item_version # FIXME: rename this
from apps_exceptions import ValidationErrors
from apps_validation.validate_app import validate_catalog_item
from apps_validation.validate_app_version import validate_catalog_item_version # FIXME: rename this

from .app_utils import get_default_questions_context, get_app_details_base
from .git import get_last_updated_date
Expand Down
2 changes: 1 addition & 1 deletion catalog_reader/recommended_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from jsonschema import validate as json_schema_validate, ValidationError as JsonValidationError

from apps_validation.validation.json_schema_utils import RECOMMENDED_APPS_JSON_SCHEMA
from apps_validation.json_schema_utils import RECOMMENDED_APPS_JSON_SCHEMA

from .names import RECOMMENDED_APPS_FILENAME

Expand Down
2 changes: 1 addition & 1 deletion catalog_reader/scripts/apps_hashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import shutil
import yaml

from apps_validation.exceptions import CatalogDoesNotExist, ValidationErrors
from apps_exceptions import CatalogDoesNotExist, ValidationErrors
from catalog_reader.dev_directory import get_ci_development_directory
from catalog_reader.library import get_hashes_of_base_lib_versions
from catalog_reader.names import get_library_path, get_library_hashes_path, get_base_library_dir_name_from_version
Expand Down
2 changes: 1 addition & 1 deletion catalog_reader/train_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from apps_validation.validation.names import RE_TRAIN_NAME
from apps_validation.names import RE_TRAIN_NAME


def is_train_valid(train_name: str, train_location: str) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion catalog_templating/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from jinja2 import Environment, FileSystemLoader

from apps_validation.exceptions import ValidationError
from apps_exceptions import ValidationError
from catalog_reader.app_utils import get_app_basic_details
from catalog_reader.names import get_app_library_dir_name_from_version, get_base_library_dir_name_from_version

Expand Down
2 changes: 1 addition & 1 deletion catalog_templating/scripts/render_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import shutil

from apps_validation.exceptions import ValidationErrors
from apps_exceptions import ValidationErrors
from catalog_reader.app_utils import get_values
from catalog_templating.render import render_templates

Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
version=VERSION,
include_package_data=True,
packages=find_packages(include=[
'apps_ci',
'apps_ci.*',
'apps_exceptions',
'apps_exceptions.*',
'apps_schema',
'apps_schema.*',
'apps_validation',
Expand All @@ -23,7 +27,7 @@
entry_points={
'console_scripts': [
'apps_catalog_hash_generate = catalog_reader.scripts.apps_hashes:main',
'apps_catalog_update = apps_validation.scripts.catalog_update:main',
'apps_catalog_update = apps_ci.scripts.catalog_update:main',
'apps_catalog_validate = apps_validation.scripts.catalog_validate:main',
'apps_dev_charts_validate = apps_validation.scripts.dev_apps_validate:main', # TODO: Remove apps_prefix
'apps_render_app = catalog_templating.scripts.render_compose:main',
Expand Down

0 comments on commit 63c8c80

Please sign in to comment.