prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Improve packaging system
  The `requirements.txt` file is used in a bit confusing way. It it usual practice for this file to contain all the dependencies present in the project virtualenv, created using `pip freeze > requirements.txt`, so that the virtualenv can be easily re-created by any developer locally using `pip install -r requirements.txt.`
  But this file is also used as the `install_requires` inside `setup.py`, creating a bit of a conflict.
  If one installs the appdaemon locally with `pip install .`, then run `pip freeze > requirements.txt`, the `requirements.txt` file is modified, since all the transitive dependencies are also loaded, as is expected. So the question is: shouldn't the declaration of the project dependencies be moved in a more appropriate place, separate from `requirements.txt`?
  
  ## Proposed solution
  I propose to more crealry declare the project dependencies, by upgrading the way we use the Python packaging system.
  At the moment the package is created from the `setup.py`, read by `setuptools` when building the package.
  The way to package applications has changed a lot over the years. Nowadays if one were to follow the official [Python packaging guide](https://packaging.python.org/en/latest/tutorials/packaging-projects/), the recommended setup is to use a `pyproject.toml` to describe all the metadata of the project, including the build tool and the project dependencies.
  I suggest we move from the current `setup.py` to a more modern and "standard" solution, by migrating to a `pyproject.toml` file to contain all the project dependencies.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `setup.py`
  Content:
  ```
  1 #!/usr/bin/env python
  2 # -*- coding: utf-8 -*-
  3 
  4 from setuptools import setup, find_packages
  5 
  6 from appdaemon.version import __version__
  7 
  8 # sudo apt-get install python3-aiohttp-dbg
  9 
  10 with open("requirements.txt") as f:
  11     install_requires = [x for x in f.read().split("\n") if x]
  12 
  13 with open("README.md") as f:
  14     long_description = f.read()
  15 
  16 setup(
  17     name="appdaemon",
  18     version=__version__,
  19     description="Apps for the Home Assistant home automation package.",
  20     long_description=long_description,
  21     long_description_content_type="text/markdown",
  22     author="Andrew I Cockburn",
  23     author_email="appdaemon@acockburn.com",
  24     url="https://github.com/home-assistant/appdaemon.git",
  25     packages=find_packages(exclude=["contrib", "docs", "tests*"]),
  26     include_package_data=True,
  27     install_requires=install_requires,
  28     license="Apache License 2.0",
  29     python_requires=">=3.7",
  30     zip_safe=False,
  31     keywords=["appdaemon", "home", "automation"],
  32     entry_points={"console_scripts": ["appdaemon = appdaemon.__main__:main"]},
  33     classifiers=[
  34         "Development Status :: 5 - Production/Stable",
  35         "Intended Audience :: Developers",
  36         "License :: OSI Approved :: Apache Software License",
  37         "Natural Language :: English",
  38         "Programming Language :: Python :: 3.7",
  39         "Programming Language :: Python :: 3.8",
  40         "Programming Language :: Python :: 3.9",
  41         "Programming Language :: Python :: 3.10",
  42         "Topic :: Home Automation",
  43     ],
  44 )
  45
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/setup.py b/setup.py
  deleted file mode 100755
  --- a/setup.py
  +++ /dev/null
  @@ -1,44 +0,0 @@
  -#!/usr/bin/env python
  -# -*- coding: utf-8 -*-
  -
  -from setuptools import setup, find_packages
  -
  -from appdaemon.version import __version__
  -
  -# sudo apt-get install python3-aiohttp-dbg
  -
  -with open("requirements.txt") as f:
  -    install_requires = [x for x in f.read().split("\n") if x]
  -
  -with open("README.md") as f:
  -    long_description = f.read()
  -
  -setup(
  -    name="appdaemon",
  -    version=__version__,
  -    description="Apps for the Home Assistant home automation package.",
  -    long_description=long_description,
  -    long_description_content_type="text/markdown",
  -    author="Andrew I Cockburn",
  -    author_email="appdaemon@acockburn.com",
  -    url="https://github.com/home-assistant/appdaemon.git",
  -    packages=find_packages(exclude=["contrib", "docs", "tests*"]),
  -    include_package_data=True,
  -    install_requires=install_requires,
  -    license="Apache License 2.0",
  -    python_requires=">=3.7",
  -    zip_safe=False,
  -    keywords=["appdaemon", "home", "automation"],
  -    entry_points={"console_scripts": ["appdaemon = appdaemon.__main__:main"]},
  -    classifiers=[
  -        "Development Status :: 5 - Production/Stable",
  -        "Intended Audience :: Developers",
  -        "License :: OSI Approved :: Apache Software License",
  -        "Natural Language :: English",
  -        "Programming Language :: Python :: 3.7",
  -        "Programming Language :: Python :: 3.8",
  -        "Programming Language :: Python :: 3.9",
  -        "Programming Language :: Python :: 3.10",
  -        "Topic :: Home Automation",
  -    ],
  -)
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\ndeleted file mode 100755\n--- a/setup.py\n+++ /dev/null\n@@ -1,44 +0,0 @@\n-#!/usr/bin/env python\n-# -*- coding: utf-8 -*-\n-\n-from setuptools import setup, find_packages\n-\n-from appdaemon.version import __version__\n-\n-# sudo apt-get install python3-aiohttp-dbg\n-\n-with open(\"requirements.txt\") as f:\n-    install_requires = [x for x in f.read().split(\"\\n\") if x]\n-\n-with open(\"README.md\") as f:\n-    long_description = f.read()\n-\n-setup(\n-    name=\"appdaemon\",\n-    version=__version__,\n-    description=\"Apps for the Home Assistant home automation package.\",\n-    long_description=long_description,\n-    long_description_content_type=\"text/markdown\",\n-    author=\"Andrew I Cockburn\",\n-    author_email=\"appdaemon@acockburn.com\",\n-    url=\"https://github.com/home-assistant/appdaemon.git\",\n-    packages=find_packages(exclude=[\"contrib\", \"docs\", \"tests*\"]),\n-    include_package_data=True,\n-    install_requires=install_requires,\n-    license=\"Apache License 2.0\",\n-    python_requires=\">=3.7\",\n-    zip_safe=False,\n-    keywords=[\"appdaemon\", \"home\", \"automation\"],\n-    entry_points={\"console_scripts\": [\"appdaemon = appdaemon.__main__:main\"]},\n-    classifiers=[\n-        \"Development Status :: 5 - Production/Stable\",\n-        \"Intended Audience :: Developers\",\n-        \"License :: OSI Approved :: Apache Software License\",\n-        \"Natural Language :: English\",\n-        \"Programming Language :: Python :: 3.7\",\n-        \"Programming Language :: Python :: 3.8\",\n-        \"Programming Language :: Python :: 3.9\",\n-        \"Programming Language :: Python :: 3.10\",\n-        \"Topic :: Home Automation\",\n-    ],\n-)\n", "issue": "Improve packaging system\nThe `requirements.txt` file is used in a bit confusing way. It it usual practice for this file to contain all the dependencies present in the project virtualenv, created using `pip freeze > requirements.txt`, so that the virtualenv can be easily re-created by any developer locally using `pip install -r requirements.txt.`\r\nBut this file is also used as the `install_requires` inside `setup.py`, creating a bit of a conflict.\r\nIf one installs the appdaemon locally with `pip install .`, then run `pip freeze > requirements.txt`, the `requirements.txt` file is modified, since all the transitive dependencies are also loaded, as is expected. So the question is: shouldn't the declaration of the project dependencies be moved in a more appropriate place, separate from `requirements.txt`?\r\n\r\n## Proposed solution\r\nI propose to more crealry declare the project dependencies, by upgrading the way we use the Python packaging system.\r\nAt the moment the package is created from the `setup.py`, read by `setuptools` when building the package.\r\nThe way to package applications has changed a lot over the years. Nowadays if one were to follow the official [Python packaging guide](https://packaging.python.org/en/latest/tutorials/packaging-projects/), the recommended setup is to use a `pyproject.toml` to describe all the metadata of the project, including the build tool and the project dependencies.\r\nI suggest we move from the current `setup.py` to a more modern and \"standard\" solution, by migrating to a `pyproject.toml` file to contain all the project dependencies.\r\n\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom setuptools import setup, find_packages\n\nfrom appdaemon.version import __version__\n\n# sudo apt-get install python3-aiohttp-dbg\n\nwith open(\"requirements.txt\") as f:\n    install_requires = [x for x in f.read().split(\"\\n\") if x]\n\nwith open(\"README.md\") as f:\n    long_description = f.read()\n\nsetup(\n    name=\"appdaemon\",\n    version=__version__,\n    description=\"Apps for the Home Assistant home automation package.\",\n    long_description=long_description,\n    long_description_content_type=\"text/markdown\",\n    author=\"Andrew I Cockburn\",\n    author_email=\"appdaemon@acockburn.com\",\n    url=\"https://github.com/home-assistant/appdaemon.git\",\n    packages=find_packages(exclude=[\"contrib\", \"docs\", \"tests*\"]),\n    include_package_data=True,\n    install_requires=install_requires,\n    license=\"Apache License 2.0\",\n    python_requires=\">=3.7\",\n    zip_safe=False,\n    keywords=[\"appdaemon\", \"home\", \"automation\"],\n    entry_points={\"console_scripts\": [\"appdaemon = appdaemon.__main__:main\"]},\n    classifiers=[\n        \"Development Status :: 5 - Production/Stable\",\n        \"Intended Audience :: Developers\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Natural Language :: English\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Programming Language :: Python :: 3.10\",\n        \"Topic :: Home Automation\",\n    ],\n)\n", "path": "setup.py"}], "after_files": [{"content": null, "path": "setup.py"}]}