-
Notifications
You must be signed in to change notification settings - Fork 235
Ruff as linter, pyproject.toml for setuptools, uv.lock #588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
f299bd9
3401917
57466ae
e2575ac
bb5af6b
5b9c1ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,161 @@ | ||
| [project] | ||
| name = "tinytuya" | ||
| dynamic = ["version", "readme"] | ||
| authors = [ | ||
| { name = "Jason Cox", email = "[email protected]" }, | ||
| ] | ||
| description = "Python module to interface with Tuya WiFi smart devices" | ||
| classifiers = [ | ||
| "Programming Language :: Python :: 3", | ||
| "License :: OSI Approved :: MIT License", | ||
| "Operating System :: OS Independent", | ||
| ] | ||
|
|
||
| dependencies = [ | ||
| "colorama", | ||
| "requests", | ||
| ] | ||
|
|
||
| requires-python = ">= 3.8" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is fine. This aligns to end of life with python version (https://devguide.python.org/versions/) @uzlonewolf thoughts? |
||
|
|
||
| [project.optional-dependencies] | ||
| cryptography = ["cryptography>=3.1"] | ||
| pycryptodome = ["pycryptodome"] | ||
| pyaes = ["pyaes"] | ||
| pycrypto = ["pycrypto"] | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We had added the logic to setup.py for some small IoT devices/platforms that couldn't use some of these. I believe the intent was to allow the user to install one that did and the tinytuya iinstall would continue without insisting on cryptography. Yeah, I don't think it worked well. I do wonder how this would change that use case, if at all. |
||
| [project.urls] | ||
| Homepage = "https://github.com/jasonacox/tinytuya" | ||
| Repository = "https://github.com/jasonacox/tinytuya" | ||
|
|
||
| [project.scripts] | ||
| tinytuya = "tinytuya.__main__:dummy" | ||
|
|
||
| [build-system] | ||
| requires = ["setuptools", "colorama", "requests", "cryptography"] | ||
| requires = ["setuptools"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [tool.setuptools.dynamic] | ||
| version = {attr = "tinytuya.core.core.__version__"} | ||
| readme = {file = ["README.md"], content-type = "text/markdown"} | ||
|
|
||
| [tool.setuptools.packages.find] | ||
| exclude = ["sandbox"] | ||
|
|
||
| [dependency-groups] | ||
| dev = [ | ||
| "ruff>=0.9.2", | ||
| ] | ||
|
|
||
|
|
||
| [tool.ruff] | ||
| include = [ | ||
| "pyproject.toml", | ||
| "tinytuya/**/*.py", | ||
| "Contrib/**/*.py", | ||
| "server/**/*.py", | ||
| "examples/**/*.py", | ||
| "tools/**/*.py", | ||
| ] | ||
|
|
||
| [tool.ruff.lint] | ||
| extend-select = [ | ||
| "D419", # empty-docstring | ||
| "W291", # trailing-whitespace | ||
| "PLC0414", # useless-import-alias | ||
| "PLC2401", # non-ascii-name | ||
| "PLC3002", # unnecessary-direct-lambda-call | ||
| "PLE0101", # return-in-init | ||
| "F706", # return-outside-function | ||
| "F704", # yield-outside-function | ||
| "PLE0115", # nonlocal-and-global | ||
| "PLE0116", # continue-in-finally | ||
| "PLE0117", # nonlocal-without-binding | ||
| "PLE0241", # duplicate-bases | ||
| "PLE0302", # unexpected-special-method-signature | ||
| "PLE0604", # invalid-all-object | ||
| "PLE0605", # invalid-all-format | ||
| "PLE0643", # potential-index-error | ||
| "PLE0704", # misplaced-bare-raise | ||
| "PLE1142", # await-outside-async | ||
| "PLE1205", # logging-too-many-args | ||
| "PLE1206", # logging-too-few-args | ||
| "PLE1307", # bad-string-format-type | ||
| "PLE1310", # bad-str-strip-call | ||
| "PLE1507", # invalid-envvar-value | ||
| "PLE1519", # singledispatch-method | ||
| "PLE1520", # singledispatchmethod-function | ||
| "PLE2502", # bidirectional-unicode | ||
| "PLE2510", # invalid-character-backspace | ||
| "PLE2512", # invalid-character-sub | ||
| "PLE2513", # invalid-character-esc | ||
| "PLE2514", # invalid-character-nul | ||
| "PLE2515", # invalid-character-zero-width-space | ||
| "PLR0124", # comparison-with-itself | ||
| "PLR0206", # property-with-parameters | ||
| "PLR1704", # redefined-argument-from-local | ||
| "PLR1711", # useless-return | ||
| "C416", # unnecessary-comprehension | ||
| "PLR1736", # unnecessary-list-index-lookup | ||
| "PLW0120", # useless-else-on-loop | ||
| "PLW0127", # self-assigning-variable | ||
| "PLW0128", # redeclared-assigned-name | ||
| "PLW0129", # assert-on-string-literal | ||
| "B033", # duplicate-value | ||
| "PLW0131", # named-expr-without-context | ||
| "PLW0211", # bad-staticmethod-argument | ||
| "PLW0245", # super-without-brackets | ||
| "PLW0406", # import-self | ||
| "PLW0602", # global-variable-not-assigned | ||
| "PLW0603", # global-statement | ||
| "PLW0604", # global-at-module-level | ||
| "F401", # unused-import | ||
| "PLW0711", # binary-op-exception | ||
| "PLW1501", # bad-open-mode | ||
| "PLW1508", # invalid-envvar-default | ||
| "PLW1509", # subprocess-popen-preexec-fn | ||
| "PLW2101", # useless-with-lock | ||
| "PLW3301", # nested-min-max | ||
| ] | ||
|
|
||
| ignore = [ | ||
| "E501", # line-too-long | ||
| "F401", # imported but unused | ||
| "UP004", # useless-object-inheritance | ||
| "PLR0911", # too-many-return-statements | ||
| "PLR0912", # too-many-branches | ||
| "PLR0913", # too-many-arguments | ||
| "PLR0914", # too-many-locals | ||
| "PLR0915", # too-many-statements | ||
| "PLR1702", # too-many-nested-blocks | ||
| "F841", # unused-variable | ||
| "E722", # bare-except | ||
| "PLW1514", # unspecified-encoding | ||
|
|
||
| "E701", # Multiple statements on one line (colon) | ||
| "E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks | ||
| "F405", # undefined-local-with-import-star-usage | ||
| "F403", # undefined-local-with-import-star | ||
| "E741", # ambiguous-variable-name | ||
| "E711", # none-comparison | ||
| "E712", # true-false-comparison | ||
| ] | ||
|
|
||
| [tool.ruff.lint.per-file-ignores] | ||
| # this is grandfathering in some existing errors, | ||
| # we may want to remove these in the future | ||
| "tools/**/*.py" = [ | ||
| "F821", # undefined-name | ||
| "PLR1704", | ||
| "PLW0602", | ||
| ] | ||
| "server/**/*.py" = [ | ||
| "W291", | ||
| "PLW0602", | ||
| "PLW0603", | ||
| ] | ||
| "examples/**/*.py" = [ | ||
| "PLW0602", | ||
| "PLW0603", | ||
| "W291", | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,6 @@ | |
|
|
||
| import tinytuya | ||
| from tinytuya import scanner | ||
| import os | ||
|
|
||
| BUILD = "p13" | ||
|
|
||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,50 +1,4 @@ | ||
| import setuptools | ||
| from pkg_resources import DistributionNotFound, get_distribution | ||
|
|
||
| from tinytuya import __version__ | ||
|
|
||
| with open("README.md", "r") as fh: | ||
| long_description = fh.read() | ||
|
|
||
| INSTALL_REQUIRES = [ | ||
| 'requests', # Used for Setup Wizard - Tuya IoT Platform calls | ||
| 'colorama', # Makes ANSI escape character sequences work under MS Windows. | ||
| #'netifaces', # Used for device discovery, mainly required on multi-interface machines | ||
| ] | ||
|
|
||
| CHOOSE_CRYPTO_LIB = [ | ||
| 'cryptography', # pyca/cryptography - https://cryptography.io/en/latest/ | ||
| 'pycryptodome', # PyCryptodome - https://pycryptodome.readthedocs.io/en/latest/ | ||
| 'pyaes', # pyaes - https://github.com/ricmoo/pyaes | ||
| 'pycrypto', # PyCrypto - https://www.pycrypto.org/ | ||
| ] | ||
|
|
||
| pref_lib = CHOOSE_CRYPTO_LIB[0] | ||
| for cryptolib in CHOOSE_CRYPTO_LIB: | ||
| try: | ||
| get_distribution(cryptolib) | ||
| pref_lib = cryptolib | ||
| break | ||
| except DistributionNotFound: | ||
| pass | ||
|
|
||
| INSTALL_REQUIRES.append( pref_lib ) | ||
|
|
||
| setuptools.setup( | ||
| name="tinytuya", | ||
| version=__version__, | ||
| author="Jason Cox", | ||
| author_email="[email protected]", | ||
| description="Python module to interface with Tuya WiFi smart devices", | ||
| long_description=long_description, | ||
| long_description_content_type="text/markdown", | ||
| url='https://github.com/jasonacox/tinytuya', | ||
| packages=setuptools.find_packages(exclude=("sandbox",)), | ||
| install_requires=INSTALL_REQUIRES, | ||
| entry_points={"console_scripts": ["tinytuya=tinytuya.__main__:dummy"]}, | ||
| classifiers=[ | ||
| "Programming Language :: Python :: 3", | ||
| "License :: OSI Approved :: MIT License", | ||
| "Operating System :: OS Independent", | ||
| ], | ||
| ) | ||
| setuptools.setup() | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,3 +97,4 @@ | |
| from .CoverDevice import CoverDevice | ||
| from .BulbDevice import BulbDevice | ||
| from .Cloud import Cloud | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, it was always on my list to get this done. Thank you!! 🙏 :)