Repository: pypa/setuptools_scm

Issue:
setuptools_scm 3.0.6: `version_from_scm()` fails under Python2
When I invoke `setuptools_scm.version_from_scm()` within my Python 2 program, I get a stacktrace:

```
Traceback (most recent call last):
...
  File "/usr/local/lib/python2.7/dist-packages/setuptools_scm/__init__.py", line 28, in version_from_scm
    return _version_from_entrypoint(root, "setuptools_scm.parse_scm")
  File "/usr/local/lib/python2.7/dist-packages/setuptools_scm/__init__.py", line 44, in _version_from_entrypoint
    for ep in iter_matching_entrypoints(config.absolute_root, entrypoint):
AttributeError: 'str' object has no attribute 'absolute_root'
```

This error occurs with version 3.0.6.  Everything worked fine under 2.1.0.

Appears to have been introduced in PR #276, looks similar to #281.

Python 2 is still intended to be supported, right?

Thanks for your work on `setuptools_scm`!  Sorry some of us are still stuck on Python 2 :-/

Discussion:

Patch:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 506e985..861d321 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,3 +1,8 @@
+v3.1.0
+=======
+
+* fix #297 - correct the invocation in version_from_scm and deprecate it as its exposed by accident
+
 v3.0.6
 ======
 * fix #295 - correctly handle selfinstall from tarballs
diff --git a/src/setuptools_scm/__init__.py b/src/setuptools_scm/__init__.py
index 49c0c4b..72b7b22 100644
--- a/src/setuptools_scm/__init__.py
+++ b/src/setuptools_scm/__init__.py
@@ -24,8 +24,14 @@ version = {version!r}
 
 
 def version_from_scm(root):
+    warnings.warn(
+        "version_from_scm is deprecated please use get_version",
+        category=DeprecationWarning,
+    )
+    config = Configuration()
+    config.root = root
     # TODO: Is it API?
-    return _version_from_entrypoint(root, "setuptools_scm.parse_scm")
+    return _version_from_entrypoint(config, "setuptools_scm.parse_scm")
 
 
 def _call_entrypoint_fn(config, fn):


Test patch:
diff --git a/testing/test_basic_api.py b/testing/test_basic_api.py
index 1a0fa78..c032d23 100644
--- a/testing/test_basic_api.py
+++ b/testing/test_basic_api.py
@@ -46,6 +46,11 @@ def test_root_parameter_creation(monkeypatch):
     setuptools_scm.get_version()
 
 
+def test_version_from_scm(wd):
+    with pytest.warns(DeprecationWarning, match=".*version_from_scm.*"):
+        setuptools_scm.version_from_scm(str(wd))
+
+
 def test_root_parameter_pass_by(monkeypatch, tmpdir):
     assert_root(monkeypatch, tmpdir)
     setuptools_scm.get_version(root=tmpdir.strpath)