summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn L. Villalovos <john@sodarock.com>2022-01-15 08:31:00 -0800
committerJohn L. Villalovos <john@sodarock.com>2022-01-15 08:31:00 -0800
commitb981ce7fed88c5d86a3fffc4ee3f99be0b958c1d (patch)
tree9e8e41154f80a3408972cece6fc4328c8186e455
parentcbbe7ce61db0649be286c5c1a239e00ed86f8039 (diff)
downloadgitlab-jlvillal/version_mv.tar.gz
chore: rename `gitlab/__version__.py` -> `gitlab/_version.py`jlvillal/version_mv
It is confusing to have a `gitlab/__version__.py` because we also create a variable `gitlab.__version__` which can conflict with `gitlab/__version__.py`. For example in `gitlab/const.py` we have to know that `gitlab.__version__` is a module and not the variable due to the ordering of imports. But in most other usage `gitlab.__version__` is a version string. To reduce confusion make the name of the version file `gitlab/_version.py`.
-rw-r--r--CONTRIBUTING.rst2
-rw-r--r--gitlab/__init__.py2
-rw-r--r--gitlab/_version.py (renamed from gitlab/__version__.py)0
-rw-r--r--gitlab/const.py2
-rw-r--r--pyproject.toml2
-rw-r--r--setup.py2
-rw-r--r--tests/smoke/test_dists.py2
7 files changed, 6 insertions, 6 deletions
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index b065886..2a645d0 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -153,7 +153,7 @@ This avoids triggering incorrect version bumps and releases without functional c
The release workflow uses `python-semantic-release
<https://python-semantic-release.readthedocs.io>`_ and does the following:
-* Bumps the version in ``__version__.py`` and adds an entry in ``CHANGELOG.md``,
+* Bumps the version in ``_version.py`` and adds an entry in ``CHANGELOG.md``,
* Commits and tags the changes, then pushes to the main branch as the ``github-actions`` user,
* Creates a release from the tag and adds the changelog entry to the release notes,
* Uploads the package as assets to the GitHub release,
diff --git a/gitlab/__init__.py b/gitlab/__init__.py
index 824f177..5f168ac 100644
--- a/gitlab/__init__.py
+++ b/gitlab/__init__.py
@@ -20,7 +20,7 @@ import warnings
from typing import Any
import gitlab.config # noqa: F401
-from gitlab.__version__ import ( # noqa: F401
+from gitlab._version import ( # noqa: F401
__author__,
__copyright__,
__email__,
diff --git a/gitlab/__version__.py b/gitlab/_version.py
index a1fb3cd..a1fb3cd 100644
--- a/gitlab/__version__.py
+++ b/gitlab/_version.py
diff --git a/gitlab/const.py b/gitlab/const.py
index 48aa96d..2ed4fa7 100644
--- a/gitlab/const.py
+++ b/gitlab/const.py
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from gitlab.__version__ import __title__, __version__
+from gitlab._version import __title__, __version__
# NOTE(jlvillal): '_DEPRECATED' only affects users accessing constants via the
# top-level gitlab.* namespace. See 'gitlab/__init__.py:__getattr__()' for the
diff --git a/pyproject.toml b/pyproject.toml
index 8c29140..f05a44e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -38,7 +38,7 @@ ignore_errors = true
[tool.semantic_release]
branch = "main"
-version_variable = "gitlab/__version__.py:__version__"
+version_variable = "gitlab/_version.py:__version__"
commit_subject = "chore: release v{version}"
commit_message = ""
diff --git a/setup.py b/setup.py
index 87f67a0..731d6a5 100644
--- a/setup.py
+++ b/setup.py
@@ -6,7 +6,7 @@ from setuptools import find_packages, setup
def get_version() -> str:
version = ""
- with open("gitlab/__version__.py") as f:
+ with open("gitlab/_version.py") as f:
for line in f:
if line.startswith("__version__"):
version = eval(line.split("=")[-1])
diff --git a/tests/smoke/test_dists.py b/tests/smoke/test_dists.py
index 4324ebe..c528725 100644
--- a/tests/smoke/test_dists.py
+++ b/tests/smoke/test_dists.py
@@ -6,7 +6,7 @@ from sys import version_info
import pytest
from setuptools import sandbox
-from gitlab import __title__, __version__
+from gitlab._version import __title__, __version__
DIST_DIR = Path("dist")
DOCS_DIR = "docs"