Move `install_requires` to `setup.cfg` (#65095)

This commit is contained in:
Marc Mueller 2022-01-28 07:34:18 +01:00 committed by GitHub
parent 631c4bf10f
commit 86ed720335
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 34 deletions

View File

@ -107,7 +107,7 @@ repos:
pass_filenames: false
language: script
types: [text]
files: ^(homeassistant/.+/manifest\.json|setup\.py|\.pre-commit-config\.yaml|script/gen_requirements_all\.py)$
files: ^(homeassistant/.+/manifest\.json|setup\.cfg|\.pre-commit-config\.yaml|script/gen_requirements_all\.py)$
- id: hassfest
name: hassfest
entry: script/run-in-env.sh python3 -m script.hassfest

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python3
"""Generate an updated requirements_all.txt."""
import configparser
import difflib
import importlib
import os
@ -167,10 +168,9 @@ def explore_module(package, explore_children):
def core_requirements():
"""Gather core requirements out of setup.py."""
reqs_raw = re.search(
r"REQUIRES = \[(.*?)\]", Path("setup.py").read_text(), re.S
).group(1)
return [x[1] for x in re.findall(r"(['\"])(.*?)\1", reqs_raw)]
parser = configparser.ConfigParser()
parser.read("setup.cfg")
return parser["options"]["install_requires"].strip().split("\n")
def gather_recursive_requirements(domain, seen=None):

View File

@ -14,6 +14,34 @@ classifier =
Programming Language :: Python :: 3.9
Topic :: Home Automation
[options]
install_requires =
aiohttp==3.8.1
astral==2.2
async_timeout==4.0.2
attrs==21.2.0
atomicwrites==1.4.0
awesomeversion==22.1.0
bcrypt==3.1.7
certifi>=2021.5.30
ciso8601==2.2.0
# When bumping httpx, please check the version pins of
# httpcore, anyio, and h11 in gen_requirements_all
httpx==0.21.3
ifaddr==0.1.7
jinja2==3.0.3
PyJWT==2.1.0
# PyJWT has loose dependency. We want the latest one.
cryptography==35.0.0
pip>=8.0.3,<20.3
python-slugify==4.0.1
pyyaml==6.0
requests==2.27.1
typing-extensions>=3.10.0.2,<5.0
voluptuous==0.12.2
voluptuous-serialize==2.5.0
yarl==1.7.2
[flake8]
exclude = .venv,.git,.tox,docs,venv,bin,lib,deps,build
max-complexity = 25

View File

@ -31,34 +31,6 @@ PROJECT_URLS = {
PACKAGES = find_packages(exclude=["tests", "tests.*"])
REQUIRES = [
"aiohttp==3.8.1",
"astral==2.2",
"async_timeout==4.0.2",
"attrs==21.2.0",
"atomicwrites==1.4.0",
"awesomeversion==22.1.0",
"bcrypt==3.1.7",
"certifi>=2021.5.30",
"ciso8601==2.2.0",
# When bumping httpx, please check the version pins of
# httpcore, anyio, and h11 in gen_requirements_all
"httpx==0.21.3",
"ifaddr==0.1.7",
"jinja2==3.0.3",
"PyJWT==2.1.0",
# PyJWT has loose dependency. We want the latest one.
"cryptography==35.0.0",
"pip>=8.0.3,<20.3",
"python-slugify==4.0.1",
"pyyaml==6.0",
"requests==2.27.1",
"typing-extensions>=3.10.0.2,<5.0",
"voluptuous==0.12.2",
"voluptuous-serialize==2.5.0",
"yarl==1.7.2",
]
MIN_PY_VERSION = ".".join(map(str, hass_const.REQUIRED_PYTHON_VER))
setup(
@ -72,7 +44,6 @@ setup(
packages=PACKAGES,
include_package_data=True,
zip_safe=False,
install_requires=REQUIRES,
python_requires=f">={MIN_PY_VERSION}",
test_suite="tests",
entry_points={"console_scripts": ["hass = homeassistant.__main__:main"]},