-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QA and CI: Format code using ruff. Validate using ruff and mypy.
- Loading branch information
Showing
26 changed files
with
1,371 additions
and
941 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,7 +97,7 @@ function main() { | |
} | ||
|
||
function lint() { | ||
flake8 "$@" src bin | ||
poe lint | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,102 @@ | ||
[tool.mypy] | ||
mypy_path = "src" | ||
packages = [ | ||
"crate", | ||
] | ||
exclude = [ | ||
] | ||
check_untyped_defs = true | ||
explicit_package_bases = true | ||
ignore_missing_imports = true | ||
implicit_optional = true | ||
install_types = true | ||
namespace_packages = true | ||
non_interactive = true | ||
|
||
# Needed until `mypy-0.990` for `ConverterDefinition` in `converter.py`. | ||
# https://github.com/python/mypy/issues/731#issuecomment-1260976955 | ||
enable_recursive_aliases = true | ||
|
||
[tool.ruff] | ||
line-length = 80 | ||
|
||
extend-exclude = [ | ||
"/example_*", | ||
] | ||
|
||
lint.select = [ | ||
# Builtins | ||
"A", | ||
# Bugbear | ||
"B", | ||
# comprehensions | ||
"C4", | ||
# Pycodestyle | ||
"E", | ||
# eradicate | ||
"ERA", | ||
# Pyflakes | ||
"F", | ||
# isort | ||
"I", | ||
# pandas-vet | ||
"PD", | ||
# return | ||
"RET", | ||
# Bandit | ||
"S", | ||
"T20", | ||
"W", | ||
# flake8-2020 | ||
"YTT", | ||
] | ||
|
||
lint.extend-ignore = [ | ||
# Unnecessary variable assignment before `return` statement | ||
"RET504", | ||
# Unnecessary `elif` after `return` statement | ||
"RET505", | ||
] | ||
|
||
lint.per-file-ignores."example_*" = [ | ||
"ERA001", # Found commented-out code | ||
"T201", # Allow `print` | ||
] | ||
lint.per-file-ignores."devtools/*" = [ | ||
"T201", # Allow `print` | ||
] | ||
lint.per-file-ignores."examples/*" = [ | ||
"ERA001", # Found commented-out code | ||
"T201", # Allow `print` | ||
] | ||
lint.per-file-ignores."tests/*" = [ | ||
"S106", # Possible hardcoded password assigned to argument: "password" | ||
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes | ||
] | ||
|
||
|
||
# =================== | ||
# Tasks configuration | ||
# =================== | ||
|
||
[tool.poe.tasks] | ||
|
||
check = [ | ||
"lint", | ||
"test", | ||
] | ||
|
||
format = [ | ||
{ cmd = "ruff format ." }, | ||
# Configure Ruff not to auto-fix (remove!): | ||
# unused imports (F401), unused variables (F841), `print` statements (T201), and commented-out code (ERA001). | ||
{ cmd = "ruff check --fix --ignore=ERA --ignore=F401 --ignore=F841 --ignore=T20 --ignore=ERA001 ." }, | ||
] | ||
|
||
lint = [ | ||
{ cmd = "ruff format --check ." }, | ||
{ cmd = "ruff check ." }, | ||
{ cmd = "mypy" }, | ||
] | ||
|
||
test = [ | ||
{ cmd = "bin/test" }, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,78 +19,84 @@ | |
# with Crate these terms will supersede the license and you may use the | ||
# software solely pursuant to the terms of the relevant commercial agreement. | ||
|
||
from setuptools import setup, find_packages | ||
import os | ||
import re | ||
|
||
from setuptools import find_packages, setup | ||
|
||
|
||
def read(path): | ||
with open(os.path.join(os.path.dirname(__file__), path)) as f: | ||
return f.read() | ||
|
||
|
||
long_description = read('README.rst') | ||
long_description = read("README.rst") | ||
versionf_content = read("src/crate/client/__init__.py") | ||
version_rex = r'^__version__ = [\'"]([^\'"]*)[\'"]$' | ||
m = re.search(version_rex, versionf_content, re.M) | ||
if m: | ||
version = m.group(1) | ||
else: | ||
raise RuntimeError('Unable to find version string') | ||
raise RuntimeError("Unable to find version string") | ||
|
||
setup( | ||
name='crate', | ||
name="crate", | ||
version=version, | ||
url='https://github.com/crate/crate-python', | ||
author='Crate.io', | ||
author_email='[email protected]', | ||
package_dir={'': 'src'}, | ||
description='CrateDB Python Client', | ||
url="https://github.com/crate/crate-python", | ||
author="Crate.io", | ||
author_email="[email protected]", | ||
package_dir={"": "src"}, | ||
description="CrateDB Python Client", | ||
long_description=long_description, | ||
long_description_content_type='text/x-rst', | ||
platforms=['any'], | ||
license='Apache License 2.0', | ||
keywords='cratedb db api dbapi database sql http rdbms olap', | ||
packages=find_packages('src'), | ||
namespace_packages=['crate'], | ||
long_description_content_type="text/x-rst", | ||
platforms=["any"], | ||
license="Apache License 2.0", | ||
keywords="cratedb db api dbapi database sql http rdbms olap", | ||
packages=find_packages("src"), | ||
namespace_packages=["crate"], | ||
install_requires=[ | ||
'urllib3<2.3', | ||
'verlib2==0.2.0', | ||
"urllib3<2.3", | ||
"verlib2==0.2.0", | ||
], | ||
extras_require=dict( | ||
test=['tox>=3,<5', | ||
'zope.testing>=4,<6', | ||
'zope.testrunner>=5,<7', | ||
'zc.customdoctests>=1.0.1,<2', | ||
'backports.zoneinfo<1; python_version<"3.9"', | ||
'certifi', | ||
'createcoverage>=1,<2', | ||
'stopit>=1.1.2,<2', | ||
'flake8>=4,<8', | ||
'pytz', | ||
], | ||
doc=['sphinx>=3.5,<9', | ||
'crate-docs-theme>=0.26.5'], | ||
), | ||
python_requires='>=3.6', | ||
package_data={'': ['*.txt']}, | ||
extras_require={ | ||
"doc": [ | ||
"crate-docs-theme>=0.26.5", | ||
"sphinx>=3.5,<9", | ||
], | ||
"test": [ | ||
'backports.zoneinfo<1; python_version<"3.9"', | ||
"certifi", | ||
"createcoverage>=1,<2", | ||
"mypy<1.14", | ||
"poethepoet<0.30", | ||
"ruff<0.8", | ||
"stopit>=1.1.2,<2", | ||
"tox>=3,<5", | ||
"pytz", | ||
"zc.customdoctests>=1.0.1,<2", | ||
"zope.testing>=4,<6", | ||
"zope.testrunner>=5,<7", | ||
], | ||
}, | ||
python_requires=">=3.6", | ||
package_data={"": ["*.txt"]}, | ||
classifiers=[ | ||
'Development Status :: 5 - Production/Stable', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: Apache Software License', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: 3.10', | ||
'Programming Language :: Python :: 3.11', | ||
'Programming Language :: Python :: 3.12', | ||
'Programming Language :: Python :: 3.13', | ||
'Programming Language :: Python :: Implementation :: CPython', | ||
'Programming Language :: Python :: Implementation :: PyPy', | ||
'Topic :: Database' | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.6", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: 3.13", | ||
"Programming Language :: Python :: Implementation :: CPython", | ||
"Programming Language :: Python :: Implementation :: PyPy", | ||
"Topic :: Database", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.