Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: Fix failing tests as python setup.py is deprecated #1013

Merged
merged 3 commits into from Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 14 additions & 5 deletions .circleci/config.yml
Expand Up @@ -132,14 +132,17 @@ jobs:
name: Build Docker image
no_output_timeout: 60m
command: |
python3 -m pip install -U build "setuptools >= 45" wheel "setuptools_scm >= 6.2" \
setuptools_scm_git_archive pip twine docutils

# Inject MRIQC-WebAPI secret
if [ "${MRIQC_API_SECRET_TOKEN}" != "" ]; then
sed -i -E "s/<secret_token>/$MRIQC_API_SECRET_TOKEN/" mriqc/interfaces/webapi.py
sed -i -E "s/<secret_token>/$MRIQC_API_SECRET_TOKEN/" mriqc/data/reports/individual.html
grep -q -i $MRIQC_API_SECRET_TOKEN mriqc/interfaces/webapi.py
fi
# Get version, update files.
THISVERSION=$( python3 -c "from versioneer import get_version; print(get_version())" )
THISVERSION=$( python3 -m setuptools_scm )
if [[ ${THISVERSION:0:1} == "0" ]] ; then
echo "WARNING: latest git tag could not be found"
echo "Please, make sure you fetch all tags from upstream with"
Expand Down Expand Up @@ -624,11 +627,15 @@ jobs:
command: sudo apt update && sudo apt -y install graphviz
- run:
name: Install deps
command: pip install --no-cache-dir -r docs/requirements.txt
command: |
pip install -U build "setuptools >= 45" wheel "setuptools_scm >= 6.2" \
setuptools_scm_git_archive pip twine docutils
pip install --no-cache-dir -r docs/requirements.txt
- run:
name: Build MRIQC documentation
no_output_timeout: 2h
command: |
python -m setuptools_scm
make -C docs html
# make -C docs SPHINXOPTS="-W" html | tee $PWD/builddocs.log
# cat $PWD/builddocs.log
Expand Down Expand Up @@ -677,7 +684,8 @@ jobs:
- run:
name: Start virtual environment
command: |
sudo python -m pip install "setuptools>=30.3.0" "pip>=10.0.1" twine docutils
sudo python -m pip install -U build "setuptools >= 45" wheel "setuptools_scm >= 6.2" \
setuptools_scm_git_archive pip twine docutils
python -m venv /tmp/venv
source /tmp/venv/bin/activate
- run:
Expand All @@ -691,7 +699,7 @@ jobs:
if [[ "${CIRCLE_TAG}" != "" ]]; then
echo "${CIRCLE_TAG}" > mriqc/VERSION
fi
THISVERSION=$( python -c "from versioneer import get_version; print(get_version())" )
THISVERSION=$( python3 -m setuptools_scm )
python -m pip install --user dist/*.tar.gz
mkdir empty
cd empty
Expand All @@ -707,7 +715,8 @@ jobs:
- run:
name: Start virtual environment
command: |
sudo python -m pip install "setuptools>=30.3.0" "pip>=10.0.1" twine docutils
sudo python -m pip install -U build "setuptools >= 45" wheel "setuptools_scm >= 6.2" \
setuptools_scm_git_archive pip twine docutils
python -m venv /tmp/venv
source /tmp/venv/bin/activate
- run:
Expand Down
1 change: 0 additions & 1 deletion .dockerignore
Expand Up @@ -42,7 +42,6 @@ CONTRIBUTING.md
codecov.yml
docs
docs/**/*
get_version.py
long_description.rst
notebooks
notebooks/**/*
Expand Down
81 changes: 39 additions & 42 deletions .github/workflows/pythonpackage.yml
Expand Up @@ -12,80 +12,77 @@ on:

jobs:
build:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
if: "!startsWith(github.ref, 'refs/tags/') && !contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
pip: ["pip==21.2", "pip~=22.0"]

steps:
- uses: actions/checkout@v2
- name: Fetch all tags (for setuptools_scm to work)
run: |
/usr/bin/git -c protocol.version=2 fetch --tags --prune --unshallow origin
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
ssh-key: "${{ secrets.NIPREPS_DEPLOY }}"
fetch-depth: 0
- name: Build in confined, updated environment and interpolate version
path: $HOME/.cache/pip
key: pip-cache-v1
restore-keys: |
pip-cache-
- name: Build in confined environment and interpolate version
run: |
python -m venv /tmp/buildenv
source /tmp/buildenv/bin/activate
python -m pip install -U "setuptools~=58.0" "setuptools_scm>=6.2" pip wheel twine docutils

python -m pip install -U build "setuptools >= 45" wheel "setuptools_scm >= 6.2" \
setuptools_scm_git_archive pip twine docutils

