Skip to content

Commit 10b7d31

Browse files
authored
Migrate setup.py to setup.cfg (#1553)
* migrate setup.py to setup.cfg No man pages * fix Makefile build * silence flake8 F811 for BaseCLIResponse.command * also include man pages * restore a stub setup.py * remove pytest-lazy fixtures
1 parent 3de7c82 commit 10b7d31

File tree

4 files changed

+96
-131
lines changed

4 files changed

+96
-131
lines changed

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,17 @@ test-dist: test-sdist test-bdist-wheel
124124

125125
test-sdist: clean venv
126126
@echo $(H1)Testing sdist build an installation$(H1END)
127-
$(VENV_PYTHON) setup.py sdist
127+
$(VENV_PIP) install build
128+
$(VENV_PYTHON) -m build --sdist
128129
$(VENV_PIP) install --force-reinstall --upgrade dist/*.gz
129130
$(VENV_BIN)/http --version
130131
@echo
131132

132133

133134
test-bdist-wheel: clean venv
134135
@echo $(H1)Testing wheel build an installation$(H1END)
135-
$(VENV_PIP) install wheel
136-
$(VENV_PYTHON) setup.py bdist_wheel
136+
$(VENV_PIP) install build
137+
$(VENV_PYTHON) -m build --wheel
137138
$(VENV_PIP) install --force-reinstall --upgrade dist/*.whl
138139
$(VENV_BIN)/http --version
139140
@echo

setup.cfg

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,98 @@ norecursedirs = tests/fixtures
1212
addopts = --tb=native --doctest-modules --verbose
1313
xfail_strict = True
1414

15+
[metadata]
16+
name = httpie
17+
version = attr: httpie.__version__
18+
author = Jakub Roztocil
19+
author_email = [email protected]
20+
license = BSD
21+
description = HTTPie: modern, user-friendly command-line HTTP client for the API era.
22+
url = https://httpie.io/
23+
long_description = file: README.md
24+
long_description_content_type = text/markdown
25+
classifiers =
26+
Development Status :: 5 - Production/Stable
27+
Programming Language :: Python
28+
Programming Language :: Python :: 3 :: Only
29+
Environment :: Console
30+
Intended Audience :: Developers
31+
Intended Audience :: System Administrators
32+
License :: OSI Approved :: BSD License
33+
Topic :: Internet :: WWW/HTTP
34+
Topic :: Software Development
35+
Topic :: System :: Networking
36+
Topic :: Terminals
37+
Topic :: Text Processing
38+
Topic :: Utilities
39+
project_urls =
40+
GitHub = https://github.com/httpie/cli
41+
Twitter = https://twitter.com/httpie
42+
Discord = https://httpie.io/discord
43+
Documentation = https://httpie.io/docs
44+
Online Demo = https://httpie.io/run
45+
46+
47+
[options]
48+
packages = find:
49+
install_requires =
50+
pip
51+
charset_normalizer>=2.0.0
52+
defusedxml>=0.6.0
53+
requests[socks]>=2.22.0
54+
Pygments>=2.5.2
55+
requests-toolbelt>=0.9.1
56+
multidict>=4.7.0
57+
setuptools
58+
importlib-metadata>=1.4.0; python_version < "3.8"
59+
rich>=9.10.0
60+
python_requires = >=3.7
61+
1562

1663
[flake8]
1764
# <https://flake8.pycqa.org/en/latest/user/error-codes.html>
1865
# E501 - line too long
1966
# W503 - line break before binary operator
2067
ignore = E501,W503
68+
69+
[options.packages.find]
70+
include =
71+
httpie
72+
httpie.*
73+
74+
[options.entry_points]
75+
console_scripts =
76+
http = httpie.__main__:main
77+
https = httpie.__main__:main
78+
httpie = httpie.manager.__main__:main
79+
80+
[options.extras_require]
81+
dev =
82+
pytest
83+
pytest-httpbin>=0.0.6
84+
responses
85+
pytest-mock
86+
werkzeug<2.1.0
87+
flake8
88+
flake8-comprehensions
89+
flake8-deprecated
90+
flake8-mutable
91+
flake8-tuple
92+
pyopenssl
93+
pytest-cov
94+
pyyaml
95+
twine
96+
wheel
97+
Jinja2
98+
test =
99+
pytest
100+
pytest-httpbin>=0.0.6
101+
responses
102+
pytest-mock
103+
werkzeug<2.1.0
104+
105+
[options.data_files]
106+
share/man/man1 =
107+
extras/man/http.1
108+
extras/man/https.1
109+
extras/man/httpie.1

setup.py

Lines changed: 2 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,3 @@
1-
# This is purely the result of trial and error.
1+
from setuptools import setup
22

3-
import sys
4-
5-
from setuptools import setup, find_packages
6-
7-
import httpie
8-
9-
10-
# Note: keep requirements here to ease distributions packaging
11-
tests_require = [
12-
'pytest',
13-
'pytest-httpbin>=0.0.6',
14-
'responses',
15-
'pytest-mock',
16-
'werkzeug<2.1.0'
17-
]
18-
dev_require = [
19-
*tests_require,
20-
'flake8',
21-
'flake8-comprehensions',
22-
'flake8-deprecated',
23-
'flake8-mutable',
24-
'flake8-tuple',
25-
'pyopenssl',
26-
'pytest-cov',
27-
'pyyaml',
28-
'twine',
29-
'wheel',
30-
'Jinja2'
31-
]
32-
install_requires = [
33-
'pip',
34-
'charset_normalizer>=2.0.0',
35-
'defusedxml>=0.6.0',
36-
'requests[socks]>=2.22.0',
37-
'Pygments>=2.5.2',
38-
'requests-toolbelt>=0.9.1',
39-
'multidict>=4.7.0',
40-
'setuptools',
41-
'importlib-metadata>=1.4.0; python_version < "3.8"',
42-
'rich>=9.10.0'
43-
]
44-
install_requires_win_only = [
45-
'colorama>=0.2.4',
46-
]
47-
48-
# Conditional dependencies:
49-
50-
# sdist
51-
if 'bdist_wheel' not in sys.argv:
52-
53-
if 'win32' in str(sys.platform).lower():
54-
# Terminal colors for Windows
55-
install_requires.extend(install_requires_win_only)
56-
57-
58-
# bdist_wheel
59-
extras_require = {
60-
'dev': dev_require,
61-
'test': tests_require,
62-
# https://wheel.readthedocs.io/en/latest/#defining-conditional-dependencies
63-
':sys_platform == "win32"': install_requires_win_only,
64-
}
65-
66-
67-
def long_description():
68-
with open('README.md', encoding='utf-8') as f:
69-
return f.read()
70-
71-
72-
setup(
73-
name='httpie',
74-
version=httpie.__version__,
75-
description=httpie.__doc__.strip(),
76-
long_description=long_description(),
77-
long_description_content_type='text/markdown',
78-
url='https://httpie.io/',
79-
download_url=f'https://github.com/httpie/cli/archive/{httpie.__version__}.tar.gz',
80-
author=httpie.__author__,
81-
author_email='[email protected]',
82-
license=httpie.__licence__,
83-
packages=find_packages(include=['httpie', 'httpie.*']),
84-
entry_points={
85-
'console_scripts': [
86-
'http = httpie.__main__:main',
87-
'https = httpie.__main__:main',
88-
'httpie = httpie.manager.__main__:main',
89-
],
90-
},
91-
python_requires='>=3.7',
92-
extras_require=extras_require,
93-
install_requires=install_requires,
94-
classifiers=[
95-
'Development Status :: 5 - Production/Stable',
96-
'Programming Language :: Python',
97-
'Programming Language :: Python :: 3 :: Only',
98-
'Programming Language :: Python :: 3.7',
99-
'Programming Language :: Python :: 3.8',
100-
'Programming Language :: Python :: 3.9',
101-
'Programming Language :: Python :: 3.10',
102-
'Programming Language :: Python :: 3.11',
103-
'Programming Language :: Python :: 3.12',
104-
'Programming Language :: Python :: Implementation :: CPython',
105-
'Environment :: Console',
106-
'Intended Audience :: Developers',
107-
'Intended Audience :: System Administrators',
108-
'License :: OSI Approved :: BSD License',
109-
'Topic :: Internet :: WWW/HTTP',
110-
'Topic :: Software Development',
111-
'Topic :: System :: Networking',
112-
'Topic :: Terminals',
113-
'Topic :: Text Processing',
114-
'Topic :: Utilities'
115-
],
116-
project_urls={
117-
'GitHub': 'https://github.com/httpie/cli',
118-
'Twitter': 'https://twitter.com/httpie',
119-
'Discord': 'https://httpie.io/discord',
120-
'Documentation': 'https://httpie.io/docs',
121-
'Online Demo': 'https://httpie.io/run',
122-
},
123-
data_files=[
124-
('share/man/man1', ['extras/man/http.1']),
125-
('share/man/man1', ['extras/man/https.1']),
126-
('share/man/man1', ['extras/man/httpie.1']),
127-
]
128-
)
3+
setup()

tests/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ class BaseCLIResponse:
210210
complete_args: List[str] = []
211211

212212
@property
213-
def command(self):
213+
def command(self): # noqa: F811
214214
cmd = ' '.join(shlex.quote(arg) for arg in ['http', *self.args])
215215
# pytest-httpbin to real httpbin.
216216
return re.sub(r'127\.0\.0\.1:\d+', 'httpbin.org', cmd)

0 commit comments

Comments
 (0)