codecov-io: # [Codecov](https://codecov.io/gh/bradleygolden/pytailor/pull/15?src=pr&el=h1) Report
> Merging [#15](https://codecov.io/gh/bradleygolden/pytailor/pull/15?src=pr&el=desc) into [master](https://codecov.io/gh/bradleygolden/pytailor/commit/02c1bc028bc86c18562e8f0ec864787c475cb402?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/bradleygolden/pytailor/pull/15/graphs/tree.svg?width=650&token=JG9z4i69IO&height=150&src=pr)](https://codecov.io/gh/bradleygolden/pytailor/pull/15?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master      #15   +/-   ##
=======================================
  Coverage   96.55%   96.55%           
=======================================
  Files           4        4           
  Lines          87       87           
=======================================
  Hits           84       84           
  Misses          3        3
```


| [Impacted Files](https://codecov.io/gh/bradleygolden/pytailor/pull/15?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pytailor/tailor.py](https://codecov.io/gh/bradleygolden/pytailor/pull/15/diff?src=pr&el=tree#diff-cHl0YWlsb3IvdGFpbG9yLnB5) | `96.96% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/bradleygolden/pytailor/pull/15?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/bradleygolden/pytailor/pull/15?src=pr&el=footer). Last update [02c1bc0...28b2b55](https://codecov.io/gh/bradleygolden/pytailor/pull/15?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

diff --git a/pytailor/__version__.py b/pytailor/__version__.py
index 57f0c12..8ed71d5 100644
--- a/pytailor/__version__.py
+++ b/pytailor/__version__.py
@@ -7,6 +7,6 @@
 # |__|   \/                \/
 
 
-VERSION = (0, 1, 4)
+VERSION = (0, 1, 5)
 
 __version__ = ".".join(map(str, VERSION))
diff --git a/pytailor/tailor.py b/pytailor/tailor.py
index 5ee150b..e9675e7 100644
--- a/pytailor/tailor.py
+++ b/pytailor/tailor.py
@@ -46,8 +46,8 @@ class Tailor(dict):
         for name, value in _store.items():
             self[name] = value
 
-    def watch_env_var(self, name: str):
-        """Set configuration and watch a system wide environment variable."""
+    def from_envar(self, name: str):
+        """Set configuration from an environment variable."""
         value = os.getenv(name)
         if not value:
             warn_msg = f"Environment variable '{name}' not found."

Rename watch_env_var
watch_env_var is confusingly named. It should be called something like "from_env_var"

For example
```
config.watch_env_var("FOO")
```

could be something like:
```
config.from_environ("FOO")
# or
config.from_env_var("FOO")
# or
config.from_envar("FOO")
```

or perhaps we can get more creative with something like:
```
config.environ["FOO"]
config.environ.get("FOO")
```

Where environ is a dictionary like object that takes brackets or the .get() method.
diff --git a/tests/test_tailor.py b/tests/test_tailor.py
index db3c231..f2fbdae 100644
--- a/tests/test_tailor.py
+++ b/tests/test_tailor.py
@@ -49,26 +49,26 @@ def test_from_object_and_then_dotenv(env_path):
     assert config["TESTING"] is False
 
 
-def test_watch_env_var_that_doesnt_exist_raises_warning():
+def test_from_envar_that_doesnt_exist_raises_warning():
     config = Tailor()
     with pytest.warns(RuntimeWarning) as warn:
-        config.watch_env_var("BAR")
+        config.from_envar("BAR")
 
     assert len(warn) == 1
     assert "not found" in warn[0].message.args[0]
 
 
-def test_watch_env_var_that_doesnt_exist_but_exists_in_config_object():
+def test_from_envar_that_doesnt_exist_but_exists_in_config_object():
     config = Tailor()
     config["BAR"] = "BAZ"
-    config.watch_env_var("BAR")
+    config.from_envar("BAR")
     assert "BAR" in config
     assert config["BAR"] == "BAZ"
 
 
-def test_watch_env_var_and_change_after_watching():
+def test_from_envar_and_change_after_watching():
     config = Tailor()
-    config.watch_env_var("FOO")
+    config.from_envar("FOO")
     assert config["FOO"] == "BAR"
     os.environ["FOO"] = "BAZ"
     assert config["FOO"] == "BAZ"
@@ -76,7 +76,7 @@ def test_watch_env_var_and_change_after_watching():
 
 def test_env_var_is_set_then_gets_removed():
     config = Tailor()
-    config.watch_env_var("FOO")
+    config.from_envar("FOO")
     del os.environ["FOO"]
     # check original value was backed up
     assert config["FOO"] == "BAR"

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov
apt-get update apt-get install -y gcc
3.9
requirements/base.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
coverage==7.8.0
exceptiongroup==1.2.2
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
-e git+https://github.com/bradleygolden/pytailor.git@02c1bc028bc86c18562e8f0ec864787c475cb402#egg=pytailor
pytest==8.3.5
pytest-cov==6.0.0
tomli==2.2.1

name: pytailor
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - coverage==7.8.0
      - exceptiongroup==1.2.2
      - iniconfig==2.1.0
      - packaging==24.2
      - pluggy==1.5.0
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - tomli==2.2.1
prefix: /opt/conda/envs/pytailor

tests/test_tailor.py::test_from_envar_that_doesnt_exist_raises_warning tests/test_tailor.py::test_from_envar_that_doesnt_exist_but_exists_in_config_object tests/test_tailor.py::test_from_envar_and_change_after_watching tests/test_tailor.py::test_env_var_is_set_then_gets_removed
tests/test_tailor.py::test_from_object tests/test_tailor.py::test_from_dotenv tests/test_tailor.py::test_from_object_and_then_dotenv tests/test_tailor.py::test_user_can_change_value_manually tests/test_tailor.py::test_user_can_use_number_types_with_dotenv tests/test_tailor.py::test_dunder_str tests/test_tailor.py::test_dunder_eq tests/test_tailor.py::test_dunder_ne
pytailor/tailor.py pytailor/__version__.py
pytailor/tailor.py pytailor/__version__.py