tox: some prep for potentially using uv on CI instead of pip

see https://github.com/karlicoss/HPI/issues/391
This commit is contained in:
Dima Gerasimov 2024-09-22 19:50:58 +01:00 committed by karlicoss
parent 3166109f15
commit 75639a3d5e
2 changed files with 51 additions and 37 deletions

View file

@ -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?

78
tox.ini
View file

@ -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