Skip to content

Commit 4f6ee15

Browse files
committed
Prefer the venv module over virtualenv
virtualenv 20.27.0 dropped support to create Python 3.7 virtual environments. Also: - Drop unused `release` Make target - Use new `build` tox target in GitHub workflow - Clean also `.mypy_cache` directories
1 parent 062a3c9 commit 4f6ee15

File tree

6 files changed

+29
-25
lines changed

6 files changed

+29
-25
lines changed

.github/workflows/deploy.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@ jobs:
88
- uses: actions/setup-python@v5
99
with:
1010
python-version: '3.13'
11-
- name: Install dependencies
11+
- name: Install tox
1212
run: |
13-
python3 -m pip install --upgrade pip setuptools
14-
python3 -m pip install --upgrade build twine
13+
python3 -m pip install 'tox>=1.8.0'
1514
- name: Create and check sdist and wheel packages
16-
run: |
17-
python3 -m build
18-
twine check dist/*
15+
run: tox -e build
1916
- name: Publish to PyPI
2017
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'galaxyproject'
2118
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ jobs:
128128
- name: Install tox
129129
run: |
130130
python3 -m pip install --upgrade pip setuptools
131-
python3 -m pip install 'tox>=1.8.0' 'virtualenv>=20.0.14'
131+
python3 -m pip install 'tox>=1.8.0'
132132
- name: Set up Python for Galaxy
133133
uses: actions/setup-python@v5
134134
with:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ cover
4141
# compiled docs
4242
docs/_build
4343

44-
# Python virtualenv
44+
# Python virtual environment
4545
.venv

Makefile

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,13 @@ all:
77

88
clean:
99
rm -rf bioblend.egg-info/ build/ dist/
10+
find . -type d -name '.mypy_cache' -exec rm -rf {} +
1011
make -C docs/ clean
1112

1213
venv:
1314
# Create and activate a virtual environment
14-
[ -f .venv/bin/activate ] || virtualenv -p python3 .venv
15-
( $(IN_VENV) && \
16-
# Install latest versions of pip and setuptools \
17-
python3 -m pip install --upgrade pip setuptools && \
18-
# Install latest versions of other needed packages in the virtualenv \
19-
python3 -m pip install --upgrade twine wheel \
20-
)
21-
22-
release: clean venv
23-
( $(IN_VENV) && \
24-
# Create files in dist/ \
25-
python3 setup.py sdist bdist_wheel && \
26-
twine check dist/* && \
27-
twine upload dist/*
15+
[ -f .venv/bin/activate ] || python3 -m venv .venv || virtualenv -p python3 .venv
16+
# Install latest versions of pip and setuptools
17+
( $(IN_VENV) \
18+
&& python3 -m pip install --upgrade pip setuptools \
2819
)

run_bioblend_tests.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ BIOBLEND_DIR=$(get_abs_dirname "$(dirname "$0")")
6262
if ! command -v tox >/dev/null; then
6363
cd "${BIOBLEND_DIR}"
6464
if [ ! -d .venv ]; then
65-
virtualenv -p python3 .venv
65+
python3 -m venv .venv
6666
fi
6767
. .venv/bin/activate
6868
python3 -m pip install --upgrade "tox>=1.8.0"
@@ -88,10 +88,14 @@ else
8888
esac
8989
fi
9090

91-
# Setup Galaxy virtualenv
91+
# Setup Galaxy virtual environment
9292
if [ -n "${GALAXY_PYTHON}" ]; then
9393
if [ ! -d .venv ]; then
94-
virtualenv -p "${GALAXY_PYTHON}" .venv
94+
if ! "${GALAXY_PYTHON}" -m venv .venv; then
95+
echo "Creating the Python virtual environment for Galaxy using the venv standard library module failed."
96+
echo "Trying with virtualenv now."
97+
virtualenv -p "$GALAXY_PYTHON" .venv
98+
fi
9599
fi
96100
export GALAXY_PYTHON
97101
fi

tox.ini

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ passenv =
1515
GALAXY_VERSION
1616
BIOBLEND_TOOLSHED_URL
1717

18+
[testenv:build]
19+
commands =
20+
make clean
21+
python3 -m build
22+
twine check dist/*
23+
deps =
24+
build
25+
twine
26+
allowlist_externals =
27+
make
28+
skip_install = true
29+
1830
[testenv:lint]
1931
commands =
2032
ruff check .

0 commit comments

Comments
 (0)