Skip to content

Commit f41a217

Browse files
authored
Reorganize project; modify tests for SQLA 1.4 (#141)
Reorganize project structure to conform with SQLALchemy's explicit dialect/driver architecture. Adjust tests to pass under SQLA 1.4, including when v2.0 deprecation warnings are enabled (SQLALCHEMY_WARN_20=1).
1 parent a00b675 commit f41a217

29 files changed

+984
-710
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ build/
1616
env/
1717
cockroach-data/
1818
cockroach.pid
19+
20+
# local test configuration
21+
test.cfg

cockroachdb/sqlalchemy/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

cockroachdb/sqlalchemy/test_requirements.py

Lines changed: 0 additions & 132 deletions
This file was deleted.

dev-requirements.txt

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,45 @@
44
# generated dev-requirements.txt), run make update-requirements,
55
# then re-run bootstrap.sh.
66

7-
flake8==3.9.1
8-
tox==3.23.0
7+
flake8==3.9.2
8+
tox==3.23.1
99
# Twine is used in the release process to upload the package.
1010
twine==3.4.1
1111
## The following requirements were added by pip freeze:
1212
appdirs==1.4.4
1313
bleach==3.3.0
14-
certifi==2020.12.5
14+
certifi==2021.5.30
15+
cffi==1.14.5
1516
chardet==4.0.0
1617
colorama==0.4.4
17-
distlib==0.3.1
18+
cryptography==3.4.7
19+
distlib==0.3.2
1820
docutils==0.17.1
1921
filelock==3.0.12
2022
idna==2.10
21-
importlib-metadata==4.0.1
23+
importlib-metadata==4.4.0
24+
jeepney==0.6.0
2225
keyring==23.0.1
2326
mccabe==0.6.1
2427
packaging==20.9
2528
pkginfo==1.7.0
2629
pluggy==0.13.1
2730
py==1.10.0
2831
pycodestyle==2.7.0
32+
pycparser==2.20
2933
pyflakes==2.3.1
30-
Pygments==2.8.1
34+
Pygments==2.9.0
3135
pyparsing==2.4.7
3236
readme-renderer==29.0
3337
requests==2.25.1
3438
requests-toolbelt==0.9.1
35-
rfc3986==1.4.0
36-
six==1.15.0
39+
rfc3986==1.5.0
40+
SecretStorage==3.3.1
41+
six==1.16.0
3742
toml==0.10.2
38-
tqdm==4.60.0
39-
typing-extensions==3.7.4.3
43+
tqdm==4.61.0
44+
typing-extensions==3.10.0.0
4045
urllib3==1.26.5
41-
virtualenv==20.4.4
46+
virtualenv==20.4.7
4247
webencodings==0.5.1
4348
zipp==3.4.1

setup.cfg

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
[tool:pytest]
2+
addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings
3+
python_files=test/*test_*.py
4+
15
[sqla_testing]
2-
requirement_cls = cockroachdb.sqlalchemy.test_requirements:Requirements
3-
profile_file=.profiles.txt
6+
requirement_cls = sqlalchemy_cockroachdb.requirements:Requirements
7+
profile_file=test/profiles.txt
48

59
[db]
610
default=cockroachdb://root@localhost:26257/defaultdb?disable_cockroachdb_telemetry=True

setup.py

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,42 @@
1-
from setuptools import setup
1+
import os
2+
import re
23

3-
with open("README.md", "r") as fh:
4-
long_description = fh.read()
4+
from setuptools import setup, find_packages
5+
6+
with open(os.path.join(os.path.dirname(__file__), "sqlalchemy_cockroachdb", "__init__.py")) as v:
7+
VERSION = re.compile(r'.*__version__ = "(.*?)"', re.S).match(v.read()).group(1)
8+
9+
readme = os.path.join(os.path.dirname(__file__), "README.md")
510

611
setup(
7-
name='sqlalchemy-cockroachdb',
8-
version='1.3.3',
9-
author='Cockroach Labs',
10-
author_email='cockroach-db@googlegroups.com',
11-
url='https://github.com/cockroachdb/sqlalchemy-cockroachdb',
12-
description='CockroachDB adapter for SQLAlchemy',
13-
long_description=long_description,
12+
name="sqlalchemy-cockroachdb",
13+
version=VERSION,
14+
author="Cockroach Labs",
15+
author_email="cockroach-db@googlegroups.com",
16+
url="https://github.com/cockroachdb/sqlalchemy-cockroachdb",
17+
description="CockroachDB dialect for SQLAlchemy",
18+
long_description=open(readme).read(),
1419
long_description_content_type="text/markdown",
1520
license="http://www.apache.org/licenses/LICENSE-2.0",
1621
classifiers=[
17-
'License :: OSI Approved :: Apache Software License',
18-
'Programming Language :: Python :: 2',
19-
'Programming Language :: Python :: 3',
20-
],
21-
22-
packages=['cockroachdb', 'cockroachdb.sqlalchemy'],
22+
"License :: OSI Approved :: Apache Software License",
23+
"Programming Language :: Python :: 2",
24+
"Programming Language :: Python :: 3",
25+
],
26+
keywords="SQLAlchemy CockroachDB",
27+
project_urls={
28+
"Documentation": "https://github.com/cockroachdb/sqlalchemy-cockroachdb/wiki",
29+
"Source": "https://github.com/cockroachdb/sqlalchemy-cockroachdb",
30+
"Tracker": "https://github.com/cockroachdb/sqlalchemy-cockroachdb/issues",
31+
},
32+
packages=find_packages(include=["sqlalchemy_cockroachdb"]),
33+
include_package_data=True,
34+
install_requires=["SQLAlchemy"],
35+
zip_safe=False,
2336
entry_points={
24-
'sqlalchemy.dialects': [
25-
'cockroachdb = cockroachdb.sqlalchemy.dialect:CockroachDBDialect',
37+
"sqlalchemy.dialects": [
38+
"cockroachdb.psycopg2 = sqlalchemy_cockroachdb.psycopg2:CockroachDBDialect_psycopg2",
39+
"cockroachdb = sqlalchemy_cockroachdb.psycopg2:CockroachDBDialect_psycopg2",
2640
],
2741
},
2842
)

sqlalchemy_cockroachdb/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from sqlalchemy.dialects import registry as _registry
2+
3+
__version__ = "1.3.4.dev0"
4+
5+
_registry.register(
6+
"cockroachdb.psycopg2",
7+
"sqlalchemy_cockroachdb.psycopg2",
8+
"CockroachDBDialect_psycopg2",
9+
)

0 commit comments

Comments
 (0)