Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavsingh authored Apr 11, 2024
2 parents d776506 + a8a7d7e commit 2ea89b9
Show file tree
Hide file tree
Showing 28 changed files with 146 additions and 99 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ extend-ignore =
WPS613 # FIXME: unmatching super method access
WPS615 # FIXME: unpythonic setter/getter
PT027 # FIXME: use pytest.raises() instead of unittest-style 'assertRaises'
S507 # FIXME: Paramiko call with policy set to automatically trust the unknown host key

# https://wemake-python-stylegui.de/en/latest/pages/usage/formatter.html
format = wemake
Expand Down
3 changes: 3 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true)$
ref-names: $Format:%D$
6 changes: 3 additions & 3 deletions .github/workflows/test-library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ jobs:
python -m
pip install
--user
tox==3.25.1
tox==3.28.0
- name: Grab the source from Git
uses: actions/checkout@v3
Expand Down Expand Up @@ -388,7 +388,7 @@ jobs:
python -m
pip install
--user
tox==3.25.1
tox==3.28.0
- name: Grab the source from Git
uses: actions/checkout@v3
Expand Down Expand Up @@ -505,7 +505,7 @@ jobs:
python -m
pip install
--user
tox==3.25.1
tox==3.28.0
- name: Grab the source from Git
uses: actions/checkout@v3
Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,10 @@ repos:
- paramiko == 2.11.0
- types-paramiko == 2.7.3
- types-requests==2.27.30
# From requirements-tunnel.txt
- cryptography==36.0.2; python_version <= '3.6'
- types-setuptools == 57.4.2
- pyyaml==5.3.1
args:
# FIXME: get rid of missing imports ignore
- --ignore-missing-imports
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ build:
# Optionally set the version of Python and requirements required
# to build docs
python:
# system_packages: false
install:
- method: pip
path: .
- requirements: requirements-tunnel.txt
- requirements: docs/requirements.txt
system_packages: false

