@@ -4,6 +4,7 @@ use crate::python::neon_py::*;
44use crate :: python:: python_model:: CubePythonModel ;
55use crate :: python:: runtime:: py_runtime_init;
66use neon:: prelude:: * ;
7+ use pyo3:: exceptions:: PyException ;
78use pyo3:: prelude:: * ;
89use pyo3:: types:: { PyDict , PyFunction , PyList , PyString , PyTuple } ;
910use std:: path:: Path ;
@@ -45,8 +46,15 @@ fn python_load_config(mut cx: FunctionContext) -> JsResult<JsPromise> {
4546 let settings_py = if config_module. hasattr ( "config" ) ? {
4647 config_module. getattr ( "config" ) ?
4748 } else {
48- // backward compatibility
49- config_module. getattr ( "settings" ) ?
49+ // backward compatibility, was used in private preview, not as Public API
50+ // TODO: Remove after 1.4
51+ if config_module. hasattr ( "settings" ) ? {
52+ config_module. getattr ( "settings" ) ?
53+ } else {
54+ return Err ( PyErr :: new :: < PyException , String > (
55+ "`cube.py` configuration file must define the 'config' attribute. Did you forget to add the `from cube import config` import?" . to_string ( ) ,
56+ ) ) ;
57+ }
5058 } ;
5159
5260 let mut cube_conf = CubeConfigPy :: new ( ) ;
@@ -119,6 +127,8 @@ fn python_load_model(mut cx: FunctionContext) -> JsResult<JsPromise> {
119127 ) ;
120128 }
121129 } else {
130+ // backward compatibility, was used in private preview, not as Public API
131+ // TODO: Remove after 1.4
122132 let inspect_module = py. import ( "inspect" ) ?;
123133 let args = ( model_module, inspect_module. getattr ( "isfunction" ) ?) ;
124134 let functions_with_names = inspect_module
0 commit comments