diff --git a/src/serena/config/serena_config.py b/src/serena/config/serena_config.py index 3b2dd9be..b348c64d 100644 --- a/src/serena/config/serena_config.py +++ b/src/serena/config/serena_config.py @@ -23,6 +23,7 @@ from sensai.util.string import ToStringMixin from serena.constants import ( DEFAULT_SOURCE_FILE_ENCODING, + PROJECT_LOCAL_TEMPLATE_FILE, PROJECT_TEMPLATE_FILE, REPO_ROOT, SERENA_CONFIG_TEMPLATE_FILE, @@ -300,10 +301,13 @@ class ProjectConfig(SharedConfig): config_with_comments, _ = cls._load_yaml_dict(PROJECT_TEMPLATE_FILE) config_with_comments["project_name"] = project_name config_with_comments["languages"] = languages_to_use + if save_to_disk: project_yml_path = serena_config.get_project_yml_location(str(project_root)) log.info("Saving project configuration to %s", project_yml_path) save_yaml(project_yml_path, config_with_comments) + project_local_yml_path = os.path.join(os.path.dirname(project_yml_path), cls.SERENA_LOCAL_PROJECT_FILE) + shutil.copy(PROJECT_LOCAL_TEMPLATE_FILE, project_local_yml_path) return cls._from_dict(config_with_comments) @classmethod diff --git a/src/serena/constants.py b/src/serena/constants.py index 6d90a539..4d96bcff 100644 --- a/src/serena/constants.py +++ b/src/serena/constants.py @@ -25,6 +25,7 @@ SERENA_FILE_ENCODING = "utf-8" """The encoding used for Serena's own files, such as configuration files and memories.""" PROJECT_TEMPLATE_FILE = str(_serena_pkg_path / "resources" / "project.template.yml") +PROJECT_LOCAL_TEMPLATE_FILE = str(_serena_pkg_path / "resources" / "project.local.template.yml") SERENA_CONFIG_TEMPLATE_FILE = str(_serena_pkg_path / "resources" / "serena_config.template.yml") SERENA_LOG_FORMAT = "%(levelname)-5s %(asctime)-15s [%(threadName)s] %(name)s:%(funcName)s:%(lineno)d - %(message)s" diff --git a/src/serena/resources/project.local.template.yml b/src/serena/resources/project.local.template.yml new file mode 100644 index 00000000..36cd3def --- /dev/null +++ b/src/serena/resources/project.local.template.yml @@ -0,0 +1,5 @@ +# This file allows you to locally override settings in project.yml for development purposes. +# +# Use the same keys as in project.yml here. Any setting you specify will override the corresponding +# setting in project.yml, allowing you to customise the configuration for your local development environment +# without affecting the project configuration in project.yml (which is intended to be versioned).