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 'orjson', # for my.core.serialize and denylist
'simplejson', # for my.core.serialize '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': [ 'optional': [
# todo document these? # todo document these?

78
tox.ini
View file

@ -24,16 +24,19 @@ passenv =
[testenv:ruff] [testenv:ruff]
install_command = {envpython} -m pip install --use-pep517 {opts} {packages}
deps =
-e .[testing]
commands = commands =
{envpython} -m pip install --use-pep517 -e .[testing]
{envpython} -m ruff check my/ {envpython} -m ruff check my/
# just the very core tests with minimal dependencies # just the very core tests with minimal dependencies
[testenv:tests-core] [testenv:tests-core]
install_command = {envpython} -m pip install --use-pep517 {opts} {packages}
deps =
-e .[testing]
commands = commands =
{envpython} -m pip install --use-pep517 -e .[testing]
{envpython} -m pytest \ {envpython} -m pytest \
# importlib is the new suggested import-mode # importlib is the new suggested import-mode
# without it test package names end up as core.tests.* instead of my.core.tests.* # 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? # TODO not sure if need it?
MY_CONFIG=nonexistent MY_CONFIG=nonexistent
HPI_TESTS_USES_OPTIONAL_DEPS=true 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 = commands =
{envpython} -m pip install --use-pep517 -e .[testing] {envpython} -m my.core module install \
## tz/location
{envpython} -m pip install cachew my.location.google \
my.time.tz.via_location \
{envpython} -m my.core module install my.location.google my.ip.all \
{envpython} -m pip install ijson # optional dependency my.location.gpslogger \
my.location.fallback.via_ip \
# tz/location my.google.takeout.parser \
{envpython} -m my.core module install my.time.tz.via_location ##
{envpython} -m my.core module install my.ip.all my.calendar.holidays \
{envpython} -m my.core module install my.location.gpslogger my.orgmode \ # my.body.weight dep
{envpython} -m my.core module install my.location.fallback.via_ip my.coding.commits \
{envpython} -m my.core module install my.google.takeout.parser my.pdfs \
my.reddit.rexport
{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 pytest \ {envpython} -m pytest \
# importlib is the new suggested import-mode # importlib is the new suggested import-mode
@ -88,18 +86,20 @@ commands =
[testenv:demo] [testenv:demo]
deps =
git+https://github.com/karlicoss/hypexport
commands = commands =
{envpython} -m pip install git+https://github.com/karlicoss/hypexport
{envpython} ./demo.py {envpython} ./demo.py
[testenv:mypy-core] [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 = commands =
{envpython} -m pip install --use-pep517 -e .[testing,optional] {envpython} -m mypy --no-install-types \
{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 \
-p {[testenv]package_name}.core \ -p {[testenv]package_name}.core \
--txt-report .coverage.mypy-core \ --txt-report .coverage.mypy-core \
--html-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) # 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 # todo maybe split into separate jobs? need to add comment how to run
[testenv:mypy-misc] [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 = commands =
{envpython} -m pip install --use-pep517 -e .[testing,optional]
{envpython} -m my.core module install \ {envpython} -m my.core module install \
my.arbtt \ my.arbtt \
my.browser.export \ my.browser.export \
@ -143,13 +147,13 @@ commands =
my.time.tz.via_location my.time.tz.via_location
{envpython} -m mypy --install-types --non-interactive \ {envpython} -m mypy --no-install-types \
-p {[testenv]package_name} \ -p {[testenv]package_name} \
--txt-report .coverage.mypy-misc \ --txt-report .coverage.mypy-misc \
--html-report .coverage.mypy-misc \ --html-report .coverage.mypy-misc \
{posargs} {posargs}
{envpython} -m mypy --install-types --non-interactive \ {envpython} -m mypy --no-install-types \
tests tests
# note: this comment doesn't seem relevant anymore, but keeping it in case the issue happens again # note: this comment doesn't seem relevant anymore, but keeping it in case the issue happens again