summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-10 16:43:58 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-24 14:33:41 +0200
commitfcbf3c923136ef25d01ec45cd550d93f319b04db (patch)
treed64bc689b57005b784f351466a68116e52959574
parentc064f1eba3ab3d9acee3873187488001b365d1f9 (diff)
downloadastroid-git-fcbf3c923136ef25d01ec45cd550d93f319b04db.tar.gz
Change numversion to __version__ in __pkginfo__
-rw-r--r--ChangeLog3
-rw-r--r--astroid/__init__.py3
-rw-r--r--astroid/__pkginfo__.py15
-rw-r--r--doc/conf.py4
-rw-r--r--doc/release.md4
-rw-r--r--setup.py2
6 files changed, 20 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index f3aade47..ad4a398a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,9 @@ Release Date: TBA
* Debian packaging is now (officially) done in https://salsa.debian.org/python-team/packages/astroid.
+* ``__pkginfo__`` now only contain ``__version__`` (also accessible with ``astroid.__version__``),
+ other meta-information are still accessible with ``import importlib;metadata.metadata('astroid')``.
+
* Added inference tip for ``typing.Tuple`` alias
* Fix crash when evaluating ``typing.NamedTuple``
diff --git a/astroid/__init__.py b/astroid/__init__.py
index 0224dd7a..17ea57ab 100644
--- a/astroid/__init__.py
+++ b/astroid/__init__.py
@@ -46,7 +46,7 @@ from pathlib import Path
import wrapt
-from .__pkginfo__ import version as __version__
+from .__pkginfo__ import __version__
_Context = enum.Enum("Context", "Load Store Del")
Load = _Context.Load
@@ -54,6 +54,7 @@ Store = _Context.Store
Del = _Context.Del
del _Context
+
# WARNING: internal imports order matters !
# pylint: disable=wrong-import-order,wrong-import-position,redefined-builtin
diff --git a/astroid/__pkginfo__.py b/astroid/__pkginfo__.py
index e23c8500..09127c21 100644
--- a/astroid/__pkginfo__.py
+++ b/astroid/__pkginfo__.py
@@ -26,10 +26,15 @@
"""astroid packaging information"""
-# For an official release, use dev_version = None
-numversion = (2, 5, 3)
-dev_version = None
+from typing import Optional
+
+__version__ = "2.6.0"
+# For an official release, use 'alpha_version = False' and 'dev_version = None'
+alpha_version: bool = False # Release will be an alpha version if True (ex: '1.2.3a6')
+dev_version: Optional[int] = 1
-version = ".".join(str(num) for num in numversion)
if dev_version is not None:
- version += "-dev" + str(dev_version)
+ if alpha_version:
+ __version__ += f"a{dev_version}"
+ else:
+ __version__ += f".dev{dev_version}"
diff --git a/doc/conf.py b/doc/conf.py
index bd94315b..12070636 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -58,10 +58,10 @@ copyright = f'2003-{current_year}, Logilab, PyCQA and contributors'
# built documents.
#
# The short X.Y version.
-from astroid.__pkginfo__ import version
+from astroid.__pkginfo__ import __version__
# The full version, including alpha/beta/rc tags.
-release = version
+release = __version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/doc/release.md b/doc/release.md
index 2f029eab..b19afe7e 100644
--- a/doc/release.md
+++ b/doc/release.md
@@ -6,7 +6,7 @@ So, you want to release the `X.Y.Z` version of astroid ?
1. Preparation
1. Check if the dependencies of the package are correct
- 2. Update `numversion` in `__pkginfo__`, `dev_version` should also be None when you
+ 2. Update `__version__` in `__pkginfo__`, `dev_version` should also be None when you
tag.
3. Put the version numbers, and the release date into the changelog
4. Generate the new copyright notices for this release:
@@ -69,5 +69,5 @@ at the examples from `doc/whatsnew`.
### Versions
-Update `numversion` to `X.Y+1.0` in `__pkginfo__` for `master` and to `X.Y.Z+1` for the
+Update `__version__` to `X.Y+1.0` in `__pkginfo__` for `master` and to `X.Y.Z+1` for the
`X.Y` branch. `dev_version` should also be back to an integer after the tag.
diff --git a/setup.py b/setup.py
index 0353024c..63452e05 100644
--- a/setup.py
+++ b/setup.py
@@ -34,7 +34,7 @@ with open(pkginfo, "rb") as fobj:
def install():
return setup(
name="astroid",
- version=version,
+ version=__version__,
packages=find_packages(exclude=["tests"]) + ["astroid.brain"],
)