Skip to content

Commit

Permalink
tox: some prep for potentially using uv on CI instead of pip
Browse files Browse the repository at this point in the history
see #391
  • Loading branch information
karlicoss committed Sep 22, 2024
1 parent 3166109 commit 3ce1c86
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 37 deletions.
10 changes: 10 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
78 changes: 41 additions & 37 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand All @@ -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
Expand All @@ -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 \
Expand All @@ -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 \
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3ce1c86

Please sign in to comment.