From 9c1d80a56d4fed409994ef4bb557abfe11e7e2b1 Mon Sep 17 00:00:00 2001 From: Carl George Date: Mon, 15 Oct 2018 14:34:23 -0500 Subject: [PATCH 01/14] Make dependencies optional resolves #219 --- setup.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index e91fd3679..a813c06f4 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,6 @@ import os import re import sys -import platform from setuptools import setup @@ -60,8 +59,19 @@ def get_packages(package): author='Tom Christie', author_email='tom@tomchristie.com', packages=get_packages('uvicorn'), - install_requires=requirements, data_files = [("", ["LICENSE.md"])], + install_requires=[ + 'click' + 'h11', + 'wsproto' + ], + extras_require={ + 'full': [ + 'uvloop', + 'httptools', + 'websockets>=6.0' + ] + }, classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', From 5c5b17cc19e0e271ee6585b2b5241f43f3488c0b Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Sun, 10 Feb 2019 18:08:02 +0100 Subject: [PATCH 02/14] Tweak install options and update installation instructions in readme --- README.md | 3 ++- requirements.txt | 2 ++ setup.py | 14 +++----------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 0f76a9725..f02972fd7 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,8 @@ Uvicorn currently supports HTTP/1.1 and WebSockets. Support for HTTP/2 is planne Install using `pip`: ```shell -$ pip install uvicorn +$ pip install uvicorn[pure] # Install pure Python deps (works anywhere) +$ pip install uvicorn[fast] # Install fast deps (not for e.g. Windows or Pypy) ``` Create an application, in `example.py`: diff --git a/requirements.txt b/requirements.txt index 0e0333e3e..1b5e213ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,6 @@ click + +# Pure h11 # Optional diff --git a/setup.py b/setup.py index a813c06f4..716d979df 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,6 @@ import os import re -import sys from setuptools import setup @@ -60,17 +59,10 @@ def get_packages(package): author_email='tom@tomchristie.com', packages=get_packages('uvicorn'), data_files = [("", ["LICENSE.md"])], - install_requires=[ - 'click' - 'h11', - 'wsproto' - ], + install_requires=['click'], extras_require={ - 'full': [ - 'uvloop', - 'httptools', - 'websockets>=6.0' - ] + 'pure': ['h11', 'wsproto==0.13.*'], + 'fast': ['uvloop', 'httptools', 'websockets>=6.0'], }, classifiers=[ 'Development Status :: 4 - Beta', From bd58915135cf79173af5334e7e5422f671a4b3ee Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Mon, 4 Nov 2019 10:43:33 +0100 Subject: [PATCH 03/14] update to latest conclusion --- README.md | 4 ++-- requirements.txt | 3 +-- setup.py | 12 ++++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f02972fd7..e058a5a6f 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,8 @@ Uvicorn currently supports HTTP/1.1 and WebSockets. Support for HTTP/2 is planne Install using `pip`: ```shell -$ pip install uvicorn[pure] # Install pure Python deps (works anywhere) -$ pip install uvicorn[fast] # Install fast deps (not for e.g. Windows or Pypy) +$ pip install uvicorn # Install with minimal (pure Python) deps +$ pip install uvicorn[default] # Install with fast deps (where possible) ``` Create an application, in `example.py`: diff --git a/requirements.txt b/requirements.txt index 1b5e213ee..2be375b82 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ +# Minimal click - -# Pure h11 # Optional diff --git a/setup.py b/setup.py index 716d979df..58252478c 100755 --- a/setup.py +++ b/setup.py @@ -38,9 +38,12 @@ def get_packages(package): " and platform_python_implementation != 'pypy'" ) -requirements = [ +minimal_requirements = [ "click==7.*", "h11==0.8.*", +] + +extra_requirements = [ "websockets==8.*", "httptools==0.0.13 ;" + env_marker, "uvloop==0.14.0rc2 ;" + env_marker, @@ -59,11 +62,8 @@ def get_packages(package): author_email='tom@tomchristie.com', packages=get_packages('uvicorn'), data_files = [("", ["LICENSE.md"])], - install_requires=['click'], - extras_require={ - 'pure': ['h11', 'wsproto==0.13.*'], - 'fast': ['uvloop', 'httptools', 'websockets>=6.0'], - }, + install_requires=minimal_requirements, + extras_require={'default': extra_requirements}, classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', From 6341b416fbf4bb00e4a3de0d4e548c58c669b200 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Mon, 4 Nov 2019 12:30:22 +0100 Subject: [PATCH 04/14] rename default -> standard --- README.md | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e058a5a6f..554d4a8b9 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Install using `pip`: ```shell $ pip install uvicorn # Install with minimal (pure Python) deps -$ pip install uvicorn[default] # Install with fast deps (where possible) +$ pip install uvicorn[standard] # Install with fast deps (where possible) ``` Create an application, in `example.py`: diff --git a/setup.py b/setup.py index 58252478c..8ebf9c7e2 100755 --- a/setup.py +++ b/setup.py @@ -63,7 +63,7 @@ def get_packages(package): packages=get_packages('uvicorn'), data_files = [("", ["LICENSE.md"])], install_requires=minimal_requirements, - extras_require={'default': extra_requirements}, + extras_require={'standard': extra_requirements}, classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', From 456f2c7c070090961adb92587a162e5c71b23d52 Mon Sep 17 00:00:00 2001 From: euri10 Date: Tue, 5 May 2020 09:08:13 +0200 Subject: [PATCH 05/14] Incoroporate other reqs --- requirements.txt | 4 ++-- setup.py | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index 9509332da..197ab0fef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,6 +7,8 @@ httptools uvloop>=0.14.0 websockets==8.* wsproto==0.13.* +watchgod>=0.6,<0.7 +python_dotenv==0.13.* # Testing autoflake @@ -22,5 +24,3 @@ requests mkdocs mkdocs-material -# Efficient debug reload -watchgod>=0.6,<0.7 diff --git a/setup.py b/setup.py index bd838a752..e583359fa 100755 --- a/setup.py +++ b/setup.py @@ -34,22 +34,29 @@ def get_packages(package): ] -env_marker = ( +env_marker_cpython = ( "sys_platform != 'win32'" " and sys_platform != 'cygwin'" " and platform_python_implementation != 'PyPy'" ) +env_marker_win = ( + "sys_platform == 'win32'" +) + + minimal_requirements = [ "click==7.*", "h11>=0.8,<0.10", - "h11==0.8.*", ] extra_requirements = [ "websockets==8.*", - "httptools==0.1.* ;" + env_marker, - "uvloop>=0.14.0 ;" + env_marker, + "httptools==0.1.* ;" + env_marker_cpython, + "uvloop>=0.14.0 ;" + env_marker_cpython, + "colorama>=0.4.*;" + env_marker_win, + "watchgod>=0.6,<0.7", + "python-dotenv==0.13.*" ] From baf769ed1bbc35a8957daf81cdeb82a5e55a9b28 Mon Sep 17 00:00:00 2001 From: euri10 Date: Tue, 5 May 2020 09:13:06 +0200 Subject: [PATCH 06/14] Added setup.py to black test, previous merge made me remove all double quotes in it --- scripts/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test b/scripts/test index d871a0e05..0b76d1787 100755 --- a/scripts/test +++ b/scripts/test @@ -11,4 +11,4 @@ PYTHONPATH=. ${PREFIX}pytest --ignore venv --cov=uvicorn --cov=tests --cov-repor ${PREFIX}coverage html ${PREFIX}autoflake --recursive uvicorn tests ${PREFIX}flake8 uvicorn tests --ignore=W503,E203,E501,E731 -${PREFIX}black uvicorn tests --check +${PREFIX}black uvicorn tests setup.py --check From 6b1853bc0a95e16f166cedc52bc2eccf1994162e Mon Sep 17 00:00:00 2001 From: euri10 Date: Tue, 5 May 2020 09:13:47 +0200 Subject: [PATCH 07/14] Added setup.py to lint script to match test script --- scripts/lint | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lint b/scripts/lint index 023ea635c..c4cb6f1e4 100755 --- a/scripts/lint +++ b/scripts/lint @@ -8,5 +8,5 @@ fi set -x ${PREFIX}autoflake --in-place --recursive uvicorn tests -${PREFIX}black uvicorn tests +${PREFIX}black uvicorn tests setup.py ${PREFIX}isort --multi-line=3 --trailing-comma --force-grid-wrap=0 --combine-as --line-width 88 --recursive --apply uvicorn tests From e5ee5da535ed27ae6f62d9e5c260adb6f9f34954 Mon Sep 17 00:00:00 2001 From: euri10 Date: Tue, 5 May 2020 09:16:08 +0200 Subject: [PATCH 08/14] Lint setup.py --- setup.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index e583359fa..656e1f964 100755 --- a/setup.py +++ b/setup.py @@ -40,9 +40,7 @@ def get_packages(package): " and platform_python_implementation != 'PyPy'" ) -env_marker_win = ( - "sys_platform == 'win32'" -) +env_marker_win = "sys_platform == 'win32'" minimal_requirements = [ @@ -56,7 +54,7 @@ def get_packages(package): "uvloop>=0.14.0 ;" + env_marker_cpython, "colorama>=0.4.*;" + env_marker_win, "watchgod>=0.6,<0.7", - "python-dotenv==0.13.*" + "python-dotenv==0.13.*", ] @@ -67,13 +65,13 @@ def get_packages(package): license="BSD", description="The lightning-fast ASGI server.", long_description=get_long_description(), - long_description_content_type='text/markdown', - author='Tom Christie', - author_email='tom@tomchristie.com', - packages=get_packages('uvicorn'), - data_files = [("", ["LICENSE.md"])], + long_description_content_type="text/markdown", + author="Tom Christie", + author_email="tom@tomchristie.com", + packages=get_packages("uvicorn"), + data_files=[("", ["LICENSE.md"])], install_requires=minimal_requirements, - extras_require={'standard': extra_requirements}, + extras_require={"standard": extra_requirements}, classifiers=[ "Development Status :: 4 - Beta", "Environment :: Web Environment", From 6b05acb9005d329ecc3b5f6db731f37bcd39ce1d Mon Sep 17 00:00:00 2001 From: euri10 Date: Tue, 5 May 2020 09:19:30 +0200 Subject: [PATCH 09/14] Removed leftover from merge that was incorrect --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 656e1f964..1ea8a534c 100755 --- a/setup.py +++ b/setup.py @@ -69,9 +69,9 @@ def get_packages(package): author="Tom Christie", author_email="tom@tomchristie.com", packages=get_packages("uvicorn"), - data_files=[("", ["LICENSE.md"])], install_requires=minimal_requirements, extras_require={"standard": extra_requirements}, + include_package_data=True, classifiers=[ "Development Status :: 4 - Beta", "Environment :: Web Environment", From cab1bd237fc2428e2129c19f3d30626461885c99 Mon Sep 17 00:00:00 2001 From: euri10 Date: Tue, 5 May 2020 15:01:24 +0200 Subject: [PATCH 10/14] Trying to be more explicit about the 2 install options --- README.md | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c5e1ba4f1..6d175558a 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,29 @@ Uvicorn currently supports HTTP/1.1 and WebSockets. Support for HTTP/2 is planne Install using `pip`: ```shell -$ pip install uvicorn # Install with minimal (pure Python) deps -$ pip install uvicorn[standard] # Install with fast deps (where possible) +$ pip install uvicorn ``` +This will install uvicorn with minimal (pure Python) dependencies. + +```shell +$ pip install uvicorn[standard] +``` + +This will install uvicorn with "fast" dependencies (where possible) and other "goodies". + +Fast meaning in that context that: + +- the event loop `uvloop` will be installed and used if possible. +- the http protocol will be handled by `httptools` if possible. +- the websocket protocol will be handled by `websockets` (should you want to use `wsproto` you'd need to install it manually) if possible. + +Goodies meaning that: + +- the `--reloader` flag in development mode will use `watchgod`. +- windows users will have `colorama` installed for the colored logs. +- `python-dotenv` will be install should you want to use the `--env-file` option. + Create an application, in `example.py`: ```python From f9f63426bd398b3e66bcdb978203d2ad5cd326e9 Mon Sep 17 00:00:00 2001 From: euri10 Date: Sat, 1 Aug 2020 17:25:25 +0200 Subject: [PATCH 11/14] Spelling --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6d175558a..025f95745 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ $ pip install uvicorn[standard] This will install uvicorn with "fast" dependencies (where possible) and other "goodies". -Fast meaning in that context that: +In this context, "fast" means the following: - the event loop `uvloop` will be installed and used if possible. - the http protocol will be handled by `httptools` if possible. From c4fd2b6a550d4de7206a1216a9f1639b8b3112cc Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 10 Aug 2020 14:19:19 +0200 Subject: [PATCH 12/14] Newlines --- scripts/lint | 2 +- scripts/test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/lint b/scripts/lint index 73565a843..7925c3d7e 100755 --- a/scripts/lint +++ b/scripts/lint @@ -11,4 +11,4 @@ set -x ${PREFIX}autoflake --in-place --recursive $SOURCE_FILES ${PREFIX}seed-isort-config --application-directories=uvicorn ${PREFIX}isort --project=uvicorn $SOURCE_FILES -${PREFIX}black --target-version=py36 $SOURCE_FILES \ No newline at end of file +${PREFIX}black --target-version=py36 $SOURCE_FILES diff --git a/scripts/test b/scripts/test index cfebabe18..f9c991723 100755 --- a/scripts/test +++ b/scripts/test @@ -15,4 +15,4 @@ ${PREFIX}pytest $@ if [ -z $GITHUB_ACTIONS ]; then scripts/coverage -fi \ No newline at end of file +fi From 51545af055782a99dc912fb2a0e24b59cbdaffb0 Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 10 Aug 2020 14:41:30 +0200 Subject: [PATCH 13/14] Better wording --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 025f95745..46cf79e97 100644 --- a/README.md +++ b/README.md @@ -39,15 +39,15 @@ This will install uvicorn with minimal (pure Python) dependencies. $ pip install uvicorn[standard] ``` -This will install uvicorn with "fast" dependencies (where possible) and other "goodies". +This will install uvicorn with "Cython-based" dependencies (where possible) and other "optional extras". -In this context, "fast" means the following: +In this context, "Cython-based" means the following: - the event loop `uvloop` will be installed and used if possible. - the http protocol will be handled by `httptools` if possible. - the websocket protocol will be handled by `websockets` (should you want to use `wsproto` you'd need to install it manually) if possible. -Goodies meaning that: +Moreover, "optional extras" means that: - the `--reloader` flag in development mode will use `watchgod`. - windows users will have `colorama` installed for the colored logs. From 63d56350c01282c485c38369d9db8dbab6e6523e Mon Sep 17 00:00:00 2001 From: euri10 Date: Mon, 10 Aug 2020 14:49:02 +0200 Subject: [PATCH 14/14] Websockets vs wsproto more relevant in extras --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 46cf79e97..fe9924557 100644 --- a/README.md +++ b/README.md @@ -45,10 +45,10 @@ In this context, "Cython-based" means the following: - the event loop `uvloop` will be installed and used if possible. - the http protocol will be handled by `httptools` if possible. -- the websocket protocol will be handled by `websockets` (should you want to use `wsproto` you'd need to install it manually) if possible. Moreover, "optional extras" means that: +- the websocket protocol will be handled by `websockets` (should you want to use `wsproto` you'd need to install it manually) if possible. - the `--reloader` flag in development mode will use `watchgod`. - windows users will have `colorama` installed for the colored logs. - `python-dotenv` will be install should you want to use the `--env-file` option.