jenstroeger/python-package-template

Unnecessary env in Action steps

jenstroeger opened this issue · 2 comments

I think these environment variables:

env:
PYTHON: python

aren’t necessary because make setup assumes a venv. The PYTHON environment variable is used only by the make venv goal to pick the Python for the virtual environment:

# Create a virtual environment, either for Python3.10 (default) or using
# the Python interpreter specified in the PYTHON environment variable.
.PHONY: venv
venv:
if [ ! -z "${VIRTUAL_ENV}" ]; then \
echo "Found an activated Python virtual environment, exiting" && exit 1; \
fi
if [ -z "${PYTHON}" ]; then \
echo "Creating virtual envirnoment in .venv/ for python3.10"; \
python3.10 -m venv --upgrade-deps .venv; \
else \
echo "Creating virtual envirnoment in .venv/ for ${PYTHON}"; \
${PYTHON} -m venv --upgrade-deps .venv; \
fi

Also, I think if we replace this

- name: Build the package
# We don't need to check and test the package separately
# because `make dist` runs those targets first and only
# builds the package if they succeed.
run: make dist
- name: Build the docs
run: make docs

with

    # We don't need to check and test the package separately
    # because `make dist` runs those targets first and only
    # builds the package if they succeed.
    - name: Build the package artifacts and documentation
      run: make dist docs

then the tests will run only once because make resolves the common check test dependency of the dist and doc goals. And actually, make all should do:

# Check, test, and build artifacts for this package.
.PHONY: all
all: check test dist docs

PR #248, commit 2a24e24.