Skip to content

Commit 74c42f6

Browse files
authored
setup.cfg/extras_require configuration (#1452)
* Remove usage of requirements file in favor of `setup.cfg/extras_require` configuration * Fallback to setuptools-scm>=6 because >=7.0.5 dont support python 3.6, see https://github.com/abhinavsingh/proxy.py/pull/1345/files * Remove unicode symbols from setup.cfg which causes parsing issues on python3.6, ref https://github.com/abhinavsingh/proxy.py/actions/runs/10346098737/job/28634186621\?pr\=1452
1 parent 6602be3 commit 74c42f6

12 files changed

+64
-76
lines changed

.github/workflows/test-library.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ jobs:
495495
${{ runner.os }}-pip-${{
496496
steps.calc-cache-key-py.outputs.py-hash-key
497497
}}-${{
498-
hashFiles('tox.ini', 'requirements**.txt')
498+
hashFiles('tox.ini', 'setup.cfg')
499499
}}
500500
restore-keys: |
501501
${{ runner.os }}-pip-${{

.pre-commit-config.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,8 @@ repos:
6060
dashboard/(
6161
src/core/plugins/inspect_traffic\.json|
6262
static/bootstrap-4\.3\.1\.min\.(cs|j)s
63-
)|
64-
requirements-release\.txt
63+
)
6564
$
66-
- id: requirements-txt-fixer
67-
exclude: >-
68-
^(docs/requirements|requirements(|-(release|testing|tunnel)))\.txt$
6965
# Non-modifying checks:
7066
- id: name-tests-test
7167
args:
@@ -159,11 +155,11 @@ repos:
159155
- paramiko == 2.11.0
160156
- types-paramiko == 2.7.3
161157
- types-requests==2.27.30
162-
# From requirements-tunnel.txt
158+
# [tunnel]
163159
- cryptography==36.0.2; python_version <= '3.6'
164160
- types-setuptools == 57.4.2
165161
- pyyaml==5.3.1
166-
# From requirements-metrics.txt
162+
# [metrics]
167163
- prometheus_client==0.20.0
168164
args:
169165
# FIXME: get rid of missing imports ignore

.readthedocs.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ python:
3434
# system_packages: false
3535
install:
3636
- method: pip
37-
path: .
38-
- requirements: requirements-tunnel.txt
37+
path: .[tunnel,metrics]
3938
- requirements: docs/requirements.txt
40-
- requirements: requirements-metrics.txt
4139

4240
...

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,7 @@ lib-clean:
101101

102102
lib-dep:
103103
pip install --upgrade pip && \
104-
pip install \
105-
-r requirements-testing.txt \
106-
-r requirements-release.txt \
107-
-r requirements-tunnel.txt \
108-
-r requirements-metrics.txt && \
104+
pip install -e .[testing,release,tunnel,metrics] && \
109105
pip install "setuptools>=42"
110106

111107
lib-pre-commit:

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,9 +1473,7 @@ Above:
14731473

14741474
**This is a WIP and may not work as documented**
14751475

1476-
Requires `paramiko` to work.
1477-
1478-
See [requirements-tunnel.txt](https://github.com/abhinavsingh/proxy.py/blob/develop/requirements-tunnel.txt)
1476+
Requires `paramiko` to work. Install dependencies using `pip install "proxy.py[tunnel]"`
14791477

14801478
## Proxy Remote Requests Locally
14811479

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ requires = [
44
"setuptools",
55

66
# Plugins
7-
"setuptools-scm[toml]>=7.0.5",
7+
"setuptools-scm[toml]>=6,!=7.0.0,!=7.0.1,!=7.0.2",
88
]
99
build-backend = "setuptools.build_meta"
1010

requirements-metrics.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

requirements-release.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

requirements-testing.txt

Lines changed: 0 additions & 36 deletions
This file was deleted.

requirements-tunnel.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

setup.cfg

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ project_urls =
1414
GitHub: issues = https://github.com/abhinavsingh/proxy.py/issues
1515
GitHub: repo = https://github.com/abhinavsingh/proxy.py
1616
download_url = https://github.com/abhinavsingh/proxy.py/archive/master.zip
17-
description = Fast • 🪶 Lightweight • 0️⃣ Dependency • 🔌 Pluggable • 😈 TLS interception • 🔒 DNS-over-HTTPS • 🔥 Poor Mans VPN • ⏪ Reverse & Forward • 👮🏿 Proxy Server framework • 🌐 Web Server framework • ➵ ➶ ➷ ➠ PubSub framework • 👷 Work acceptor & executor framework.
17+
description = \u26a1 Fast \u2022 \U0001fab6 Lightweight \u2022 \U0001f51f Dependency \u2022 \U0001f50c Pluggable \u2022 \U0001f608 TLS interception \u2022 \U0001f512 DNS-over-HTTPS \u2022 \U0001f525 Poor Mans VPN \u2022 \u23ea Reverse & \u23e9 Forward \u2022 \U0001f46e\U0001f3ff Proxy Server framework \u2022 \U0001f310 Web Server framework \u2022 \u27b5 \u27b6 \u27b7 \u27a0 PubSub framework \u2022 \U0001f477 Work acceptor & executor framework.
1818
long_description = file: README.md
1919
long_description_content_type = text/markdown
2020
author = Abhinav Singh
@@ -106,9 +106,60 @@ packages = find:
106106
include_package_data = True
107107
zip_safe = False
108108

109-
# These are required in actual runtime:
110109
install_requires =
111110

111+
[options.extras_require]
112+
metrics =
113+
prometheus_client==0.17.1; python_version < '3.8'
114+
prometheus_client==0.20.0; python_version >= '3.8'
115+
release =
116+
setuptools-scm==6.3.2
117+
twine==3.8.0
118+
tunnel =
119+
paramiko==2.11.0; python_version < '3.11'
120+
paramiko==3.4.0; python_version >= '3.11'
121+
types-paramiko==2.11.3; python_version < '3.11'
122+
types-paramiko==3.4.0.20240311; python_version >= '3.11'
123+
cryptography==36.0.2; python_version <= '3.6'
124+
cryptography==39.0.1; python_version > '3.6'
125+
testing =
126+
wheel==0.37.1
127+
python-coveralls==2.9.3
128+
coverage==6.2; python_version < '3.11'
129+
coverage==7.4.4; python_version >= '3.11'
130+
flake8==4.0.1
131+
# pytest for Python<3.11
132+
pytest==7.0.1; python_version < '3.11'
133+
pytest-cov==3.0.0; python_version < '3.11'
134+
pytest-xdist==2.5.0; python_version < '3.11'
135+
pytest-mock==3.6.1; python_version < '3.11'
136+
pytest-asyncio==0.16.0; python_version < '3.11'
137+
# pytest for Python>=3.11
138+
pytest==8.1.1; python_version >= '3.11'
139+
pytest-cov==5.0.0; python_version >= '3.11'
140+
pytest-xdist==3.5.0; python_version >= '3.11'
141+
pytest-mock==3.14.0; python_version >= '3.11'
142+
pytest-asyncio==0.21.1; python_version >= '3.11'
143+
autopep8==1.6.0
144+
mypy==0.971
145+
py-spy==0.3.12
146+
tox==3.28.0; python_version < '3.11'
147+
tox==4.14.2; python_version >= '3.11'
148+
mccabe==0.6.1
149+
pylint==2.13.7; python_version < '3.11'
150+
pylint==3.1.0; python_version >= '3.11'
151+
rope==1.1.1
152+
# Required by test_http2.py
153+
httpx==0.22.0; python_version < '3.11'
154+
httpx==0.27.0; python_version >= '3.11'
155+
h2==4.1.0
156+
hpack==4.0.0
157+
hyperframe==6.0.1
158+
pre-commit==2.16.0
159+
# Types
160+
types-requests==2.28.11.5
161+
types-setuptools==64.0.1
162+
112163
[options.entry_points]
113164
console_scripts =
114165
proxy = proxy:entry_point

tox.ini

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ minversion = 3.21.0
55

66
[testenv]
77
deps =
8-
-rrequirements-testing.txt
9-
-rrequirements-tunnel.txt
10-
-rrequirements-metrics.txt
8+
.[testing,tunnel,metrics]
119
# NOTE: The command is invoked by the script name and not via
1210
# NOTE: `{envpython} -m pytest` because it'd add CWD into $PYTHONPATH
1311
# NOTE: testing the project from the Git checkout
@@ -26,8 +24,7 @@ allowlist_externals =
2624
basepython = python3
2725
commands_pre =
2826
{envpython} -m pip install \
29-
-r{toxinidir}/requirements-tunnel.txt \
30-
-r{toxinidir}/requirements-metrics.txt
27+
{toxinidir}[tunnel,metrics]
3128
commands =
3229
# Retrieve possibly missing commits:
3330
-git fetch --unshallow
@@ -265,9 +262,7 @@ deps =
265262
pylint >= 2.5.3
266263
pylint-pytest < 1.1.0
267264
-r docs/requirements.in
268-
-r requirements-tunnel.txt
269-
-r requirements-metrics.txt
270-
-r requirements-testing.txt
271265
-r benchmark/requirements.txt
266+
.[tunnel,metrics,testing]
272267
isolated_build = true
273268
skip_install = true

0 commit comments

Comments
 (0)