Repository navigation
Expand file tree
/
Copy pathtox.ini
More file actions
166 lines (144 loc) · 8.25 KB
/
Copy pathtox.ini
File metadata and controls
166 lines (144 loc) · 8.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
[tox]
envlist = py{310,311},lint
skip_missing_interpreters = True
ignore_basepython_conflict = True
[testenv]
usedevelop = True
# basepython = {env:TOX_BASEPYTHON:python3.10}
# XXX The current version of Tahoe-LAFS (1.18.0) doesn't support Python 3.11;
# this constraint can/should be removed after the next Tahoe-LAFS release.
basepython = python3.10
install_command = {envpython} scripts/reproducible-pip.py install --no-deps {opts} {packages}
setenv =
# The time saved by having bytecode around instead of having to recompile
# the source code is probably negligible. Even if it isn't, avoiding the
# extra complexity involved in having the bytecode around (is it for the
# right Python version? How does it interact with the pytest-generated
# bytecode? is it up-to-date with respect to the source files? etc) is a
# far greater cost. So, don't have bytecode.
PYTHONDONTWRITEBYTECODE=1
# Remove a source of non-determinism from the builds by making sure
# strings hash to the same value from one run to the next.
PYTHONHASHSEED=1
# Avoid modifying logs in the main Gridsync config dir during test runs
GRIDSYNC_LOGGING_PATH=.logs
pyqt6: QT_API=pyqt6
pyside6: QT_API=pyside6
deps =
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/gridsync.txt
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/{env:QT_API:pyqt6}.txt
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/test.txt
commands =
{envpython} -m pytest {posargs}
passenv = *
# Required to pass environment variables to the packaging/building/installing
# stage when using tox 4.0.x. See https://github.com/tox-dev/tox/issues/2543
[testenv:.pkg]
passenv = *
[testenv:lint]
deps =
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/gridsync.txt
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/{env:QT_API:pyqt6}.txt
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/lint.txt
commands =
{envpython} -m ruff check --output-format=full gridsync tests
{envpython} -m black --line-length=79 --check --diff gridsync tests
{envpython} -m isort --line-length=79 --check --diff gridsync tests
{envpython} -m mypy gridsync
{envpython} -m pylint --reports=no gridsync
[testenv:format]
deps =
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/lint.txt
commands =
{envpython} -m black gridsync tests
{envpython} -m isort gridsync tests
[testenv:pyinstaller]
# Seemingly required to respect environment variables with tox version 4.0.x;
# for some reason, with `usedevelop = True`, we always unded end up pulling in
# PyQt6 on macOS and Linux, even when QT_API=pyqt5 is declared...
usedevelop = False
deps =
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/gridsync.txt
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/{env:QT_API:pyqt6}.txt
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/pyinstaller.txt
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/tahoe-lafs.txt
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/magic-folder.txt
commands =
{envpython} -m pip list
{envpython} -m pip check
{envpython} -m PyInstaller -y pyinstaller.spec
[testenv:pyinstaller-windows]
# setuptools >= 66.0.0 breaks Magic-Folder PyInstaller builds on Windows.
# See/follow: https://github.com/gridsync/gridsync/issues/595
deps = {[testenv:pyinstaller]deps}
commands =
{envpython} -m pip install setuptools<66
{envpython} -m pip list
{envpython} -m pip check
{envpython} -m PyInstaller -y pyinstaller.spec
[testenv:pyinstaller-tahoe]
skip_install = True
deps =
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/pyinstaller.txt
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/tahoe-lafs.txt
commands = {[testenv:pyinstaller]commands}
[testenv:pyinstaller-magic-folder]
skip_install = True
deps =
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/pyinstaller.txt
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/magic-folder.txt
commands = {[testenv:pyinstaller]commands}
[testenv:pyinstaller-gridsync]
deps =
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/pyinstaller.txt
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/gridsync.txt
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/{env:QT_API:pyqt6}.txt
commands = {[testenv:pyinstaller]commands}
[testenv:integration]
deps =
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/gridsync.txt
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/{env:QT_API:pyqt6}.txt
-r{toxinidir}/{env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/test.txt
commands =
{envpython} -m pytest -s -v {posargs:tests/integration}
[testenv:update-dependencies]
skip_install = True
install_command = {envpython} -m pip install {opts} {packages}
deps =
pip-tools
hashin
commands =
pip-compile -q --allow-unsafe --generate-hashes --upgrade --output-file={env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/gridsync-base.txt {env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/gridsync.in
pip-compile -q --allow-unsafe --generate-hashes --upgrade --output-file={env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/tahoe-lafs-base.txt {env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/tahoe-lafs.in
pip-compile -q --allow-unsafe --generate-hashes --upgrade --output-file={env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/tahoe-lafs-base.txt {env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/tahoe-lafs.in
pip-compile -q --allow-unsafe --generate-hashes --upgrade --output-file={env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/magic-folder-base.txt {env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/magic-folder.in
pip-compile -q --allow-unsafe --generate-hashes --upgrade --output-file={env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/pyinstaller-base.txt {env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/pyinstaller.in
pip-compile -q --allow-unsafe --generate-hashes --upgrade --output-file={env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/test.txt {env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/test.in
pip-compile -q --allow-unsafe --generate-hashes --upgrade --output-file={env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/lint.txt {env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/lint.in
pip-compile -q --allow-unsafe --generate-hashes --upgrade --output-file={env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/dmgbuild.txt {env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/dmgbuild.in
pip-compile -q --allow-unsafe --generate-hashes --upgrade --output-file={env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/pyqt6.txt {env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/pyqt6.in
pip-compile -q --allow-unsafe --generate-hashes --upgrade --output-file={env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/pyside6.txt {env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/pyside6.in
# `pip-compile` will not generate hashes for platform-specific dependencies
# (e.g., those declared via PEP 508 environment markers) nor will it
# preserve in its output environment markers specified in its input files.
# To avoid having to "execute pip-compile on each Python environment
# separately" (as the `pip-tools` README recommends), we use `hashin` here
# to update our platform-specific dependencies from any host environment.
# Note, however, that, unlike `pip-compile`, `hashin` updates its files "in
# place", and so adding/removing dependencies to/from these files must be
# done manually (e.g., when `pip check` fails due to an unmet requirement).
hashin --update-all -r {env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/gridsync-platform.txt
hashin --update-all -r {env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/tahoe-lafs-platform.txt
hashin --update-all -r {env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/magic-folder-platform.txt
# Disabled for now because pyinstaller 6.11.1 requires
# pefile!=2024.8.26,>=2022.5.30; sys_platform == "win32"
# but `hashin` always pulls in the latest version..
# See/follow https://github.com/pyinstaller/pyinstaller/issues/8762
# hashin --update-all -r {env:GRIDSYNC_REQUIREMENTS_DIR:requirements}/pyinstaller-platform.txt
[testenv:update-github-repo]
skip_install = True
install_command = {envpython} -m pip install {opts} {packages}
deps =
httpx
commands =
{envpython} {toxinidir}/scripts/update-github-repo {posargs}