refactor: move config_schema to it's own package
This is to avoid import conflicts and allow running the schema extraction without a full freqtrade installation.
This commit is contained in:
@@ -9,7 +9,7 @@ import rapidjson
|
|||||||
def extract_config_json_schema():
|
def extract_config_json_schema():
|
||||||
try:
|
try:
|
||||||
# Try to import from the installed package
|
# Try to import from the installed package
|
||||||
from freqtrade.configuration.config_schema import CONF_SCHEMA
|
from freqtrade.config_schema import CONF_SCHEMA
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# If freqtrade is not installed, add the parent directory to sys.path
|
# If freqtrade is not installed, add the parent directory to sys.path
|
||||||
# to import directly from the source
|
# to import directly from the source
|
||||||
@@ -18,7 +18,7 @@ def extract_config_json_schema():
|
|||||||
sys.path.insert(0, str(freqtrade_dir))
|
sys.path.insert(0, str(freqtrade_dir))
|
||||||
|
|
||||||
# Now try to import from the source
|
# Now try to import from the source
|
||||||
from freqtrade.configuration.config_schema import CONF_SCHEMA
|
from freqtrade.config_schema import CONF_SCHEMA
|
||||||
|
|
||||||
schema_filename = Path(__file__).parent / "schema.json"
|
schema_filename = Path(__file__).parent / "schema.json"
|
||||||
with schema_filename.open("w") as f:
|
with schema_filename.open("w") as f:
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
from freqtrade.config_schema.config_schema import CONF_SCHEMA
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["CONF_SCHEMA"]
|
||||||
@@ -6,7 +6,7 @@ from typing import Any
|
|||||||
from jsonschema import Draft4Validator, validators
|
from jsonschema import Draft4Validator, validators
|
||||||
from jsonschema.exceptions import ValidationError, best_match
|
from jsonschema.exceptions import ValidationError, best_match
|
||||||
|
|
||||||
from freqtrade.configuration.config_schema import (
|
from freqtrade.config_schema.config_schema import (
|
||||||
CONF_SCHEMA,
|
CONF_SCHEMA,
|
||||||
SCHEMA_BACKTEST_REQUIRED,
|
SCHEMA_BACKTEST_REQUIRED,
|
||||||
SCHEMA_BACKTEST_REQUIRED_FINAL,
|
SCHEMA_BACKTEST_REQUIRED_FINAL,
|
||||||
|
|||||||
Reference in New Issue
Block a user