Repository: bradleygolden/pytailor

Issue:
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.

Discussion:
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).


Patch:
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."


Test patch:
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"