Skip to content

Commit

Permalink
[core] Migrate to pyproject.toml (#6737)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesserockz committed May 16, 2024
1 parent f0ec900 commit f2ef06d
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 122 deletions.
51 changes: 16 additions & 35 deletions setup.cfg → .flake8
Original file line number Diff line number Diff line change
@@ -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]
max-line-length = 120
# Following 4 for black compatibility
Expand All @@ -37,25 +21,22 @@ max-line-length = 120
# D401 First line should be in imperative mood

ignore =
E501,
W503,
E203,
D202,
E501,
W503,
E203,
D202,

D100,
D101,
D102,
D103,
D104,
D105,
D107,
D200,
D205,
D209,
D400,
D401,
D100,
D101,
D102,
D103,
D104,
D105,
D107,
D200,
D205,
D209,
D400,
D401,

exclude = api_pb2.py

[bdist_wheel]
universal = 1
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ RUN if [ "$TARGETARCH$TARGETVARIANT" = "armv7" ]; then \
export PIP_EXTRA_INDEX_URL="https://www.piwheels.org/simple"; \
fi; \
pip3 install \
--break-system-packages --no-cache-dir --no-use-pep517 -e /esphome
--break-system-packages --no-cache-dir -e /esphome

# Settings for dashboard
ENV USERNAME="" PASSWORD=""
Expand Down Expand Up @@ -160,7 +160,7 @@ RUN if [ "$TARGETARCH$TARGETVARIANT" = "armv7" ]; then \
export PIP_EXTRA_INDEX_URL="https://www.piwheels.org/simple"; \
fi; \
pip3 install \
--break-system-packages --no-cache-dir --no-use-pep517 -e /esphome
--break-system-packages --no-cache-dir -e /esphome

# Labels
LABEL \
Expand Down
53 changes: 53 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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]
target-version = ["py39", "py310"]
exclude = 'generated'
6 changes: 3 additions & 3 deletions script/setup
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ if [ ! -n "$DEVCONTAINER" ] && [ ! -n "$VIRTUAL_ENV" ] && [ ! "$ESPHOME_NO_VENV"
if [ -f venv/Scripts/activate ]; then
location="venv/Scripts/activate"
fi
source $location;
source $location
fi

# Avoid unsafe git error when running inside devcontainer
if [ -n "$DEVCONTAINER" ];then
if [ -n "$DEVCONTAINER" ]; then
git config --global --add safe.directory "$PWD"
fi

pip3 install -r requirements.txt -r requirements_optional.txt -r requirements_test.txt -r requirements_dev.txt
pip3 install setuptools wheel
pip3 install --no-use-pep517 -e .
pip3 install -e --config-settings editable_mode=compat ".[dev,test,displays]"

pre-commit install

Expand Down
82 changes: 0 additions & 82 deletions setup.py

This file was deleted.

0 comments on commit f2ef06d

Please sign in to comment.