From 75639a3d5ec3b07fb7e6b638e9e3c342a23cc1a2 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Sun, 22 Sep 2024 19:50:58 +0100 Subject: [PATCH] tox: some prep for potentially using uv on CI instead of pip see https://github.com/karlicoss/HPI/issues/391 --- setup.py | 10 ++++++++ tox.ini | 78 +++++++++++++++++++++++++++++--------------------------- 2 files changed, 51 insertions(+), 37 deletions(-) diff --git a/setup.py b/setup.py index 83358510..e49eee02 100644 --- a/setup.py +++ b/setup.py @@ -58,6 +58,16 @@ def main() -> None: 'orjson', # for my.core.serialize and denylist 'simplejson', # for my.core.serialize + + ## + # ideally we'd use --instal-types in mypy + # , but looks like it doesn't respect uv venv if it's running in it :( + 'types-pytz' , # for my.core + 'types-decorator' , # for my.core.compat + 'pandas-stubs' , # for my.core.pandas + 'types-dateparser', # for my.core.query_range + 'types-simplejson', # for my.core.serialize + ## ], 'optional': [ # todo document these? diff --git a/tox.ini b/tox.ini index 6b95088d..4e5dff6b 100644 --- a/tox.ini +++ b/tox.ini @@ -24,16 +24,19 @@ passenv = [testenv:ruff] +install_command = {envpython} -m pip install --use-pep517 {opts} {packages} +deps = + -e .[testing] commands = - {envpython} -m pip install --use-pep517 -e .[testing] {envpython} -m ruff check my/ # just the very core tests with minimal dependencies [testenv:tests-core] +install_command = {envpython} -m pip install --use-pep517 {opts} {packages} +deps = + -e .[testing] commands = - {envpython} -m pip install --use-pep517 -e .[testing] - {envpython} -m pytest \ # importlib is the new suggested import-mode # without it test package names end up as core.tests.* instead of my.core.tests.* @@ -53,31 +56,26 @@ setenv = # TODO not sure if need it? MY_CONFIG=nonexistent HPI_TESTS_USES_OPTIONAL_DEPS=true +install_command = {envpython} -m pip install --use-pep517 {opts} {packages} +deps = + -e .[testing] + cachew + ijson # optional dependency for various modules commands = - {envpython} -m pip install --use-pep517 -e .[testing] - - {envpython} -m pip install cachew - - {envpython} -m my.core module install my.location.google - {envpython} -m pip install ijson # optional dependency - - # tz/location - {envpython} -m my.core module install my.time.tz.via_location - {envpython} -m my.core module install my.ip.all - {envpython} -m my.core module install my.location.gpslogger - {envpython} -m my.core module install my.location.fallback.via_ip - {envpython} -m my.core module install my.google.takeout.parser - - {envpython} -m my.core module install my.calendar.holidays - - # my.body.weight dep - {envpython} -m my.core module install my.orgmode - - {envpython} -m my.core module install my.coding.commits - - {envpython} -m my.core module install my.pdfs - - {envpython} -m my.core module install my.reddit.rexport + {envpython} -m my.core module install \ + ## tz/location + my.location.google \ + my.time.tz.via_location \ + my.ip.all \ + my.location.gpslogger \ + my.location.fallback.via_ip \ + my.google.takeout.parser \ + ## + my.calendar.holidays \ + my.orgmode \ # my.body.weight dep + my.coding.commits \ + my.pdfs \ + my.reddit.rexport {envpython} -m pytest \ # importlib is the new suggested import-mode @@ -88,18 +86,20 @@ commands = [testenv:demo] +deps = + git+https://github.com/karlicoss/hypexport commands = - {envpython} -m pip install git+https://github.com/karlicoss/hypexport {envpython} ./demo.py [testenv:mypy-core] +install_command = {envpython} -m pip install --use-pep517 {opts} {packages} +deps = + -e .[testing,optional] + orgparse # for core.orgmode + gpxpy # for hpi query --output gpx commands = - {envpython} -m pip install --use-pep517 -e .[testing,optional] - {envpython} -m pip install orgparse # used it core.orgmode? - {envpython} -m pip install gpxpy # for hpi query --output gpx - - {envpython} -m mypy --install-types --non-interactive \ + {envpython} -m mypy --no-install-types \ -p {[testenv]package_name}.core \ --txt-report .coverage.mypy-core \ --html-report .coverage.mypy-core \ @@ -109,9 +109,13 @@ commands = # specific modules that are known to be mypy compliant (to avoid false negatives) # todo maybe split into separate jobs? need to add comment how to run [testenv:mypy-misc] +install_command = {envpython} -m pip install --use-pep517 {opts} {packages} +deps = + -e .[testing,optional] + lxml-stubs # for my.smscalls + types-protobuf # for my.google.maps.android + types-Pillow # for my.photos commands = - {envpython} -m pip install --use-pep517 -e .[testing,optional] - {envpython} -m my.core module install \ my.arbtt \ my.browser.export \ @@ -143,13 +147,13 @@ commands = my.time.tz.via_location - {envpython} -m mypy --install-types --non-interactive \ + {envpython} -m mypy --no-install-types \ -p {[testenv]package_name} \ --txt-report .coverage.mypy-misc \ --html-report .coverage.mypy-misc \ {posargs} - {envpython} -m mypy --install-types --non-interactive \ + {envpython} -m mypy --no-install-types \ tests # note: this comment doesn't seem relevant anymore, but keeping it in case the issue happens again