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
15 changes: 15 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[flake8]
exclude =
docs/*
resources/*
licenses/*
max-complexity = 45
max-line-length = 90
min-python-version = 3.9.0
per-file-ignores =
singlestoredb/__init__.py:F401
singlestoredb/fusion/__init__.py:F401
singlestoredb/fusion/grammar.py:E501
singlestoredb/http/__init__.py:F401
singlestoredb/management/__init__.py:F401
singlestoredb/mysql/__init__.py:F401
7 changes: 1 addition & 6 deletions .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r test-requirements.txt

- name: Install SingleStore package
run: |
pip install .
pip install -e ".[dev]"

- name: Check for changes in monitored directories
id: check-changes
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r test-requirements.txt

- name: Install SingleStore package
run: |
pip install .
pip install -e ".[dev]"

- name: Run MySQL protocol tests
run: |
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/fusion-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ jobs:
run: |
python --version
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Install package
run: |
pip install .

- name: Build Fusion docs
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: |
python --version
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install .

- name: Initialize database
id: initialize-database
Expand Down Expand Up @@ -78,8 +78,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r test-requirements.txt
pip install -e ".[dev]"

- name: Build sdist
if: runner.os == 'Linux'
Expand Down Expand Up @@ -211,7 +210,7 @@ jobs:
run: |
python --version
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install .

- name: Drop database
if: ${{ always() }}
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: |
python --version
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install .

- name: Initialize database
id: initialize-database
Expand Down Expand Up @@ -111,12 +111,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r test-requirements.txt

- name: Install SingleStore package
run: |
pip install . --no-build-isolation
pip install -e ".[dev]"

- name: Run tests
if: ${{ matrix.driver != 'https' }}
Expand Down Expand Up @@ -151,7 +146,7 @@ jobs:
run: |
python --version
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install .

- name: Drop database
if: ${{ always() }}
Expand Down
6 changes: 1 addition & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,12 @@ repos:
rev: v3.12.0
hooks:
- id: reorder-python-imports
args: [--py36-plus]
args: [--py39-plus]
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
hooks:
- id: add-trailing-comma
args: [--py36-plus]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
Expand Down
9 changes: 7 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ pre-commit run --all-files

To create a test environment, do the following:
```
pip install -r requirements.txt
pip install -r test-requirements.txt
pip install -e ".[dev]"
```

Or if you only need specific dependency groups:
```
pip install -e ".[test]" # Just testing dependencies
pip install -e ".[docs]" # Just documentation dependencies
```

If you have Docker installed, you can run the tests as follows. Note that
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resources/bump_version.py < major | minor | patch >

```

This will bump the version number in `setup.cfg` and `singlestoredb/__init__.py`
This will bump the version number in `pyproject.toml` and `singlestoredb/__init__.py`
using semantic versioning rules: minor bump for new features, patch bump for
bug fixes. It will genarete a list of changes since the last version and
ask for confirmation of the release notes in `docs/src/whatsnew.rst`.
Expand Down
4 changes: 2 additions & 2 deletions accel.c
Original file line number Diff line number Diff line change
Expand Up @@ -3079,11 +3079,11 @@ static PyObject *dump_rowdat_1_numpy(PyObject *self, PyObject *args, PyObject *k
PyErr_SetString(PyExc_ValueError, "value is outside the valid range for UNSIGNED INT"); \
goto error; \
}
#define CHECK_BIGINT(x, unsigned_input) if ((x) < ((unsigned_input) ? 0 : -9223372036854775808) || (x) > 9223372036854775807) { \
#define CHECK_BIGINT(x, unsigned_input) if ((x) < ((unsigned_input) ? 0 : INT64_MIN) || (x) > INT64_MAX) { \
PyErr_SetString(PyExc_ValueError, "value is outside the valid range for BIGINT"); \
goto error; \
}
#define CHECK_UNSIGNED_BIGINT(x, unsigned_input) if ((x) < 0 || (x) > 18446744073709551615) { \
#define CHECK_UNSIGNED_BIGINT(x, unsigned_input) if ((x) < 0) { \
PyErr_SetString(PyExc_ValueError, "value is outside the valid range for UNSIGNED BIGINT"); \
goto error; \
}
Expand Down
118 changes: 118 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
[build-system]
requires = ["build", "setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "singlestoredb"
version = "1.15.8"
description = "Interface to the SingleStoreDB database and workspace management APIs"
readme = {file = "README.md", content-type = "text/markdown"}
license = {text = "Apache-2.0"}
authors = [
{name = "SingleStore", email = "[email protected]"}
]
requires-python = ">=3.9"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Database",
]
dependencies = [
"PyJWT",
"parsimonious",
"requests",
"sqlparams",
"tomli>=1.1.0; python_version < '3.11'",
"typing-extensions<=4.13.2; python_version < '3.11'",
]

[project.urls]
Homepage = "https://github.com/singlestore-labs/singlestoredb-python"

[project.optional-dependencies]
dataframe = ["ibis-singlestoredb"]
dbt = ["dbt-singlestore"]
docker = ["docker"]
ed22519 = ["PyNaCl>=1.4.0"]
gssapi = ["gssapi"]
ibis = ["ibis-singlestoredb"]
kerberos = ["gssapi"]
pytest = ["pytest"]
rsa = ["cryptography"]
sqlalchemy = ["sqlalchemy-singlestoredb>=1.0.0"]
vectorstore = ["singlestore-vectorstore>=0.1.2"]

# Development dependency groups
test = [
"coverage",
"dash",
"fastapi",
"ipython",
"jupysql",
"pandas",
"parameterized",
"polars",
"pyarrow",
"pydantic",
"pytest",
"pytest-cov",
"singlestore-vectorstore>=0.1.2",
"uvicorn",
]
docs = [
"sphinx",
"sphinx_rtd_theme",
]
build = [
"build",
"setuptools>=61.0",
"wheel",
]
dev = [
"singlestoredb[test,docs,build]",
]

[project.entry-points.pytest11]
singlestoredb = "singlestoredb.pytest"

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
exclude = ["docs*", "resources*", "examples*", "licenses*"]

[tool.setuptools.package-data]
"*" = ["*.typed", "*.sql", "*.csv", "*.ipynb"]

[tool.pytest.ini_options]
markers = [
"management",
]

[tool.mypy]
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = false

[[tool.mypy.overrides]]
module = "testing.*"
disallow_untyped_defs = false

[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false

[tool.coverage.run]
source_pkgs = ["singlestoredb"]

[tool.coverage.report]
omit = [
"setup.py",
"*/tests/*",
"*/docs/*",
]
9 changes: 0 additions & 9 deletions requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion resources/build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
import sys
import time
from pathlib import Path
from re import Match
from typing import Any
from typing import Dict
from typing import List
from typing import Match
from typing import Optional

# Detect script location and set up paths
Expand Down
26 changes: 13 additions & 13 deletions resources/bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ def step(step_num: int, total_steps: int, message: str) -> None:


def get_current_version() -> str:
"""Get the current version from setup.cfg."""
setup_cfg_path = Path(__file__).parent.parent / 'setup.cfg'
with open(setup_cfg_path, 'r') as f:
"""Get the current version from pyproject.toml."""
pyproject_path = Path(__file__).parent.parent / 'pyproject.toml'
with open(pyproject_path, 'r') as f:
content = f.read()

match = re.search(r'^version\s*=\s*(.+)$', content, re.MULTILINE)
match = re.search(r'^version\s*=\s*["\'](.+)["\']$', content, re.MULTILINE)
if not match:
raise ValueError('Could not find version in setup.cfg')
raise ValueError('Could not find version in pyproject.toml')

return match.group(1).strip()

Expand Down Expand Up @@ -75,10 +75,10 @@ def update_version_in_file(file_path: Path, old_version: str, new_version: str)
with open(file_path, 'r') as f:
content = f.read()

# For setup.cfg
if file_path.name == 'setup.cfg':
pattern = r'^(version\s*=\s*)' + re.escape(old_version) + r'$'
replacement = r'\g<1>' + new_version
# For pyproject.toml
if file_path.name == 'pyproject.toml':
pattern = r'^(version\s*=\s*["\'])' + re.escape(old_version) + r'(["\'])$'
replacement = r'\g<1>' + new_version + r'\g<2>'
content = re.sub(pattern, replacement, content, flags=re.MULTILINE)

# For __init__.py
Expand Down Expand Up @@ -307,7 +307,7 @@ def stage_files() -> None:
status('📦 Staging files for commit...')

files_to_stage = [
'setup.cfg',
'pyproject.toml',
'singlestoredb/__init__.py',
'docs/src/whatsnew.rst',
'docs/', # All generated documentation files
Expand Down Expand Up @@ -360,8 +360,8 @@ def main() -> None:
step(2, 6, 'Updating version in files')
start_time = time.time()

update_version_in_file(Path(__file__).parent.parent / 'setup.cfg', current_version, new_version)
status(' ✓ Updated setup.cfg')
update_version_in_file(Path(__file__).parent.parent / 'pyproject.toml', current_version, new_version)
status(' ✓ Updated pyproject.toml')

update_version_in_file(
Path(__file__).parent.parent / 'singlestoredb' / '__init__.py',
Expand Down Expand Up @@ -399,7 +399,7 @@ def main() -> None:
status('🔄 Reverting version changes...')

# Revert version changes
update_version_in_file(Path(__file__).parent.parent / 'setup.cfg', new_version, current_version)
update_version_in_file(Path(__file__).parent.parent / 'pyproject.toml', new_version, current_version)
update_version_in_file(
Path(__file__).parent.parent / 'singlestoredb' / '__init__.py',
new_version,
Expand Down
Loading