Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions doc/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ The ``doc/`` folder is monitored and automatically published by `Read the Docs <
Releasing
---------

Update version in ``pytd/version.py``. Set it to ``1.0.0``, for example:
Update version in ``setup.cfg``. Set it to ``1.0.0``, for example:

.. code:: py
.. code:: ini

__version__ = "1.0.0"
[metadata]
name = pytd
version = 1.0.0

Commit and push the latest code, and tag the version:

Expand Down
4 changes: 3 additions & 1 deletion pytd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import logging

import pkg_resources

from .client import Client
from .version import __version__

__version__ = pkg_resources.get_distribution("pytd").version
logger = logging.getLogger(__name__)
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.INFO)
Expand Down
3 changes: 2 additions & 1 deletion pytd/query_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import os
from urllib.parse import urlparse

import pkg_resources
import prestodb
import tdclient

from .version import __version__
__version__ = pkg_resources.get_distribution("pytd").version

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion pytd/tests/test_query_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import prestodb
import tdclient

from pytd import __version__
from pytd.query_engine import HiveQueryEngine, PrestoQueryEngine
from pytd.version import __version__


class QueryEngineEndpointSchemeTestCase(unittest.TestCase):
Expand Down
1 change: 0 additions & 1 deletion pytd/version.py

This file was deleted.

50 changes: 50 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@
[metadata]
name = pytd
version = 1.4.0
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately version = attr: pytd.__version__ doesn't work well while there was improvement for it
https://stackoverflow.com/questions/58202909/modulenotfounderror-when-using-setup-cfg-and-version-accessed-with-attr
pypa/setuptools#1753

summary = Treasure Data Driver for Python
author = Treasure Data
author_email = support@treasure-data.com
maintainer = Treasure Data
maintainer_email = support@treasure-data.com
license = Apache License 2.0
license_files =
LICENSE
long_description = file: README.rst
url = https://github.com/treasure-data/pytd
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
Topic :: Database
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8

[options]
packages = find:
python_requires = >=3.6,<3.9
install_requires =
urllib3<1.25,>=1.21.1
presto-python-client>=0.6.0
pandas>=0.25.0
td-client>=1.1.0
pytz>=2018.5
numpy<1.20

[options.extras_require]
spark =
td-pyspark>20.10.0
pyspark>=3.0.0
pyarrow>=0.12.1
test = pytest
doc =
sphinx>=2.2.0
sphinx_rtd_theme
numpydoc
ipython

[options.packages.find]
exclude = *tests*

[flake8]
ignore = E203, W503
max-line-length = 88
Expand Down
82 changes: 2 additions & 80 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,81 +1,3 @@
"""Treasure Data Driver for Python
from setuptools import setup

pytd is a Python interface to Treasure Data data management platform. Unlike
td-client-python, the official Treasure Data API library for Python, pytd gives
a direct access to their back-end query and storage engines. The seamless
connection allows your Python code to read and write a large volume of data in
a shorter time. It eventually makes your day-to-day data analytics work more
efficient and productive.
"""
import ast
import re
from os import path

with open("pytd/version.py", "rb") as f:
version_re = re.compile(r"__version__\s+=\s+(.*)")
VERSION = str(
ast.literal_eval(version_re.search(f.read().decode("utf-8")).group(1))
)

with open(
path.join(path.abspath(path.dirname(__file__)), "README.rst"), encoding="utf-8"
) as f:
long_description = f.read()

DISTNAME = "pytd"
DESCRIPTION = "Treasure Data Driver for Python"
LONG_DESCRIPTION = long_description or __doc__
AUTHOR = "Treasure Data"
AUTHOR_EMAIL = "support@treasure-data.com"
MAINTAINER = AUTHOR
MAINTAINER_EMAIL = AUTHOR_EMAIL
LICENSE = "Apache License 2.0"
URL = "https://github.com/treasure-data/pytd"


def setup_package():
from setuptools import find_packages, setup

metadata = dict(
name=DISTNAME,
version=VERSION,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
long_description_content_type="text/x-rst",
author=AUTHOR,
author_email=AUTHOR_EMAIL,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
license=LICENSE,
url=URL,
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Topic :: Database",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
packages=find_packages(exclude=["*tests*"]),
install_requires=[
"urllib3<1.25,>=1.21.1",
"presto-python-client>=0.6.0",
"pandas>=0.25.0",
"td-client>=1.1.0",
"pytz>=2018.5",
],
extras_require={
"spark": ["td-pyspark>20.10.0", "pyspark>=3.0.0", "pyarrow>=0.12.1"],
"test": ["pytest"],
"doc": ["sphinx>=2.2.0", "sphinx_rtd_theme", "numpydoc", "ipython"],
},
)

setup(**metadata)


if __name__ == "__main__":
setup_package()
setup()