Skip to content

Commit

Permalink
Merge pull request #97 from s-kostyuk/package_version
Browse files Browse the repository at this point in the history
Added version information to the everpl package root

This pull request adds a new variable called "__version__" to the root of everpl (currently dpl) package. Also it switches the package version source in setup.py file to the package __init__ file.

Closes #28
  • Loading branch information
s-kostyuk committed May 4, 2018
2 parents 6baa455 + 67728bf commit 993bd2c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dpl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

DPL_INSTALL_PATH = os.path.dirname(__file__)

__version__ = '0.3.0'
15 changes: 14 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
https://github.com/pypa/sampleproject
"""

import pathlib
import re
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
Expand All @@ -20,6 +22,17 @@
# Arguments marked as "Required" below must be included for upload to PyPI.
# Fields marked as "Optional" may be commented out.

# Extract everpl version from a package __init__ file
here = pathlib.Path(__file__).parent

txt = (here / 'dpl' / '__init__.py').read_text('utf-8')
try:
version = re.findall(r"^__version__ = '([^']+)'\r?$",
txt, re.M)[0]
except IndexError:
raise RuntimeError('Unable to determine version.')

# Start "setup" section
setup(
# This is the name of your project. The first time you publish this
# package, this name will be registered for you. It will determine how
Expand All @@ -40,7 +53,7 @@
# For a discussion on single-sourcing the version across setup.py and the
# project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='0.3.0', # Required
version=version, # Required

# This is a one-line description or tagline of what your project does. This
# corresponds to the "Summary" metadata field:
Expand Down

0 comments on commit 993bd2c

Please sign in to comment.