python -m build -s -w
python -m twine check dist/mriqc-*
mv dist /tmp/package
rm -rf mriqc.egg-info/
# Interpolate version
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
TAG=${GITHUB_REF##*/}
fi
THISVERSION=$( python setup.py --version )
THISVERSION=$( python -m setuptools_scm )
THISVERSION=${TAG:-$THISVERSION}
echo "Expected VERSION: \"${THISVERSION}\""
echo "THISVERSION=${THISVERSION}" >> ${GITHUB_ENV}

python setup.py sdist
python -m twine check dist/mriqc-${THISVERSION}.tar.gz

python setup.py bdist_wheel
python -m twine check dist/mriqc-${THISVERSION}-py3-none-any.whl

echo "THISVERSION=${THISVERSION}" >> $GITHUB_ENV
- name: Install in confined environment [pip]
run: |
python -m venv /tmp/pip
source /tmp/pip/bin/activate
python -m pip install -U "setuptools >= 45" "setuptools_scm >= 6.2" "${{ matrix.pip }}"
python -m pip install .
INSTALLED_VERSION=$(python -c 'import mriqc as qc; print(qc.__version__, end="")')
echo "VERSION: \"${THISVERSION}\""
echo "INSTALLED: \"${INSTALLED_VERSION}\""
test "${INSTALLED_VERSION}" = "${THISVERSION}"
- name: Install in confined environment [sdist]
run: |
python -m venv /tmp/install_sdist
source /tmp/install_sdist/bin/activate
python -m pip install --upgrade pip wheel
python -m pip install dist/mriqc-${THISVERSION}.tar.gz
INSTALLED_VERSION=$(python -c 'import mriqc; print(mriqc.__version__, end="")')
python -m pip install -U "setuptools >= 45" "${{ matrix.pip }}"
python -m pip install /tmp/package/mriqc*.tar.gz
INSTALLED_VERSION=$(python -c 'import mriqc as qc; print(qc.__version__, end="")')
echo "VERSION: \"${THISVERSION}\""
echo "INSTALLED: \"${INSTALLED_VERSION}\""
test "${INSTALLED_VERSION}" = "${THISVERSION}"
- name: Install in confined environment [wheel]
run: |
python -m venv /tmp/install_wheel
source /tmp/install_wheel/bin/activate
python -m pip install --upgrade pip wheel
python -m pip install dist/mriqc-${THISVERSION}-py3-none-any.whl
INSTALLED_VERSION=$(python -c 'import mriqc; print(mriqc.__version__, end="")')
echo "INSTALLED: \"${INSTALLED_VERSION}\""
test "${INSTALLED_VERSION}" = "${THISVERSION}"
- name: Install in confined environment [pip install .]
run: |
python -m venv /tmp/setup_install
source /tmp/setup_install/bin/activate
python -m pip install --upgrade pip wheel
python -m pip install .
INSTALLED_VERSION=$(python -c 'import mriqc; print(mriqc.__version__, end="")')
echo "INSTALLED: \"${INSTALLED_VERSION}\""
test "${INSTALLED_VERSION}" = "${THISVERSION}"
- name: Install in confined environment [pip install -e .]
run: |
python -m venv /tmp/setup_develop
source /tmp/setup_develop/bin/activate
python -m pip install pip
python -m pip install --upgrade pip wheel
python -m pip install -e .
INSTALLED_VERSION=$(python -c 'import mriqc; print(mriqc.__version__, end="")')
python -m pip install -U "setuptools >= 45" "${{ matrix.pip }}"
python -m pip install /tmp/package/mriqc*.whl
INSTALLED_VERSION=$(python -c 'import mriqc as qc; print(qc.__version__, end="")')
echo "INSTALLED: \"${INSTALLED_VERSION}\""
test "${INSTALLED_VERSION}" = "${THISVERSION}"

flake8:
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,3 +1,6 @@
# setuptools-scm
mriqc/_version.py

.DS_Store

# IDE configuration
Expand Down
18 changes: 10 additions & 8 deletions MANIFEST.in
@@ -1,12 +1,14 @@
#documentation
recursive-include docs/build/html *
recursive-exclude .circleci/ *
recursive-exclude .docker/ *
recursive-exclude .github/ *
recursive-exclude .git/ *
recursive-exclude .maint/ *
recursive-exclude docs/ *
recursive-exclude test/ *

exclude .*
exclude Dockerfile

#data
recursive-include mriqc/data *

#Misc
include CHANGES.rst
include LICENSE
include NOTICE
include versioneer.py
include mriqc/_version.py
3 changes: 0 additions & 3 deletions NOTICE
Expand Up @@ -12,9 +12,6 @@ PCP Quality Assessment Protocol (QAP;
http://preprocessed-connectomes-project.github.io/quality-assessment-protocol)
by C. Craddock, S. Giavasis, D. Clark, Z. Shezhad, and J. Pellman.

This software redistributes the versioneer Python package, which is
Public domain source code.

This software is also distributed as a Docker container image.
The bootstraping file for the image ("Dockerfile") is licensed
under the MIT License.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Expand Up @@ -14,7 +14,7 @@
import os
from packaging.version import Version

from mriqc.__about__ import __version__, __copyright__
from mriqc import __version__, __copyright__

# Disable etelemetry during doc builds
os.environ["NIPYPE_NO_ET"] = "1"
Expand Down
18 changes: 0 additions & 18 deletions get_version.py

This file was deleted.

5 changes: 1 addition & 4 deletions mriqc/__about__.py
Expand Up @@ -21,10 +21,7 @@
# https://www.nipreps.org/community/licensing/
#
"""MRIQC."""
from mriqc._version import get_versions

__version__ = get_versions()["version"]
del get_versions
from mriqc._version import __version__

__copyright__ = "Copyright 2020 The NiPreps Developers"
__download__ = f"https://github.com/nipreps/mriqc/archive/{__version__}.tar.gz"
Expand Down
9 changes: 4 additions & 5 deletions mriqc/__init__.py
Expand Up @@ -25,9 +25,8 @@
:abbr:`IQMs (image quality metrics)` to used in :abbr:`QAPs (quality
assessment protocols)` for :abbr:`MRI (magnetic resonance imaging)`.
"""
from mriqc.__about__ import __copyright__, __version__
from mriqc._version import __version__

__all__ = [
"__copyright__",
"__version__",
]
__copyright__ = "Copyright 2022, The NiPreps Developers"
__download__ = f"https://github.com/nipreps/mriqc/archive/{__version__}.tar.gz"
__all__ = ["__version__", "__copyright__", "__download__"]