diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a1b2d301..de8e0bf2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,7 @@ Unreleased - Functions with ``@property`` now return ``property`` instead of ``function`` in ``Name().type`` - Started using annotations +- Project attributes are now read accessible This is likely going to be the last minor release before 1.0. diff --git a/jedi/api/project.py b/jedi/api/project.py index 57b985e0..41554314 100644 --- a/jedi/api/project.py +++ b/jedi/api/project.py @@ -152,6 +152,29 @@ class Project: """ return self._path + @property + def sys_path(self): + """ + The sys path provided to this project. This can be None and in that + case will be auto generated. + """ + return self._sys_path + + @property + def smart_sys_path(self): + """ + If the sys path is going to be calculated in a smart way, where + additional paths are added. + """ + return self._smart_sys_path + + @property + def load_unsafe_extensions(self): + """ + Wheter the project loads unsafe extensions. + """ + return self._load_unsafe_extensions + @inference_state_as_method_param_cache() def _get_base_sys_path(self, inference_state): # The sys path has not been set explicitly. diff --git a/test/test_api/test_project.py b/test/test_api/test_project.py index 7ec880ad..c8533618 100644 --- a/test/test_api/test_project.py +++ b/test/test_api/test_project.py @@ -17,7 +17,12 @@ def test_django_default_project(Script): ) c, = script.complete() assert c.name == "SomeModel" - assert script._inference_state.project._django is True + + project = script._inference_state.project + assert project._django is True + assert project.sys_path is None + assert project.smart_sys_path is True + assert project.load_unsafe_extensions is False def test_django_default_project_of_file(Script):