Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ Alternatively, set this template as an upstream branch and merge in changes acco
3. *Merge changes* (maybe do this on a branch other than main and make a PR into main): `git merge template/main -- allow-unrelated-histories` (for the main branch in the upstream template).
4. *Fix Merge Conflicts*: Fix the merge conflicts in your local branch.

However, both of these methods are messy, since the package name (`python_template`) changes, and (if the derived repo is created from the gitHub template) the merge will want to revert it back to `python_template` and put anything new into a `python_template` directory as well (since they don't have a shared history).
However, both of these methods are messy (at least the first time), since the package name (`python_template`) changes, and (if the derived repo is created from the gitHub template) the merge will want to revert it back to `python_template` and put anything new into a `python_template` directory as well (since they don't have a shared history).

The possible way to avoid this is if the derived repo is created locally as a copy of this repo, since then they'll have a shared history (and then the flag `--allow-unrelated-histories` in step 3 can be omitted as well).
2 changes: 1 addition & 1 deletion src/python_template/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""This is what the module exports."""

from .config import config
from .config import settings
2 changes: 1 addition & 1 deletion src/python_template/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Expose Config class to module."""

from .load_config import config
from .load_config import settings
2 changes: 1 addition & 1 deletion src/python_template/config/load_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ class Config(BaseModel):
config_dict = yaml.safe_load(f)

# config = dict_to_namespace(config_dict)
config = Config(**config_dict)
settings = Config(**config_dict)
4 changes: 2 additions & 2 deletions src/python_template/logger/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from pathlib import Path
from typing import cast

from python_template import config
from python_template.config import settings

DEBUG_PRINTS = config.debug_prints
DEBUG_PRINTS = settings.debug_prints


class DebugCategory(IntEnum):
Expand Down
4 changes: 2 additions & 2 deletions src/python_template/utils/split_args_for_inits.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from collections import defaultdict
from typing import Any, get_type_hints

from python_template import config
from python_template.config import settings

DEBUG_PRINTS = config.debug_prints
DEBUG_PRINTS = settings.debug_prints
LEFTOVERS = "leftovers"


Expand Down
6 changes: 3 additions & 3 deletions tests/test_config/test_load_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import yaml

from python_template import config
from python_template import settings
from python_template.config.load_config import Config, dict_to_namespace
from python_template.constants import CONFIG_PATH

Expand Down Expand Up @@ -42,5 +42,5 @@ def test_config_dict_to_namespace_recursive():

def test_loaded_config_is_class():
"""Tests that load_config returns a namespace."""
assert isinstance(config, Config)
assert hasattr(config, "debug_prints")
assert isinstance(settings, Config)
assert hasattr(settings, "debug_prints")