diff --git a/.circleci/config.yml b/.circleci/config.yml index d5ae13f3..7a5354d8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,7 +26,7 @@ jobs: pip install -U pip pip install -r /tmp/src/templateflow/requirements.txt pip install "datalad ~= 0.11.8" - pip install "setuptools>=45" "setuptools_scm >= 6.2" twine codecov + pip install "setuptools>=45" "setuptools_scm >= 6.2" nipreps-versions build twine codecov - run: name: Install git and git-annex @@ -120,7 +120,7 @@ jobs: command: | source /tmp/venv/bin/activate cd /tmp/src/templateflow - python setup.py sdist + python -m build twine check dist/* build_docs: @@ -150,8 +150,8 @@ jobs: if ! [ -x "$(command -v conda)" ]; then curl -sSLO https://repo.anaconda.com/miniconda/Miniconda3-py39_4.11.0-Linux-x86_64.sh bash Miniconda3-py39_4.11.0-Linux-x86_64.sh -b -p $HOME/.conda - $HOME/.conda/bin/conda env update -f docs/environment.yml --prune fi + $HOME/.conda/bin/conda env update -f docs/environment.yml --prune - save_cache: key: env-v7-{{ .Branch }} @@ -194,8 +194,8 @@ jobs: name: Deploy to PyPi command: | source /tmp/venv/bin/activate - pip install "setuptools>=45" "setuptools_scm >= 6.2" wheel twine - python setup.py sdist bdist_wheel + pip install build twine + python -m build twine check dist/* twine upload dist/* diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 74d69f72..097707f4 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -10,193 +10,123 @@ on: pull_request: branches: [ master ] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + jobs: build: - if: "!startsWith(github.ref, 'refs/tags/') && !contains(github.event.head_commit.message, '[skip ci]')" runs-on: ubuntu-latest + outputs: + version: ${{ steps.get_version.outputs.version }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-python@v4 + with: + python-version: 3 + - uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: pip-cache-v1 + restore-keys: | + pip-cache- + - run: pip install --upgrade build twine + - name: Build sdist and wheel + run: python -m build + - run: twine check dist/* + - uses: actions/upload-artifact@v3 + with: + name: dist + path: dist/ + - name: Interpolate version in confined environment + id: get_version + run: | + python -m venv /tmp/buildenv + source /tmp/buildenv/bin/activate + python -m pip install --upgrade setuptools setuptools_scm nipreps-versions + if [[ "$GITHUB_REF" == refs/tags/* ]]; then + TAG=${GITHUB_REF##*/} + fi + THISVERSION=$( python -m setuptools_scm ) + THISVERSION=${TAG:-$THISVERSION} + echo "Expected VERSION: \"${THISVERSION}\"" + echo "version=${THISVERSION}" >> $GITHUB_OUTPUT + + test-install: + runs-on: ubuntu-latest + needs: build strategy: matrix: - python-version: [3.7, 3.8, 3.9] - pip: ["pip==21.2", "pip~=22.0"] - + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + mode: ['wheel'] + include: + - {python-version: '3.9', mode: 'repo'} + - {python-version: '3.9', mode: 'sdist'} + - {python-version: '3.9', mode: 'editable'} + + env: + TEMPLATEFLOW_HOME: /tmp/home + THISVERSION: ${{ needs.build.outputs.version }} 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 + - uses: actions/checkout@v3 + if: matrix.mode == 'repo' || matrix.mode == 'editable' + with: + fetch-depth: 0 + - uses: actions/download-artifact@v3 + if: matrix.mode == 'sdist' || matrix.mode == 'wheel' + with: + name: dist + path: /tmp/package/ - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - uses: actions/cache@v1 + - uses: actions/cache@v3 with: - path: $HOME/.cache/pip + path: ~/.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 >= 45" wheel "setuptools_scm >= 6.2" \ - setuptools_scm_git_archive pip twine docutils - python setup.py sdist bdist_wheel - python -m twine check dist/templateflow* - - mv dist /tmp/package - rm -rf templateflow.egg-info/ - - # Interpolate version - if [[ "$GITHUB_REF" == refs/tags/* ]]; then - TAG=${GITHUB_REF##*/} - fi - THISVERSION=$( python setup.py --version ) - THISVERSION=${TAG:-$THISVERSION} - echo "Expected VERSION: \"${THISVERSION}\"" - echo "THISVERSION=${THISVERSION}" >> $GITHUB_ENV - - - name: Install in confined environment [pip] - env: - TEMPLATEFLOW_HOME: /tmp/home/pip + - name: Upgrade pip + run: pip install --upgrade pip wheel + - name: Set install command 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 templateflow as tf; print(tf.__version__, end="")') - echo "VERSION: \"${THISVERSION}\"" - echo "INSTALLED: \"${INSTALLED_VERSION}\"" - test "${INSTALLED_VERSION}" = "${THISVERSION}" - - - name: Install in confined environment [sdist] - env: - TEMPLATEFLOW_HOME: /tmp/home/sdist + case ${{ matrix.mode }} in + repo) + echo "TARGET=." >> $GITHUB_ENV + ;; + editable) + echo "TARGET=-e ." >> $GITHUB_ENV + ;; + sdist) + echo "TARGET=$( ls /tmp/package/templateflow*.tar.gz )" >> $GITHUB_ENV + ;; + wheel) + echo "TARGET=$( ls /tmp/package/templateflow*.whl )" >> $GITHUB_ENV + ;; + esac + - name: Install and check version run: | - python -m venv /tmp/install_sdist - source /tmp/install_sdist/bin/activate - python -m pip install -U "setuptools >= 45" "${{ matrix.pip }}" - python -m pip install /tmp/package/templateflow*.tar.gz + pip install $TARGET INSTALLED_VERSION=$(python -c 'import templateflow as tf; print(tf.__version__, end="")') echo "VERSION: \"${THISVERSION}\"" echo "INSTALLED: \"${INSTALLED_VERSION}\"" test "${INSTALLED_VERSION}" = "${THISVERSION}" - - name: Re-install in confined environment [sdist] - env: - TEMPLATEFLOW_HOME: /tmp/home/sdist - run: | - source /tmp/install_sdist/bin/activate - python -m pip install /tmp/package/templateflow*.tar.gz --force-reinstall - find ${TEMPLATEFLOW_HOME} >> /tmp/.sdist-install.txt - - name: Re-install in confined environment [sdist - missing template] - env: - TEMPLATEFLOW_HOME: /tmp/home/sdist - run: | - rm -rf ${TEMPLATEFLOW_HOME}/tpl-MNI152NLin2009cAsym - source /tmp/install_sdist/bin/activate - python -m pip install /tmp/package/templateflow*.tar.gz --force-reinstall - python -c "import templateflow; templateflow.update(overwrite=False)" - find ${TEMPLATEFLOW_HOME} >> /tmp/.sdist-install-2.txt - diff /tmp/.sdist-install.txt /tmp/.sdist-install-2.txt - exit $? - - - name: Install in confined environment [wheel] - env: - TEMPLATEFLOW_HOME: /tmp/home/wheel - run: | - python -m venv /tmp/install_wheel - source /tmp/install_wheel/bin/activate - python -m pip install -U "setuptools >= 45" "${{ matrix.pip }}" - python -m pip install /tmp/package/templateflow*.whl - INSTALLED_VERSION=$(python -c 'import templateflow as tf; print(tf.__version__, end="")') - echo "INSTALLED: \"${INSTALLED_VERSION}\"" - test "${INSTALLED_VERSION}" = "${THISVERSION}" - - - name: Re-install in confined environment [wheel] - env: - TEMPLATEFLOW_HOME: /tmp/home/wheel - run: | - source /tmp/install_wheel/bin/activate - python -m pip install /tmp/package/templateflow*.whl --force-reinstall - find ${TEMPLATEFLOW_HOME} >> /tmp/.wheel-install.txt - - name: Re-install in confined environment [wheel - missing template] - env: - TEMPLATEFLOW_HOME: /tmp/home/wheel - run: | - rm -rf ${TEMPLATEFLOW_HOME}/tpl-MNI152NLin2009cAsym - source /tmp/install_wheel/bin/activate - python -m pip install /tmp/package/templateflow*.whl --force-reinstall - # Wheels do not run post-install hooks: - test ! -d ${TEMPLATEFLOW_HOME}/tpl-MNI152NLin2009cAsym - python -c "import templateflow; templateflow.update(overwrite=False)" - find ${TEMPLATEFLOW_HOME} >> /tmp/.wheel-install-2.txt - diff /tmp/.wheel-install.txt /tmp/.wheel-install-2.txt - exit $? - - - name: Install in confined environment [setup.py - install] - env: - TEMPLATEFLOW_HOME: /tmp/home/setup_install - run: | - python -m venv /tmp/setup_install - source /tmp/setup_install/bin/activate - python -m pip install -U "setuptools >= 45" wheel "setuptools_scm >= 6.2" \ - setuptools_scm_git_archive "${{ matrix.pip }}" - python -m pip install "numpy==1.20" Cython "pandas==1.3" "scipy==1.7" - python setup.py install - INSTALLED_VERSION=$(python -c 'import templateflow as tf; print(tf.__version__, end="")') - echo "INSTALLED: \"${INSTALLED_VERSION}\"" - test "${INSTALLED_VERSION}" = "${THISVERSION}" - - - name: Re-install in confined environment [setup.py - install] - env: - TEMPLATEFLOW_HOME: /tmp/home/setup_install - run: | - source /tmp/setup_install/bin/activate - python setup.py install - find ${TEMPLATEFLOW_HOME} >> /tmp/.setup-install.txt - - name: Re-install in confined environment [setup.py - install - missing template] - env: - TEMPLATEFLOW_HOME: /tmp/home/setup_install - run: | - rm -rf ${TEMPLATEFLOW_HOME}/tpl-MNI152NLin2009cAsym - source /tmp/setup_install/bin/activate - python setup.py install - python -c "import templateflow; templateflow.update(overwrite=False)" - find ${TEMPLATEFLOW_HOME} >> /tmp/.setup-install-2.txt - diff /tmp/.setup-install.txt /tmp/.setup-install-2.txt - exit $? - - - name: Install in confined environment [setup.py - develop] - env: - TEMPLATEFLOW_HOME: /tmp/home/setup_develop + - name: Re-install run: | - python -m venv /tmp/setup_develop - source /tmp/setup_develop/bin/activate - python -m pip install -U "setuptools >= 45" wheel "setuptools_scm >= 6.2" \ - setuptools_scm_git_archive "${{ matrix.pip }}" - python -m pip install "numpy==1.20" Cython "pandas==1.3" "scipy==1.7" - python setup.py develop - INSTALLED_VERSION=$(python -c 'import templateflow as tf; print(tf.__version__, end="")') - echo "INSTALLED: \"${INSTALLED_VERSION}\"" - test "${INSTALLED_VERSION}" = "${THISVERSION}" - - - name: Re-install in confined environment [setup.py - develop] - env: - TEMPLATEFLOW_HOME: /tmp/home/setup_develop - run: | - source /tmp/setup_develop/bin/activate - python setup.py develop - find ${TEMPLATEFLOW_HOME} >> /tmp/.setup-develop.txt - - - name: Re-install in confined environment [setup.py - develop - missing template] - env: - TEMPLATEFLOW_HOME: /tmp/home/setup_develop + pip install $TARGET --force-reinstall + find ${TEMPLATEFLOW_HOME} >> /tmp/.install.txt + - name: Re-install [missing template] run: | rm -rf ${TEMPLATEFLOW_HOME}/tpl-MNI152NLin2009cAsym - source /tmp/setup_develop/bin/activate - python setup.py develop + pip install $TARGET --force-reinstall python -c "import templateflow; templateflow.update(overwrite=False)" - find ${TEMPLATEFLOW_HOME} >> /tmp/.setup-develop-2.txt - diff /tmp/.setup-develop.txt /tmp/.setup-develop-2.txt + find ${TEMPLATEFLOW_HOME} >> /tmp/.install-2.txt + diff /tmp/.install.txt /tmp/.install-2.txt exit $? diff --git a/CHANGES.rst b/CHANGES.rst index 64e4d3b1..b3c7f57e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,15 @@ +23.0.0 (February 2, 2023) +========================= +Minor release including additional API features and an updated skeleton. + +* FIX: Preempt ``BIDSLayout`` from indexing dot-folders (#99) +* ENH: Make sure existing ``layout.get_*`` are not bubbled in (#102) +* ENH: Allow access to PyBIDS' magic ``get_*`` (#101) +* ENH: Add an ``api.ls()`` function to list (without getting) files (#97) +* MAINT: Discontinue legacy docker runners of CircleCI (#104) +* MAINT: Rotate CircleCI secrets and setup up org-level context (#103) +* MAINT: Fix docs build environment in CircleCI (#96) + 0.8.1 (May 7, 2022) =================== Patch release updating the S3 skeleton to include the fixed version of ``tpl-MouseIn``. diff --git a/docs/environment.yml b/docs/environment.yml index 1e7db025..b9fc3f65 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -152,8 +152,6 @@ dependencies: - requests=2.27.1=pyhd8ed1ab_0 - scipy=1.8.0=py39hee8e79c_1 - setuptools=62.1.0=py39hf3d152e_0 - - setuptools-scm=6.4.2=pyhd8ed1ab_0 - - setuptools_scm=6.4.2=hd8ed1ab_0 - six=1.16.0=pyh6c4a22f_0 - snowballstemmer=2.2.0=pyhd8ed1ab_0 - soupsieve=2.3.1=pyhd8ed1ab_0 @@ -202,6 +200,8 @@ dependencies: - docopt==0.6.2 - formulaic==0.3.4 - nibabel==3.2.2 + - nipreps-versions==1.0.3 - pandas==1.4.2 - pybids==0.15.2 + - setuptools_scm==7.1.0 - sqlalchemy==1.3.24 diff --git a/pyproject.toml b/pyproject.toml index c089da82..38860932 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ requires = [ "setuptools >= 45", "setuptools_scm >= 6.2", - "wheel" + "nipreps-versions", ] build-backend = "setuptools.build_meta" @@ -13,3 +13,4 @@ write_to_template = """\ __version__ = "{version}" """ fallback_version = "0.0" +version_scheme = "nipreps-calver" diff --git a/update_changes.sh b/update_changes.sh index aff00727..b5e2bf2c 100644 --- a/update_changes.sh +++ b/update_changes.sh @@ -19,8 +19,28 @@ if [[ "$UPCOMING" == "0" ]]; then head -n3 CHANGES.rst >> newchanges fi +# Elaborate today's release header +HEADER="$1 ($(date '+%B %d, %Y'))" +echo $HEADER >> newchanges +echo $( printf "%${#HEADER}s" | tr " " "=" ) >> newchanges +echo "" >> newchanges + # Search for PRs since previous release -git show --pretty='format: * %b %s' HEAD | sed 's/Merge pull request \#\([^\d]*\)\ from\ .*/(\#\1)/' >> newchanges +MERGE_COMMITS=$( git log --grep="Merge pull request\|(#.*)$" `git describe --tags --abbrev=0`..HEAD --pretty='format:%h' ) +for COMMIT in ${MERGE_COMMITS//\n}; do + SUB=$( git log -n 1 --pretty="format:%s" $COMMIT ) + if ( echo $SUB | grep "^Merge pull request" ); then + # Merge commit + PR=$( echo $SUB | sed -e "s/Merge pull request \#\([0-9]*\).*/\1/" ) + TITLE=$( git log -n 1 --pretty="format:%b" $COMMIT ) + else + # Squashed merge + PR=$( echo $SUB | sed -e "s/.*(\#\([0-9]*\))$/\1/" ) + TITLE=$( echo $SUB | sed -e "s/\(.*\) (\#[0-9]*)$/\1/" ) + fi + echo "* $TITLE (#$PR)" >> newchanges +done +echo >> newchanges # Add back the Upcoming header if it was present if [[ "$UPCOMING" == "0" ]]; then @@ -31,4 +51,3 @@ fi # Replace old CHANGES.rst with new file mv newchanges CHANGES.rst -