Skip to content

Commit

Permalink
Single-sourcing the version in a __version__.py file (graphql-python#142
Browse files Browse the repository at this point in the history
)
  • Loading branch information
leszekhanusz committed Oct 3, 2020
1 parent 9e6dc7e commit 53c7a32
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
author = 'graphql-python.org'

# The full version, including alpha/beta/rc tags
release = '3.0.0a1'
from gql import __version__
release = __version__


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions gql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- all the transports classes implementing different communication protocols
"""

from .__version__ import __version__
from .client import Client
from .gql import gql
from .transport.aiohttp import AIOHTTPTransport
Expand All @@ -15,6 +16,7 @@
from .transport.websockets import WebsocketsTransport

__all__ = [
"__version__",
"gql",
"AIOHTTPTransport",
"Client",
Expand Down
1 change: 1 addition & 0 deletions gql/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "3.0.0a1"
12 changes: 10 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from setuptools import setup, find_packages

install_requires = [
Expand Down Expand Up @@ -28,12 +30,18 @@
"isort==4.3.21",
"mypy==0.770",
"sphinx>=3.0.0,<4",
"sphinx_rtd_theme>=0.4,<1"
"sphinx_rtd_theme>=0.4,<1",
] + tests_require

# Get version from __version__.py file
current_folder = os.path.abspath(os.path.dirname(__file__))
about = {}
with open(os.path.join(current_folder, "gql", "__version__.py"), "r") as f:
exec(f.read(), about)

setup(
name="gql",
version="3.0.0a1",
version=about["__version__"],
description="GraphQL client for Python",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 53c7a32

Please sign in to comment.