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
6 changes: 3 additions & 3 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
python -m build --sdist --no-isolation
for f in dist/httpout-*.tar.gz; do gzip -t "$f"; done

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/httpout-*.tar.gz
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
unzip -l "$f" | grep '\shttpout/utils/modules\..*\.so$';
done

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/httpout-*.whl
Expand All @@ -95,7 +95,7 @@ jobs:
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/tests_and_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ jobs:
contains(env.FILES_MODIFIED, '.py') &&
matrix.python_version == '3.13' && startsWith(matrix.os, 'windows-')

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.os }}
path: artifact
include-hidden-files: true
if: ${{ contains(env.FILES_MODIFIED, '.py') && matrix.python_version == '3.13' }}
Expand All @@ -113,7 +114,11 @@ jobs:
python -m pip install --upgrade tremolo
if: ${{ contains(env.FILES_MODIFIED, '.py') }}

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: artifact
pattern: artifact-*
merge-multiple: true
if: ${{ contains(env.FILES_MODIFIED, '.py') }}

- name: Combine and view report
Expand Down
4 changes: 2 additions & 2 deletions examples/import.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

from httpout import globals, context # noqa: F401
from httpout import app # noqa: F401
from httpout import globals, context, app # noqa: F401
from httpout import foo # noqa: F401
14 changes: 9 additions & 5 deletions httpout/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ def usage(**context):
print(' Intended for development')
print(' --log-level Defaults to "DEBUG". See')
print(' https://docs.python.org/3/library/logging.html#levels') # noqa: E501
print(' --log-fmt Python\'s log format. If empty defaults to "%(message)s"') # noqa: E501
print(' --loop A fully qualified event loop name')
print(' E.g. "asyncio" or "asyncio.SelectorEventLoop"') # noqa: E501
print(' It expects the respective module to already be present') # noqa: E501
print(' --shutdown-timeout Maximum number of seconds to wait after SIGTERM is') # noqa: E501
print(' sent to a worker process. Defaults to 30 (seconds)') # noqa: E501
print(' --version Print the httpout version and exit')
print(' --help Show this help and exit')
print()
Expand All @@ -68,11 +71,12 @@ def bind(value='', **context):

def version(**context):
print(
'httpout %s (tremolo %s, %s %d.%d.%d, %s)' % (__version__,
tremolo.__version__,
sys.implementation.name,
*sys.version_info[:3],
sys.platform)
'httpout %s (tremolo %s, %s %d.%d.%d, %s)' %
(__version__,
tremolo.__version__,
sys.implementation.name,
*sys.version_info[:3],
sys.platform)
)
return 0

Expand Down
9 changes: 3 additions & 6 deletions httpout/httpout.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@ def ho_import(name, globals=None, locals=None, fromlist=(), level=0):
module.__dict__[child] = module.__server__[
child
]
elif child in worker and (
child != 'app' or
'__server__' not in globals):
elif child in worker:
module.__dict__[child] = worker[child]
else:
raise ImportError(
Expand Down Expand Up @@ -225,10 +223,9 @@ async def _on_request(self, **server):
server['request'] = HTTPRequest(request, server)
server['response'] = HTTPResponse(response)

if (request.protocol.options['ws'] and
b'upgrade' in request.headers and
b'connection' in request.headers and
if (g.options['ws'] and
b'sec-websocket-key' in request.headers and
b'upgrade' in request.headers and
request.headers[b'upgrade'].lower() == b'websocket'):
server['websocket'] = WebSocket(request, response)
else:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description = """\
requires-python = '>=3.7'
dependencies = [
'awaiter',
'tremolo>=0.1.2',
'tremolo>=0.2.0',
]
license = { text = 'MIT License' }
classifiers = [
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
awaiter
tremolo>=0.1.2
tremolo>=0.2.0
2 changes: 1 addition & 1 deletion tests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_import_error(self):
)
self.assertEqual(
body,
b'5B\r\n<ul><li>ImportError: cannot import name &#x27;app&#x27; '
b'5B\r\n<ul><li>ImportError: cannot import name &#x27;foo&#x27; '
b'from &#x27;httpout&#x27;</li></ul>\n\r\n0\r\n\r\n'
)

Expand Down
Loading