Project
kedro.framework.project ¶
kedro.framework.project module provides utility to
configure a Kedro project and access its settings.
| Function | Description |
|---|---|
configure_logging |
Configure logging according to the logging_config dictionary. |
configure_project |
Configure a Kedro project by populating its settings with values defined in settings.py and pipeline_registry.py. |
find_pipelines |
Automatically find modular pipelines having a create_pipeline function. |
validate_settings |
Eagerly validate that the settings module is importable if it exists. |
kedro.framework.project.configure_logging ¶
configure_logging(logging_config)
Configure logging according to the logging_config mapping.
Raises:
-
ValueError–If the configuration contains a '()' key, a 'cfg://' reference, a reference outside the allowed modules, an invalid logging class, or an unsupported
QueueHandlerqueue factory or listener.
Source code in kedro/framework/project/__init__.py
752 753 754 755 756 757 758 759 760 | |
kedro.framework.project.configure_project ¶
configure_project(package_name, preserve_logging=False)
Configure a Kedro project by populating its settings with values defined in user's settings.py and pipeline_registry.py.
Parameters:
-
package_name(str) –The name of the project package.
-
preserve_logging(bool, default:False) –If True, skip re-applying the logging configuration when setting up the project logger. Useful in long-running processes (e.g. FastAPI apps) where custom handlers are added at runtime and must not be overwritten on repeated calls to
configure_project().
Source code in kedro/framework/project/__init__.py
724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | |
kedro.framework.project.find_pipelines ¶
find_pipelines(raise_errors=False, pipelines_to_find=None)
Automatically find modular pipelines having a create_pipeline
function. By default, projects created using Kedro 0.18.3 and higher
call this function to autoregister pipelines upon creation/addition.
Projects that require more fine-grained control can still define the
pipeline registry without calling this function. Alternatively, they
can modify the mapping generated by the find_pipelines function.
For more information on the pipeline registry and autodiscovery, see https://docs.kedro.org/en/stable/build/pipeline_registry/
Parameters:
-
raise_errors(bool, default:False) –If
True, raise an error upon failed discovery. -
pipelines_to_find(list[str] | None, default:None) –Optional list of pipeline names to load selectively. If
Noneor contains"__default__", all pipelines are loaded.
Returns:
-
dict[str, Pipeline]–A generated mapping from pipeline names to
Pipelineobjects.
Raises:
-
RuntimeError–When the project has not been configured (i.e.
PACKAGE_NAMEisNone). -
ImportError–When a module does not expose a
create_pipelinefunction, thecreate_pipelinefunction does not return aPipelineobject, or if the module import fails up front. Ifraise_errorsisFalse, see Warns section instead.
Warns:
-
UserWarning–When a module does not expose a
create_pipelinefunction, thecreate_pipelinefunction does not return aPipelineobject, or if the module import fails up front. Ifraise_errorsisTrue, see Raises section instead.
Source code in kedro/framework/project/__init__.py
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | |
kedro.framework.project.validate_settings ¶
validate_settings()
Eagerly validate that the settings module is importable if it exists. This is desirable to
surface any syntax or import errors early. In particular, without eagerly importing
the settings module, dynaconf would silence any import error (e.g. missing
dependency, missing/mislabelled pipeline), and users would instead get a cryptic
error message Expected an instance of `ConfigLoader`, got `NoneType` instead.
More info on the dynaconf issue: https://github.com/dynaconf/dynaconf/issues/460
Source code in kedro/framework/project/__init__.py
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | |