Skip to content

Commit

Permalink
Merge pull request #110 from AllSpiceIO/su/version
Browse files Browse the repository at this point in the history
Add __version__ attr to top level module
  • Loading branch information
shrik450 authored May 20, 2024
2 parents f675255 + 57a7866 commit 148e2d8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions allspice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
)
from .exceptions import NotFoundException, AlreadyExistsException

__version__ = "3.0.0"

__all__ = [
"AllSpice",
"User",
Expand Down
21 changes: 20 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
import codecs
import os
from setuptools import setup, find_packages


# Taken from pip's setup.py
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), "r") as fp:
return fp.read()


def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith("__version__"):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")


with open("README.md") as readme_file:
README = readme_file.read()

setup_args = dict(
name="py-allspice",
version="3.0.0",
version=get_version("allspice/__init__.py"),
description="A python wrapper for the AllSpice Hub API",
long_description_content_type="text/markdown",
long_description=README,
Expand Down

0 comments on commit 148e2d8

Please sign in to comment.