Skip to content

Commit

Permalink
Improve packaging and command line tools
Browse files Browse the repository at this point in the history
* Declare paho-mqtt dependency as optional
* Fix ideenergy and ideenergy-mqtt CLI tools
  • Loading branch information
ldotlopez committed May 23, 2022
1 parent 2a1d4d7 commit 80d9622
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
7 changes: 2 additions & 5 deletions ideenergy/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.


import asyncio

from . import cli
from .cli import main

if __name__ == "__main__":
asyncio.run(cli.main())
main()
8 changes: 6 additions & 2 deletions ideenergy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ async def get_historical_data(username, password, req_type, contract=None, logge
return await client.get_historical_data(req_type, start, end)


async def main():
async def async_main():
logging.basicConfig(
format="%(asctime)s.%(msecs)03d %(levelname)s %(module)s %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
Expand Down Expand Up @@ -163,5 +163,9 @@ async def main():
print(pprint.pformat(historical))


def main():
asyncio.run(async_main())


if __name__ == "__main__":
asyncio.run(main())
main()
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ python_requires = >=3.9
install_requires =
aiohttp

[options.extras_require]
mqtt = paho-mqtt >= 1.6.1

[options.packages.find]
where =

Expand Down

0 comments on commit 80d9622

Please sign in to comment.