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

CI: Update package builds to use python -m build #2746

Merged
merged 2 commits into from
Mar 25, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 15 additions & 36 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1055,23 +1055,16 @@ jobs:

test_deploy_pypi:
docker:
- image: circleci/python:3.8.5
- image: cimg/python:3.9
working_directory: /tmp/src/fmriprep
steps:
- checkout
- run:
name: Update build tools
command: python -m pip install --user pip build twine
- run:
name: Build fMRIPrep
command: |
python -m pip install --user twine # For use in checking distributions
THISVERSION=$( python get_version.py )
THISVERSION=${THISVERSION%.dirty*}
THISVERSION=${CIRCLE_TAG:-$THISVERSION}
virtualenv --python=python build
source build/bin/activate
pip install --upgrade "pip>=19.1" numpy
echo "${CIRCLE_TAG:-$THISVERSION}" > fmriprep/VERSION
python setup.py sdist
python -m pip wheel --no-deps -w dist/ .
command: python -m build
- store_artifacts:
path: /tmp/src/fmriprep/dist
- run:
Expand Down Expand Up @@ -1114,47 +1107,33 @@ jobs:
command: |
THISVERSION=$( python get_version.py )
THISVERSION=${THISVERSION%.dirty*}
cd wrapper
virtualenv --python=python build
source build/bin/activate
python -m pip install --upgrade "pip>=19.1"
sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'${CIRCLE_TAG:-$THISVERSION}'/" fmriprep_docker.py
python setup.py sdist
python -m pip wheel --no-deps -w dist/ .
sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'${CIRCLE_TAG:-$THISVERSION}'/" wrapper/fmriprep_docker.py
python -m build wrapper/
- store_artifacts:
path: /tmp/src/fmriprep/wrapper/dist

deploy_pypi:
docker:
- image: circleci/python:3.8.5
- image: cimg/python:3.9
working_directory: /tmp/src/fmriprep
steps:
- checkout
- run:
name: Update build tools
command: python -m pip install --user build twine
- run:
name: Build fMRIPrep
command: |
THISVERSION=$( python get_version.py )
virtualenv --python=python build
source build/bin/activate
python -m pip install --upgrade "pip>=19.1"
echo "${CIRCLE_TAG:-$THISVERSION}" > fmriprep/VERSION
python setup.py sdist
python -m pip wheel --no-deps -w dist/ .
command: python -m build
- run:
name: Build fmriprep-docker
command: |
THISVERSION=$( python get_version.py )
cd wrapper
virtualenv --python=python build
source build/bin/activate
python -m pip install --upgrade "pip>=19.1"
sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'${CIRCLE_TAG:-$THISVERSION}'/" fmriprep_docker.py
python setup.py sdist
python -m pip wheel --no-deps -w dist/ .
THISVERSION=${THISVERSION%.dirty*}
sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'${CIRCLE_TAG:-$THISVERSION}'/" wrapper/fmriprep_docker.py
python -m build wrapper/
- run:
name: Upload packages to PyPI
command: |
python -m pip install --user twine
python -m twine upload dist/fmriprep* wrapper/dist/fmriprep*

deployable:
Expand Down
25 changes: 13 additions & 12 deletions .maint/ci/build_archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@ echo "INSTALL_TYPE = $INSTALL_TYPE"

set -x

if [ "$INSTALL_TYPE" == "sdist" ]; then
python setup.py egg_info # check egg_info while we're here
python setup.py sdist
export ARCHIVE=$( ls dist/*.tar.gz )
elif [ "$INSTALL_TYPE" == "wheel" ]; then
python setup.py bdist_wheel
export ARCHIVE=$( ls dist/*.whl )
elif [ "$INSTALL_TYPE" == "archive" ]; then
export ARCHIVE="package.tar.gz"
if [ "$INSTALL_TYPE" = "sdist" -o "$INSTALL_TYPE" = "wheel" ]; then
python -m build
elif [ "$INSTALL_TYPE" = "archive" ]; then
ARCHIVE="/tmp/package.tar.gz"
git archive -o $ARCHIVE HEAD
elif [ "$INSTALL_TYPE" == "pip" ]; then
export ARCHIVE="."
fi

if [ "${ARCHIVE:0:5}" = "dist/" ]; then
if [ "$INSTALL_TYPE" = "sdist" ]; then
ARCHIVE=$( ls $PWD/dist/*.tar.gz )
elif [ "$INSTALL_TYPE" = "wheel" ]; then
ARCHIVE=$( ls $PWD/dist/*.whl )
elif [ "$INSTALL_TYPE" = "pip" ]; then
ARCHIVE="$PWD"
fi

if [ "$INSTALL_TYPE" = "sdist" -o "$INSTALL_TYPE" = "wheel" ]; then
python -m pip install twine
python -m twine check $ARCHIVE
fi
Expand Down
2 changes: 1 addition & 1 deletion .maint/ci/env.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SETUP_REQUIRES="pip setuptools>=40.8 wheel"
SETUP_REQUIRES="pip build"

# Numpy and scipy upload nightly/weekly/intermittent wheels
NIGHTLY_WHEELS="https://pypi.anaconda.org/scipy-wheels-nightly/simple"
Expand Down