...
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"editor.formatOnSaveMode": "modifications",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit"
},
"[yaml]": {
"editor.insertSpaces": true,
Expand All @@ -18,7 +18,7 @@
"typescript.format.semicolons": "remove",
"typescript.preferences.quoteStyle": "single",
"[python]": {
"editor.wordBasedSuggestions": true,
"editor.wordBasedSuggestions": "matchingDocuments",
"editor.defaultFormatter": null
},
"python.testing.unittestEnabled": false,
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@

Consult [Threads vs Threadless](#threads-vs-threadless) and [Threadless Remote vs Local Execution Mode](#threadless-remote-vs-local-execution-mode) to control number of CPU cores utilized.

See [Benchmark](https://github.com/abhinavsingh/proxy.py/tree/develop/benchmark#readme) for more details and for how to run benchmarks locally.
See [Benchmark](https://github.com/abhinavsingh/proxy.py/blob/develop/benchmark/README.md) for more details and for how to run benchmarks locally.

- Lightweight
- Uses only `~5-20 MB` RAM
Expand Down Expand Up @@ -2366,7 +2366,7 @@ usage: -m [-h] [--tunnel-hostname TUNNEL_HOSTNAME] [--tunnel-port TUNNEL_PORT]
[--filtered-client-ips FILTERED_CLIENT_IPS]
[--filtered-url-regex-config FILTERED_URL_REGEX_CONFIG]

proxy.py v2.4.4rc4.dev6+g4ee982a.d20221022
proxy.py v2.4.4rc5.dev36+g6c9d0315.d20240411

options:
-h, --help show this help message and exit
Expand Down
13 changes: 8 additions & 5 deletions benchmark/_blacksheep.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@
:license: BSD, see LICENSE for more details.
"""
import uvicorn
from blacksheep.server import Application
from blacksheep.server.responses import text


app = Application()
# from blacksheep.server import Application
# from blacksheep.server.responses import text


@app.route('/http-route-example')
# app = Application()


# @app.route('/http-route-example')
async def home(request): # type: ignore[no-untyped-def]
return text('HTTP route response')
# return text('HTTP route response')
pass

if __name__ == '__main__':
uvicorn.run('server:app', port=9000, workers=10, log_level='warning')
5 changes: 4 additions & 1 deletion benchmark/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
aiohttp==3.8.1
blacksheep==1.2.7
# Blacksheep depends upon essentials_openapi which is pinned to pyyaml==5.4.1
# and pyyaml>5.3.1 is broken for cython 3
# See https://github.com/yaml/pyyaml/issues/724#issuecomment-1638587228
# blacksheep==1.2.7
starlette==0.19.1
tornado==6.1
uvicorn==0.16.0
4 changes: 2 additions & 2 deletions docs/_ext/spelling_stub_ext.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Sphinx extension for making the spelling directive noop."""

from typing import List
from typing import Any, Dict, List

from sphinx.util.nodes import nodes
from sphinx.application import Sphinx
Expand All @@ -17,7 +17,7 @@ def run(self) -> List[nodes.Node]:
return []


def setup(app: Sphinx) -> None:
def setup(app: Sphinx) -> Dict[str, Any]:
"""Initialize the extension."""
app.add_directive('spelling', SpellingNoOpDirective)

Expand Down
12 changes: 12 additions & 0 deletions docs/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,15 @@ Sphinx == 4.3.2
furo >= 2021.11.15
sphinxcontrib-apidoc >= 0.3.0
sphinxcontrib-towncrier >= 0.2.0a0
# See https://github.com/yaml/pyyaml/issues/724#issuecomment-1638587228
pyyaml==5.3.1
# PIN to fix:
# The sphinxcontrib.applehelp extension used by this project needs at least Sphinx v5.0;
# it therefore cannot be built with this version.
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
sphinxcontrib-towncrier==0.2.1a0
towncrier==21.3.0
96 changes: 46 additions & 50 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe --generate-hashes --output-file=docs/requirements.txt --strip-extras docs/requirements.in
#
Expand Down Expand Up @@ -31,7 +31,9 @@ charset-normalizer==2.0.7 \
click==8.0.3 \
--hash=sha256:353f466495adaeb40b6b5f592f9f91cb22372351c84caeb068132442a4518ef3 \
--hash=sha256:410e932b050f5eed773c4cda94de75971c89cdb3155a72a0831139a79e5ecb5b
# via towncrier
# via
# click-default-group
# towncrier
click-default-group==1.2.2 \
--hash=sha256:d9560e8e8dfa44b3562fbc9425042a0fd6d21956fcc2db0077f63f34253ab904
# via towncrier
Expand All @@ -44,7 +46,7 @@ docutils==0.17.1 \
furo==2022.4.7 \
--hash=sha256:7f3e3d2fb977483590f8ecb2c2cd511bd82661b79c18efb24de9558bc9cdf2d7 \
--hash=sha256:96204ab7cd047e4b6c523996e0279c4c629a8fc31f4f109b2efd470c17f49c80
# via -r requirements.in
# via -r docs/requirements.in
idna==3.3 \
--hash=sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff \
--hash=sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d
Expand Down Expand Up @@ -152,7 +154,7 @@ mdit-py-plugins==0.3.0 \
myst-parser==0.17.2 \
--hash=sha256:1635ce3c18965a528d6de980f989ff64d6a1effb482e1f611b1bfb79e38f3d98 \
--hash=sha256:4c076d649e066f9f5c7c661bae2658be1ca06e76b002bb97f02a09398707686c
# via -r requirements.in
# via -r docs/requirements.in
packaging==21.2 \
--hash=sha256:096d689d78ca690e4cd8a89568ba06d07ca097e3306a4381635073ca91479966 \
--hash=sha256:14317396d1e8cdb122989b916fa2c7e9ca8e2be9e8060a6eff75b6b7b4d8a7e0
Expand All @@ -177,49 +179,31 @@ pytz==2021.3 \
--hash=sha256:3672058bc3453457b622aab7a1c3bfd5ab0bdae451512f6cf25f64ed37f5b87c \
--hash=sha256:acad2d8b20a1af07d4e4c9d2e9285c5ed9104354062f275f3fcd88dcef4f1326
# via babel
pyyaml==6.0 \
--hash=sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293 \
--hash=sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b \
--hash=sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57 \
--hash=sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b \
--hash=sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4 \
--hash=sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07 \
--hash=sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba \
--hash=sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9 \
--hash=sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287 \
--hash=sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513 \
--hash=sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0 \
--hash=sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0 \
--hash=sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92 \
--hash=sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f \
--hash=sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2 \
--hash=sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc \
--hash=sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c \
--hash=sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86 \
--hash=sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4 \
--hash=sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c \
--hash=sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34 \
--hash=sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b \
--hash=sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c \
--hash=sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb \
--hash=sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737 \
--hash=sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3 \
--hash=sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d \
--hash=sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53 \
--hash=sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78 \
--hash=sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803 \
--hash=sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a \
--hash=sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174 \
--hash=sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5
# via myst-parser
pyyaml==5.3.1 \
--hash=sha256:06a0d7ba600ce0b2d2fe2e78453a470b5a6e000a985dd4a4e54e436cc36b0e97 \
--hash=sha256:240097ff019d7c70a4922b6869d8a86407758333f02203e0fc6ff79c5dcede76 \
--hash=sha256:4f4b913ca1a7319b33cfb1369e91e50354d6f07a135f3b901aca02aa95940bd2 \
--hash=sha256:6034f55dab5fea9e53f436aa68fa3ace2634918e8b5994d82f3621c04ff5ed2e \
--hash=sha256:69f00dca373f240f842b2931fb2c7e14ddbacd1397d57157a9b005a6a9942648 \
--hash=sha256:73f099454b799e05e5ab51423c7bcf361c58d3206fa7b0d555426b1f4d9a3eaf \
--hash=sha256:74809a57b329d6cc0fdccee6318f44b9b8649961fa73144a98735b0aaf029f1f \
--hash=sha256:7739fc0fa8205b3ee8808aea45e968bc90082c10aef6ea95e855e10abf4a37b2 \
--hash=sha256:95f71d2af0ff4227885f7a6605c37fd53d3a106fcab511b8860ecca9fcf400ee \
--hash=sha256:ad9c67312c84def58f3c04504727ca879cb0013b2517c85a9a253f0cb6380c0a \
--hash=sha256:b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d \
--hash=sha256:cc8955cfbfc7a115fa81d85284ee61147059a753344bc51098f3ccd69b0d7e0c \
--hash=sha256:d13155f591e6fcc1ec3b30685d50bf0711574e2c0dfffd7644babf8b5102ca1a
# via
# -r docs/requirements.in
# myst-parser
requests==2.26.0 \
--hash=sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24 \
--hash=sha256:b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7
# via sphinx
setuptools-scm==6.3.2 \
--hash=sha256:4c64444b1d49c4063ae60bfe1680f611c8b13833d556fd1d6050c0023162a119 \
--hash=sha256:a49aa8081eeb3514eb9728fa5040f2eaa962d6c6f4ec9c32f6c1fba88f88a0f2
# via -r requirements.in
# via -r docs/requirements.in
snowballstemmer==2.1.0 \
--hash=sha256:b51b447bea85f9968c13b650126a888aabd4cb4463fca868ec596826325dedc2 \
--hash=sha256:e997baa4f2e9139951b6f4c631bad912dfd3c792467e2f03d7239464af90e914
Expand All @@ -232,43 +216,53 @@ sphinx==4.3.2 \
--hash=sha256:0a8836751a68306b3fe97ecbe44db786f8479c3bf4b80e3a7f5c838657b4698c \
--hash=sha256:6a11ea5dd0bdb197f9c2abc2e0ce73e01340464feaece525e64036546d24c851
# via
# -r requirements.in
# -r docs/requirements.in
# furo
# myst-parser
# sphinxcontrib-apidoc
# sphinxcontrib-towncrier
sphinxcontrib-apidoc==0.3.0 \
--hash=sha256:6671a46b2c6c5b0dca3d8a147849d159065e50443df79614f921b42fbd15cb09 \
--hash=sha256:729bf592cf7b7dd57c4c05794f732dc026127275d785c2a5494521fdde773fb9
# via -r requirements.in
# via -r docs/requirements.in
sphinxcontrib-applehelp==1.0.2 \
--hash=sha256:806111e5e962be97c29ec4c1e7fe277bfd19e9652fb1a4392105b43e01af885a \
--hash=sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58
# via sphinx
# via
# -r docs/requirements.in
# sphinx
sphinxcontrib-devhelp==1.0.2 \
--hash=sha256:8165223f9a335cc1af7ffe1ed31d2871f325254c0423bc0c4c7cd1c1e4734a2e \
--hash=sha256:ff7f1afa7b9642e7060379360a67e9c41e8f3121f2ce9164266f61b9f4b338e4
# via sphinx
# via
# -r docs/requirements.in
# sphinx
sphinxcontrib-htmlhelp==2.0.0 \
--hash=sha256:d412243dfb797ae3ec2b59eca0e52dac12e75a241bf0e4eb861e450d06c6ed07 \
--hash=sha256:f5f8bb2d0d629f398bf47d0d69c07bc13b65f75a81ad9e2f71a63d4b7a2f6db2
# via sphinx
# via
# -r docs/requirements.in
# sphinx
sphinxcontrib-jsmath==1.0.1 \
--hash=sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178 \
--hash=sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8
# via sphinx
sphinxcontrib-qthelp==1.0.3 \
--hash=sha256:4c33767ee058b70dba89a6fc5c1892c0d57a54be67ddd3e7875a18d14cba5a72 \
--hash=sha256:bd9fc24bcb748a8d51fd4ecaade681350aa63009a347a8c14e637895444dfab6
# via sphinx
# via
# -r docs/requirements.in
# sphinx
sphinxcontrib-serializinghtml==1.1.5 \
--hash=sha256:352a9a00ae864471d3a7ead8d7d79f5fc0b57e8b3f95e9867eb9eb28999b92fd \
--hash=sha256:aa5f6de5dfdf809ef505c4895e51ef5c9eac17d0f287933eb49ec495280b6952
# via sphinx
# via
# -r docs/requirements.in
# sphinx
sphinxcontrib-towncrier==0.2.1a0 \
--hash=sha256:a6fac6091a8ee12664d9b1f50a1504cb662380bf8d3bd0f267ebbf4483aa9c18 \
--hash=sha256:b15ee84aa6288173487988514b589155ef38ac6c55ab014a774102f9dc884f41
# via -r requirements.in
# via -r docs/requirements.in
toml==0.10.2 \
--hash=sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b \
--hash=sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f
Expand All @@ -280,7 +274,9 @@ tomli==1.2.2 \
towncrier==21.3.0 \
--hash=sha256:6eed0bc924d72c98c000cb8a64de3bd566e5cb0d11032b73fcccf8a8f956ddfe \
--hash=sha256:e6ccec65418bbcb8de5c908003e130e37fe0e9d6396cb77c1338241071edc082
# via sphinxcontrib-towncrier
# via
# -r docs/requirements.in
# sphinxcontrib-towncrier
typing-extensions==4.2.0 \
--hash=sha256:6657594ee297170d19f67d55c05852a874e7eb634f4f753dbd667855e07c1708 \
--hash=sha256:f1c24655a0da0d1b67f07e17a5e6b2a105894e6824b92096378bb3668ef02376
Expand Down
1 change: 1 addition & 0 deletions docs/spelling_wordlist.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
kwargs
IPv
Nginx
Pluggable
Expand Down
24 changes: 21 additions & 3 deletions proxy/common/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,31 @@
from typing import Tuple, Union


def _get_dist(distribution_name: str) -> str:
# pylint: disable=import-outside-toplevel
import warnings

try:
# pylint: disable=import-outside-toplevel
from importlib.metadata import version # noqa: WPS433

return version(distribution_name)
except ModuleNotFoundError: # pragma: no cover
with warnings.catch_warnings():
warnings.filterwarnings('ignore', category=DeprecationWarning)

# pylint: disable=import-outside-toplevel
from pkg_resources import get_distribution # noqa: WPS433

return get_distribution(distribution_name).version


try:
# pylint: disable=unused-import
from ._scm_version import version as __version__ # noqa: WPS433, WPS436
from ._scm_version import version_tuple as _ver_tup # noqa: WPS433, WPS436
except ImportError: # pragma: no cover
from pkg_resources import get_distribution as _get_dist # noqa: WPS433
__version__ = _get_dist('proxy.py').version # noqa: WPS440
except ImportError: # pragma: no cover
__version__ = _get_dist('proxy.py') # noqa: WPS440


def _to_int_or_str(inp: str) -> Union[int, str]: # pragma: no cover
Expand Down
Loading

0 comments on commit 2ea89b9

Please sign in to comment.