diff --git a/VERSION b/VERSION deleted file mode 100644 index b0bb8785..00000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.9.5 diff --git a/dependency_injector/__init__.py b/dependency_injector/__init__.py index 9da694d8..322f64be 100644 --- a/dependency_injector/__init__.py +++ b/dependency_injector/__init__.py @@ -39,6 +39,9 @@ from .utils import ensure_is_catalog_bundle from .errors import Error +VERSION = '0.10.0' + + __all__ = ( # Catalogs 'AbstractCatalog', @@ -82,4 +85,7 @@ __all__ = ( # Errors 'Error', + + # Version + 'VERSION' ) diff --git a/docs/conf.py b/docs/conf.py index b6cd512c..b4abe519 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,6 +13,7 @@ # serve to show the default. import os +import re # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -53,9 +54,9 @@ author = u'Roman Mogilatov' # built documents. # # The short X.Y version. -# Getting version. -with open('../VERSION') as version: - version = version.read().strip() +# Getting version: +with open('../dependency_injector/__init__.py') as init_file: + version = re.search('VERSION = \'(.*?)\'', init_file.read()).group(1) # The full version, including alpha/beta/rc tags. release = version diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index 0a6ccaf2..129df1d1 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -25,6 +25,7 @@ Development version ``di.Callable`` injections (including args and kwargs). - Add optimization for ``di.Injection.value`` property that will compute type of injection once, instead of doing this on every call. +- Add ``di.VERSION`` constant for verification of currently installed version. - Add support of Python 3.5. - Add support of six 1.10.0. - Add minor refactorings and code style fixes. diff --git a/docs/main/installation.rst b/docs/main/installation.rst index e4de9b44..3c213111 100644 --- a/docs/main/installation.rst +++ b/docs/main/installation.rst @@ -23,6 +23,15 @@ Sources can be cloned from GitHub_: Also all *Dependency Injector* releases can be downloaded from `GitHub releases page`_. +Verification of currently installed version could be done using ``di.VERSION`` +constant: + +.. code-block:: bash + + >>> import dependency_injector as di + >>> di.VERSION + '0.10.0' + .. _PyPi: https://pypi.python.org/pypi/dependency_injector .. _GitHub: https://github.com/rmk135/dependency_injector .. _GitHub releases page: https://github.com/rmk135/dependency_injector/releases diff --git a/setup.py b/setup.py index ede815c9..23340df4 100644 --- a/setup.py +++ b/setup.py @@ -1,30 +1,31 @@ """`Dependency injector` setup script.""" import os +import re + from setuptools import setup from setuptools import Command SHORT_DESCRIPTION = 'Dependency injection framework for Python projects' -# Getting description. +# Getting description: with open('README.rst') as readme_file: description = readme_file.read() # Removing duplicated short description. description = description.replace(SHORT_DESCRIPTION, '') -# Getting requirements. +# Getting requirements: with open('requirements.txt') as version: requirements = version.readlines() -# Getting version. -with open('VERSION') as version: - version = version.read().strip() +# Getting version: +with open('dependency_injector/__init__.py') as init_file: + version = re.search('VERSION = \'(.*?)\'', init_file.read()).group(1) class PublishCommand(Command): - """Setuptools `publish` command.""" description = "Publish current distribution to PyPi and create tag"