Repository: Zeroto521/my-data-toolkit

Issue:
CI: add workflow to automatically update versioneer



Discussion:
# [Codecov](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/319?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero) Report
> Merging [#319](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/319?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero) (3ed5783) into [master](https://codecov.io/gh/Zeroto521/my-data-toolkit/commit/12b0257d9943ca2ea3f7b8ffeab20195af5f8875?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero) (12b0257) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/319/graphs/tree.svg?width=650&height=150&src=pr&token=ukBguscD8E&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero)](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/319?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero)

```diff
@@           Coverage Diff           @@
##           master     #319   +/-   ##
=======================================
  Coverage   99.64%   99.64%           
=======================================
  Files          26       26           
  Lines         564      564           
  Branches       79       79           
=======================================
  Hits          562      562           
  Partials        2        2           
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/319?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/319?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero). Last update [12b0257...3ed5783](https://codecov.io/gh/Zeroto521/my-data-toolkit/pull/319?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Zero).


Resolving patch:
diff --git a/ci/script/versioneer_update_check.py b/ci/script/versioneer_update_check.py
new file mode 100644
--- /dev/null
+++ b/ci/script/versioneer_update_check.py
@@ -0,0 +1,19 @@
+import os
+import sys
+
+try:
+    sys.path = sys.path[1:]  # import from the system instead of local
+    from versioneer import newver
+except ImportError:
+    sys.exit()
+
+
+FILE = "versioneer.py"
+
+if not os.path.exists(FILE):
+    sys.exit()
+
+for line in open(FILE).readlines()[:5]:
+    if "Version" in line and newver in line:  # don't need to update versioneer
+        print(True)
+        sys.exit()
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,8 +1,9 @@
 from setuptools import setup
 
-import versioneer
+from versioneer import get_cmdclass
+from versioneer import get_version
 
 setup(
-    version=versioneer.get_version(),
-    cmdclass=versioneer.get_cmdclass(),
+    version=get_version(),
+    cmdclass=get_cmdclass(),
 )
diff --git a/versioneer.py b/versioneer.py
--- a/versioneer.py
+++ b/versioneer.py
@@ -1,5 +1,4 @@
 # Version: 0.21
-
 """The Versioneer - like a rocketeer, but for versions.
 
 The Versioneer
@@ -278,7 +277,6 @@
 # pylint:disable=raise-missing-from,too-many-lines,too-many-locals,import-error
 # pylint:disable=too-few-public-methods,redefined-outer-name,consider-using-with
 # pylint:disable=attribute-defined-outside-init,too-many-arguments
-
 import configparser
 import errno
 import json
@@ -286,7 +284,8 @@
 import re
 import subprocess
 import sys
-from typing import Callable, Dict
+from typing import Callable
+from typing import Dict
 
 
 class VersioneerConfig:


Test patch: