Skip to content

Commit

Permalink
Use setuptools_scm to track version. (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
jettify authored Mar 18, 2023
1 parent 91aeddf commit d555fcb
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
interval: monthly
day: "monday"
time: "10:00"
open-pull-requests-limit: 10
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
git fetch --tags
sudo apt-get install -y libsqliteodbc unixodbc
odbcinst -j
cat /etc/odbcinst.ini
Expand Down
6 changes: 4 additions & 2 deletions aioodbc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

from pyodbc import dataSources as _dataSources

from ._version import version, version_tuple
from .connection import Connection, connect
from .pool import Pool, create_pool

__version__ = "0.4.0"
__all__ = ["connect", "Connection", "create_pool", "Pool", "dataSources"]
__version__ = version
__version_tuple__ = version_tuple
__all__ = ("connect", "Connection", "create_pool", "Pool", "dataSources")


async def dataSources(loop=None, executor=None):
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# pyproject.toml
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2", "setuptools_scm_git_archive"]

[tool.setuptools_scm]
write_to = "aioodbc/_version.py"
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ flake8-pyi==23.3.0
flake8-tuple==0.4.1
flake8==3.9.2
ipdb==0.13.13
twine==4.0.2
ipython==8.11.0
isort==5.12.0
pyodbc==4.0.35
Expand Down
31 changes: 16 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import re

from setuptools import find_packages, setup

Expand All @@ -13,18 +12,6 @@ def read(f):
extras_require = {}


def read_version():
regexp = re.compile(r'^__version__\W*=\W*"([\d.abrc]+)"')
init_py = os.path.join(os.path.dirname(__file__), "aioodbc", "__init__.py")
with open(init_py) as f:
for line in f:
match = regexp.match(line)
if match is not None:
return match.group(1)
else:
raise RuntimeError("Cannot find version in aioodbc/__init__.py")


classifiers = [
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Developers",
Expand All @@ -42,22 +29,36 @@ def read_version():
"Framework :: AsyncIO",
]

project_urls = {
"Website": "https://github.com/jettify/uddsketch",
"Documentation": "https://uddsketch.readthedocs.io",
"Issues": "https://github.com/jettify/uddsketch/issues",
}


setup(
name="aioodbc",
version=read_version(),
description=("ODBC driver for asyncio."),
long_description="\n\n".join((read("README.rst"), read("CHANGES.txt"))),
long_description_content_type="text/x-rst",
classifiers=classifiers,
platforms=["POSIX"],
author="Nikolay Novik",
author_email="[email protected]",
url="https://github.com/aio-libs/aioodbc",
download_url="https://pypi.python.org/pypi/aioodbc",
license="Apache 2",
packages=find_packages(),
packages=find_packages(exclude=("tests",)),
python_requires=">=3.7",
install_requires=install_requires,
setup_requires=[
"setuptools>=45",
"setuptools_scm",
"setuptools_scm_git_archive",
"wheel",
],
extras_require=extras_require,
include_package_data=True,
project_urls=project_urls,
use_scm_version=True,
)

0 comments on commit d555fcb

Please sign in to comment.