Skip to content

Add 3.10 python to the testing matrix #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 6, 2023
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
38 changes: 38 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: pre-commit

on:
pull_request:
branches:
- master
types:
- opened
- reopened
- ready_for_review
- synchronize

env:
SKIP: pytest-check

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0 # get full git history
- uses: actions/setup-python@v3
with:
cache: 'pip'
- name: Install pre-commit
run: |
pip install pre-commit
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v21
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run pre-commit
uses: pre-commit/action@v2.0.3
with:
extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9, '3.10']
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
Expand Down
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
exclude: ^(setup.cfg|btrdb/grpcinterface)
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black-jupyter
args: [--line-length=88]
exclude: btrdb/grpcinterface/.*\.py
- repo: https://github.com/pycqa/isort
rev: 5.11.5
hooks:
- id: isort
name: isort (python)
args: [--profile=black, --line-length=88]
exclude: btrdb/grpcinterface/.*\.py
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
args: [--config=setup.cfg]
exclude: ^(btrdb/grpcinterface|tests|setup.py|btrdb4|docs)
- repo: local
hooks:
- id: pytest-check
name: pytest-check
entry: pytest
language: system
pass_filenames: false
always_run: true
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ global-exclude *.py[co]
global-exclude .ipynb_checkpoints
global-exclude .DS_Store
global-exclude .env
global-exclude .coverage.*
global-exclude .coverage.*
18 changes: 11 additions & 7 deletions btrdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
## Imports
##########################################################################

from btrdb.conn import Connection, BTrDB
from warnings import warn

from btrdb.conn import BTrDB, Connection
from btrdb.endpoint import Endpoint
from btrdb.exceptions import ConnectionError
from btrdb.version import get_version
from btrdb.utils.credentials import credentials_by_profile, credentials
from btrdb.stream import MAXIMUM_TIME, MINIMUM_TIME
from btrdb.utils.credentials import credentials, credentials_by_profile
from btrdb.utils.ray import register_serializer
from btrdb.stream import MINIMUM_TIME, MAXIMUM_TIME
from warnings import warn
from btrdb.version import get_version

##########################################################################
## Module Variables
Expand All @@ -39,9 +40,11 @@
## Functions
##########################################################################


def _connect(endpoints=None, apikey=None):
return BTrDB(Endpoint(Connection(endpoints, apikey=apikey).channel))


def connect(conn_str=None, apikey=None, profile=None, shareable=False):
"""
Connect to a BTrDB server.
Expand Down Expand Up @@ -78,7 +81,9 @@ def connect(conn_str=None, apikey=None, profile=None, shareable=False):

# check shareable flag and register custom serializer if necessary
if shareable:
warn("a shareable connection is potentially insecure; other users of the same cluster may be able to access your API key")
warn(
"a shareable connection is potentially insecure; other users of the same cluster may be able to access your API key"
)
register_serializer(conn_str=conn_str, apikey=apikey, profile=profile)

# use specific profile if requested
Expand All @@ -91,4 +96,3 @@ def connect(conn_str=None, apikey=None, profile=None, shareable=False):
return _connect(**creds)

raise ConnectionError("Could not determine credentials to use.")

10 changes: 4 additions & 6 deletions btrdb/conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,20 @@
## Imports
##########################################################################

import json
import os
import re
import json
import certifi
import logging
import uuid as uuidlib
from concurrent.futures import ThreadPoolExecutor

import certifi
import grpc
from grpc._cython.cygrpc import CompressionAlgorithm

from btrdb.exceptions import InvalidOperation, StreamNotFoundError
from btrdb.stream import Stream, StreamSet
from btrdb.utils.general import unpack_stream_descriptor
from btrdb.utils.conversion import to_uuid
from btrdb.exceptions import StreamNotFoundError, InvalidOperation
from btrdb.utils.general import unpack_stream_descriptor

##########################################################################
## Module Variables
Expand Down Expand Up @@ -128,7 +127,6 @@ def _is_arrow_enabled(info):
else:
return False


class BTrDB(object):
"""
The primary server connection object for communicating with a BTrDB server.
Expand Down
5 changes: 2 additions & 3 deletions btrdb/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@

import grpc

from btrdb.grpcinterface import btrdb_pb2
from btrdb.grpcinterface import btrdb_pb2_grpc
from btrdb.exceptions import BTrDBError, check_proto_stat, error_handler
from btrdb.grpcinterface import btrdb_pb2, btrdb_pb2_grpc
from btrdb.point import RawPoint
from btrdb.exceptions import BTrDBError, error_handler, check_proto_stat
from btrdb.utils.general import unpack_stream_descriptor

logger = logging.getLogger(__name__)
Expand Down
Loading