mirror of
https://github.com/esphome/esphome.git
synced 2024-11-09 16:57:47 +01:00
[core] Migrate to pyproject.toml (#6737)
This commit is contained in:
parent
f0ec900e48
commit
f2ef06d8b5
5 changed files with 74 additions and 122 deletions
|
@ -1,19 +1,3 @@
|
||||||
[metadata]
|
|
||||||
license = MIT
|
|
||||||
license_file = LICENSE
|
|
||||||
platforms = any
|
|
||||||
description = Make creating custom firmwares for ESP32/ESP8266 super easy.
|
|
||||||
long_description = file: README.md
|
|
||||||
keywords = home, automation
|
|
||||||
classifier =
|
|
||||||
Environment :: Console
|
|
||||||
Intended Audience :: Developers
|
|
||||||
Intended Audience :: End Users/Desktop
|
|
||||||
License :: OSI Approved :: MIT License
|
|
||||||
Programming Language :: C++
|
|
||||||
Programming Language :: Python :: 3
|
|
||||||
Topic :: Home Automation
|
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
# Following 4 for black compatibility
|
# Following 4 for black compatibility
|
||||||
|
@ -56,6 +40,3 @@ ignore =
|
||||||
D401,
|
D401,
|
||||||
|
|
||||||
exclude = api_pb2.py
|
exclude = api_pb2.py
|
||||||
|
|
||||||
[bdist_wheel]
|
|
||||||
universal = 1
|
|
|
@ -110,7 +110,7 @@ RUN if [ "$TARGETARCH$TARGETVARIANT" = "armv7" ]; then \
|
||||||
export PIP_EXTRA_INDEX_URL="https://www.piwheels.org/simple"; \
|
export PIP_EXTRA_INDEX_URL="https://www.piwheels.org/simple"; \
|
||||||
fi; \
|
fi; \
|
||||||
pip3 install \
|
pip3 install \
|
||||||
--break-system-packages --no-cache-dir --no-use-pep517 -e /esphome
|
--break-system-packages --no-cache-dir -e /esphome
|
||||||
|
|
||||||
# Settings for dashboard
|
# Settings for dashboard
|
||||||
ENV USERNAME="" PASSWORD=""
|
ENV USERNAME="" PASSWORD=""
|
||||||
|
@ -160,7 +160,7 @@ RUN if [ "$TARGETARCH$TARGETVARIANT" = "armv7" ]; then \
|
||||||
export PIP_EXTRA_INDEX_URL="https://www.piwheels.org/simple"; \
|
export PIP_EXTRA_INDEX_URL="https://www.piwheels.org/simple"; \
|
||||||
fi; \
|
fi; \
|
||||||
pip3 install \
|
pip3 install \
|
||||||
--break-system-packages --no-cache-dir --no-use-pep517 -e /esphome
|
--break-system-packages --no-cache-dir -e /esphome
|
||||||
|
|
||||||
# Labels
|
# Labels
|
||||||
LABEL \
|
LABEL \
|
||||||
|
|
|
@ -1,3 +1,56 @@
|
||||||
|
[build-system]
|
||||||
|
requires = ["setuptools==69.2.0", "wheel~=0.43.0"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "esphome"
|
||||||
|
license = {text = "MIT"}
|
||||||
|
description = "Make creating custom firmwares for ESP32/ESP8266 super easy."
|
||||||
|
readme = "README.md"
|
||||||
|
authors = [
|
||||||
|
{name = "The ESPHome Authors", email = "esphome@nabucasa.com"}
|
||||||
|
]
|
||||||
|
keywords = ["home", "automation"]
|
||||||
|
classifiers = [
|
||||||
|
"Environment :: Console",
|
||||||
|
"Intended Audience :: Developers",
|
||||||
|
"Intended Audience :: End Users/Desktop",
|
||||||
|
"License :: OSI Approved :: MIT License",
|
||||||
|
"Programming Language :: C++",
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Topic :: Home Automation",
|
||||||
|
]
|
||||||
|
requires-python = ">=3.9.0"
|
||||||
|
|
||||||
|
dynamic = ["dependencies", "optional-dependencies", "version"]
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
"Documentation" = "https://esphome.io"
|
||||||
|
"Source Code" = "https://github.com/esphome/esphome"
|
||||||
|
"Bug Tracker" = "https://github.com/esphome/issues/issues"
|
||||||
|
"Feature Request Tracker" = "https://github.com/esphome/feature-requests/issues"
|
||||||
|
"Discord" = "https://discord.gg/KhAMKrd"
|
||||||
|
"Forum" = "https://community.home-assistant.io/c/esphome"
|
||||||
|
"Twitter" = "https://twitter.com/esphome_"
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
esphome = "esphome.__main__:main"
|
||||||
|
|
||||||
|
[tool.setuptools]
|
||||||
|
platforms = ["any"]
|
||||||
|
zip-safe = false
|
||||||
|
include-package-data = true
|
||||||
|
|
||||||
|
[tool.setuptools.dynamic]
|
||||||
|
dependencies = {file = ["requirements.txt"]}
|
||||||
|
optional-dependencies.dev = { file = ["requirements_dev.txt"] }
|
||||||
|
optional-dependencies.test = { file = ["requirements_test.txt"] }
|
||||||
|
optional-dependencies.displays = { file = ["requirements_optional.txt"] }
|
||||||
|
version = {attr = "esphome.const.__version__"}
|
||||||
|
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
include = ["esphome*"]
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
target-version = ["py39", "py310"]
|
target-version = ["py39", "py310"]
|
||||||
exclude = 'generated'
|
exclude = 'generated'
|
||||||
|
|
|
@ -10,7 +10,7 @@ if [ ! -n "$DEVCONTAINER" ] && [ ! -n "$VIRTUAL_ENV" ] && [ ! "$ESPHOME_NO_VENV"
|
||||||
if [ -f venv/Scripts/activate ]; then
|
if [ -f venv/Scripts/activate ]; then
|
||||||
location="venv/Scripts/activate"
|
location="venv/Scripts/activate"
|
||||||
fi
|
fi
|
||||||
source $location;
|
source $location
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Avoid unsafe git error when running inside devcontainer
|
# Avoid unsafe git error when running inside devcontainer
|
||||||
|
@ -20,7 +20,7 @@ fi
|
||||||
|
|
||||||
pip3 install -r requirements.txt -r requirements_optional.txt -r requirements_test.txt -r requirements_dev.txt
|
pip3 install -r requirements.txt -r requirements_optional.txt -r requirements_test.txt -r requirements_dev.txt
|
||||||
pip3 install setuptools wheel
|
pip3 install setuptools wheel
|
||||||
pip3 install --no-use-pep517 -e .
|
pip3 install -e --config-settings editable_mode=compat ".[dev,test,displays]"
|
||||||
|
|
||||||
pre-commit install
|
pre-commit install
|
||||||
|
|
||||||
|
|
82
setup.py
82
setup.py
|
@ -1,82 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
"""esphome setup script."""
|
|
||||||
import os
|
|
||||||
|
|
||||||
from setuptools import setup, find_packages
|
|
||||||
|
|
||||||
from esphome import const
|
|
||||||
|
|
||||||
PROJECT_NAME = "esphome"
|
|
||||||
PROJECT_PACKAGE_NAME = "esphome"
|
|
||||||
PROJECT_LICENSE = "MIT"
|
|
||||||
PROJECT_AUTHOR = "ESPHome"
|
|
||||||
PROJECT_COPYRIGHT = "2019, ESPHome"
|
|
||||||
PROJECT_URL = "https://esphome.io/"
|
|
||||||
PROJECT_EMAIL = "esphome@nabucasa.com"
|
|
||||||
|
|
||||||
PROJECT_GITHUB_USERNAME = "esphome"
|
|
||||||
PROJECT_GITHUB_REPOSITORY = "esphome"
|
|
||||||
|
|
||||||
PYPI_URL = f"https://pypi.python.org/pypi/{PROJECT_PACKAGE_NAME}"
|
|
||||||
GITHUB_PATH = f"{PROJECT_GITHUB_USERNAME}/{PROJECT_GITHUB_REPOSITORY}"
|
|
||||||
GITHUB_URL = f"https://github.com/{GITHUB_PATH}"
|
|
||||||
|
|
||||||
DOWNLOAD_URL = f"{GITHUB_URL}/archive/{const.__version__}.zip"
|
|
||||||
|
|
||||||
here = os.path.abspath(os.path.dirname(__file__))
|
|
||||||
|
|
||||||
with open(os.path.join(here, "requirements.txt")) as requirements_txt:
|
|
||||||
REQUIRES = requirements_txt.read().splitlines()
|
|
||||||
|
|
||||||
with open(os.path.join(here, "README.md")) as readme:
|
|
||||||
LONG_DESCRIPTION = readme.read()
|
|
||||||
|
|
||||||
# If you have problems importing platformio and esptool as modules you can set
|
|
||||||
# $ESPHOME_USE_SUBPROCESS to make ESPHome call their executables instead.
|
|
||||||
# This means they have to be in your $PATH.
|
|
||||||
if "ESPHOME_USE_SUBPROCESS" in os.environ:
|
|
||||||
# Remove platformio and esptool from requirements
|
|
||||||
REQUIRES = [
|
|
||||||
req
|
|
||||||
for req in REQUIRES
|
|
||||||
if not any(req.startswith(prefix) for prefix in ["platformio", "esptool"])
|
|
||||||
]
|
|
||||||
|
|
||||||
CLASSIFIERS = [
|
|
||||||
"Environment :: Console",
|
|
||||||
"Intended Audience :: Developers",
|
|
||||||
"Intended Audience :: End Users/Desktop",
|
|
||||||
"License :: OSI Approved :: MIT License",
|
|
||||||
"Programming Language :: C++",
|
|
||||||
"Programming Language :: Python :: 3",
|
|
||||||
"Topic :: Home Automation",
|
|
||||||
]
|
|
||||||
|
|
||||||
setup(
|
|
||||||
name=PROJECT_PACKAGE_NAME,
|
|
||||||
version=const.__version__,
|
|
||||||
license=PROJECT_LICENSE,
|
|
||||||
url=GITHUB_URL,
|
|
||||||
project_urls={
|
|
||||||
"Bug Tracker": "https://github.com/esphome/issues/issues",
|
|
||||||
"Feature Request Tracker": "https://github.com/esphome/feature-requests/issues",
|
|
||||||
"Source Code": "https://github.com/esphome/esphome",
|
|
||||||
"Documentation": "https://esphome.io",
|
|
||||||
"Twitter": "https://twitter.com/esphome_",
|
|
||||||
},
|
|
||||||
download_url=DOWNLOAD_URL,
|
|
||||||
author=PROJECT_AUTHOR,
|
|
||||||
author_email=PROJECT_EMAIL,
|
|
||||||
description="Make creating custom firmwares for ESP32/ESP8266 super easy.",
|
|
||||||
long_description=LONG_DESCRIPTION,
|
|
||||||
long_description_content_type="text/markdown",
|
|
||||||
include_package_data=True,
|
|
||||||
zip_safe=False,
|
|
||||||
platforms="any",
|
|
||||||
test_suite="tests",
|
|
||||||
python_requires=">=3.9.0",
|
|
||||||
install_requires=REQUIRES,
|
|
||||||
keywords=["home", "automation"],
|
|
||||||
entry_points={"console_scripts": ["esphome = esphome.__main__:main"]},
|
|
||||||
packages=find_packages(include="esphome.*"),
|
|
||||||
)
|
|
Loading…
Reference in a new issue