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
30 changes: 23 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@ on:
push:
tags:
- 'v*'
branches:
- 'beta/**'

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install -r dev-requirements.txt
- name: Run tests
Expand All @@ -25,14 +30,25 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Verify tag matches version.py
python-version: '3.13'
- name: Verify version (tag or beta branch)
run: |
TAG=${GITHUB_REF#refs/tags/v}
VERSION=$(python -c "exec(open('floe/version.py').read()); print(__version__)")
if [ "$TAG" != "$VERSION" ]; then
echo "Tag v$TAG does not match version.py ($VERSION)"
exit 1
echo "VERSION=$VERSION" >> $GITHUB_ENV

if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
TAG=${GITHUB_REF#refs/tags/v}
if [ "$TAG" != "$VERSION" ]; then
echo "::error::Tag v$TAG does not match version.py ($VERSION)"
exit 1
fi
echo "Publishing stable release: $VERSION"
elif [[ "$GITHUB_REF" == refs/heads/beta/* ]]; then
if [[ ! "$VERSION" =~ (a|b|rc)[0-9]+$ ]]; then
echo "::error::Beta branch requires pre-release version (e.g., 0.1.0b1), got: $VERSION"
exit 1
fi
echo "Publishing beta release: $VERSION"
fi
- name: Install build tools
run: pip install build wheel
Expand Down
5 changes: 1 addition & 4 deletions floe/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
except ImportError:
MySQLFloe = None

try:
from urllib.parse import urlparse, parse_qs
except ImportError:
from urlparse import urlparse, parse_qs
from urllib.parse import urlparse, parse_qs

logger = logging.getLogger(__name__)

Expand Down
16 changes: 8 additions & 8 deletions floe/restserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def on_get(self, req, resp, domain, key):
@app_trace
def on_put(self, req, resp, domain, key):
cs = get_connection(domain)
cs.set(key, req.stream.read())
cs.set(key, req.bounded_stream.read())
resp.text = self.OK_RESPONSE

@app_trace
Expand All @@ -72,42 +72,42 @@ def format_error(ex, resp, code='INTERNAL',
resp.text = str(ex.message)


def generic_error_handler(ex, req, resp, params):
def generic_error_handler(req, resp, ex, params):
logger.exception("Internal error: %s", ex)
format_error(ex, resp, code='INTERNAL',
status=falcon.HTTP_INTERNAL_SERVER_ERROR)


def configuration_error_handler(ex, req, resp, params):
def configuration_error_handler(req, resp, ex, params):
logger.error("Configuration error: %s", ex)
format_error(ex, resp, code='CONFIGURATION', status=falcon.HTTP_400)


def operational_error_handler(ex, req, resp, params):
def operational_error_handler(req, resp, ex, params):
logger.exception("Operational error: %s", ex)
format_error(ex, resp, code='OPERATIONAL',
status=falcon.HTTP_INTERNAL_SERVER_ERROR)


def read_error_handler(ex, req, resp, params):
def read_error_handler(req, resp, ex, params):
logger.exception("Read error: %s", ex)
format_error(ex, resp, code='READ',
status=falcon.HTTP_INTERNAL_SERVER_ERROR)


def write_error_handler(ex, req, resp, params):
def write_error_handler(req, resp, ex, params):
logger.exception("Write error: %s", ex)
format_error(ex, resp, code='WRITE',
status=falcon.HTTP_INTERNAL_SERVER_ERROR)


def delete_error_handler(ex, req, resp, params):
def delete_error_handler(req, resp, ex, params):
logger.exception("Delete error: %s", ex)
format_error(ex, resp, code='DELETE',
status=falcon.HTTP_INTERNAL_SERVER_ERROR)


def invalid_key_handler(ex, req, resp, params):
def invalid_key_handler(req, resp, ex, params):
logger.warning("Invalid key: %s", ex)
format_error(ex, resp, code='INVALID-KEY', status=falcon.HTTP_400)

Expand Down
2 changes: 1 addition & 1 deletion floe/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.16'
__version__ = '0.1.0'
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
falcon<4.0.0
falcon>=3.0.0,<5.0.0
requests
opentelemetry-api
15 changes: 9 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env python
import os
import re
from os import path
from setuptools import setup
import imp

MYDIR = path.abspath(os.path.dirname(__file__))
long_description = open(os.path.join(MYDIR, 'README.md')).read()

version = imp.load_source('version',
path.join('.', 'floe', 'version.py')).__version__
with open(path.join(MYDIR, 'floe', 'version.py')) as f:
version = re.search(r"__version__ = ['\"]([^'\"]+)['\"]", f.read()).group(1)

setup(
name='floe',
Expand All @@ -21,17 +21,20 @@
classifiers=[
'Development Status :: 4 - Beta',
'Programming Language :: Python',
'Programming Language :: Python',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Programming Language :: Python :: 3',
'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',
'Environment :: Web Environment',
'Operating System :: POSIX',
],
license='MIT',
python_requires='>=3.10',
install_requires=[
'falcon>=0.3.0,<4.0.0',
'falcon>=3.0.0,<5.0.0',
'requests',
'opentelemetry-api',
],
Expand Down
2 changes: 1 addition & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class RestServerAdditionalRoute(object):

def on_get(self, req, resp):
resp.content_type = 'text/plain'
resp.body = 'additional'
resp.text = 'additional'


class RestServerTest(unittest.TestCase):
Expand Down
Loading