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

📜✨[Experiment] Poetry #2039

Draft
wants to merge 13 commits into
base: develop
Choose a base branch
from
Draft
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
21 changes: 13 additions & 8 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,27 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-python@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
cache: poetry
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y graphviz graphviz-dev
- name: Install dependencies
run: |
poetry install
- name: Check if version updated
id: version_updated
run: |
git config --global user.email "[email protected]"
git config --global user.name "Theodore (Machine User)"
GITHUB_BRANCH=$(echo ${GITHUB_REF} | cut -d '/' -f 3-)
export PYTHONPATH=$PWD
pip install -q wheel
pip install -q nipype numpy matplotlib pandas pathvalidate pytz pyyaml voluptuous
python ./CPAC/utils/configuration/yaml_template.py
poetry run cpac-dev-update-preconfigs
if [[ ! -z $(git diff origin/${GITHUB_BRANCH}) ]]
then
git add CPAC/resources/configs
Expand All @@ -58,11 +65,9 @@ jobs:
if [[ ! "$COMMIT_MESSAGE" == *"Update version to"* ]]
then
cd CPAC
VERSION=$(python -c "from info import __version__; print(('.'.join(('.'.join(__version__[::-1].split('-')[1].split('.')[1:])[::-1], __version__.split('-')[1])) if '-' in __version__ else __version__).split('+', 1)[0])")
VERSION=$(poetry run cpac-dev-print-version)
cd ..
echo "v${VERSION}" > version
find ./CPAC/resources/configs -name "*.yml" -exec sed -i -r "s/^(# [Vv]ersion ).*$/# Version ${VERSION}/g" {} \;
git add version
VERSIONS=($(git diff origin/${GITHUB_BRANCH} -- version | tail -n 2))
export PATTERN="(declare|typeset) -a"
if [[ "$(declare -p VERSIONS)" =~ $PATTERN ]]
Expand Down
176 changes: 7 additions & 169 deletions CPAC/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,181 +32,19 @@
# Modifications Copyright (C) 2022-2023 C-PAC Developers

# This file is part of C-PAC.
"""This file contains defines parameters for CPAC that we use to fill
settings in setup.py, the CPAC top-level docstring, and for building the
docs. In setup.py in particular, we exec this file, so it cannot import CPAC.
This script was borrowed from and inspired by nipype's info.py file
(https://github.com/nipy/nipype/blob/08391871/nipype/info.py)."""
# CPAC version information. An empty _version_extra corresponds to a
# full release. 'dev' as a _version_extra string means this is a development
# version
_version_major = 1
_version_minor = 8
_version_micro = 6
_version_extra = 'dev'


def get_cpac_gitversion():
"""CPAC version as reported by the last commit in git

Returns
-------
None or str

Version of C-PAC according to git.
"""
import os
import subprocess

gitpath = os.path.realpath(os.path.join(os.path.dirname(__file__),
os.path.pardir))

gitpathgit = os.path.join(gitpath, '.git')
if not os.path.exists(gitpathgit):
return None

ver = None

try:
o, _ = subprocess.Popen('git describe --always', shell=True,
cwd=gitpath, stdout=subprocess.PIPE
).communicate()
except Exception:
pass
else:
ver = o.decode().strip().split('-')[-1]

return ver


if 'dev' in _version_extra:
gitversion = get_cpac_gitversion()
if gitversion:
_version_extra = f'dev1+{gitversion}'


__version__ = "%s.%s.%s" % (_version_major,
_version_minor,
_version_micro)

if _version_extra:
__version__ += ".%s" % _version_extra
import importlib.metadata

ga_tracker = 'UA-19224662-10'

CLASSIFIERS = ["Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Scientific/Engineering"]

# pylint: disable=invalid-name
description = 'Configurable Pipeline for the Analysis of Connectomes'

# Note: this long_description is actually a copy/paste from the top-level
# README.md, so that it shows up nicely on PyPI. So please remember to edit
# it only in one place and sync it correctly.
# pylint: disable=invalid-name
long_description = """
============================================================
C-PAC: Configurable Pipeline for the Analysis of Connectomes
============================================================
# Below are legacy reconstructions of previously dynamically defined metadata
# that are now defined in pyproject.toml.
# These are kept for backwards compatibility.

A configurable, open-source, Nipype-based, automated processing pipeline for
resting state fMRI data.
Designed for use by both novice users and experts, C-PAC brings the power,
flexibility and elegance of Nipype to users in a plug-and-play fashion; no
programming required.

Website
-------

CPAC website is located here: https://fcp-indi.github.io/


Documentation
-------------

User documentation can be found here: https://fcp-indi.github.io/docs/user

Developer documention can be found here: https://fcp-indi.github.io/docs/developer

Documentation pertaining to this latest release can be found here: https://fcp-indi.github.io/docs/latest


Dicussion Forum
---------------

CPAC Discussion forum is located here: https://neurostars.org/tag/cpac

Troubleshooting and Help
------------------------

This is a beta version of CPAC, which means that it is still under active
development. As such, although we have done our best to ensure a stable
pipeline, there will likely still be a few bugs that we did not catch. If you
find a bug, have a question that is not answered in the User Guide, or would
like to suggest a new feature, please create an issue on CPAC github issue
page: https://github.com/FCP-INDI/C-PAC/issues?state=open
""" # noqa: E501
CYTHON_MIN_VERSION = '0.12.1'
NAME = 'CPAC'
MAINTAINER = "C-PAC developers"
MAINTAINER_EMAIL = "[email protected]"
DESCRIPTION = description
LONG_DESCRIPTION = long_description
URL = "https://fcp-indi.github.io"
DOWNLOAD_URL = "https://github.com/FCP-INDI/C-PAC"
LICENSE = "LGPL-3.0-or-later"
AUTHOR = "C-PAC developers"
AUTHOR_EMAIL = "[email protected]"
PLATFORMS = "OS Independent"
MAJOR = _version_major
MINOR = _version_minor
MICRO = _version_micro
ISRELEASE = _version_extra == ''
VERSION = __version__
STATUS = 'stable'
REQUIREMENTS = [
"boto3",
"ciftify",
"click",
"click-aliases",
"configparser",
"cython",
"flowdump==0.1.2",
"future",
"INDI-Tools @ git+https://[email protected]/FCP-INDI/INDI-Tools.git#egg=INDI-Tools",
"lockfile",
"joblib",
"matplotlib",
"networkx",
"nibabel",
"nilearn",
"nipype",
"nose",
"numpy",
"pandas",
"pathvalidate",
"patsy",
"prov",
"psutil",
"PyBASC",
"pybids",
"pygraphviz",
"PyPEER @ git+https://[email protected]/ChildMindInstitute/PyPEER.git@6965d2b2bea0fef824e885fec33a8e0e6bd50a97#egg=PyPEER",
"python-dateutil",
"pyyaml",
"scikit-learn",
"scipy",
"sdcflows",
"semver",
"traits",
"voluptuous>=0.12.0",
"xvfbwrapper"
]
__version__ = importlib.metadata.version('CPAC')
REQUIREMENTS = importlib.metadata.requires('CPAC')
UNET_REQUIREMENTS = [
"torch==1.13.1",
"torchvision==0.14.1"
"torchvision==0.14.1",
]
8 changes: 8 additions & 0 deletions CPAC/utils/print_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Print C-PAC version for CI."""

import importlib.metadata


def print_cpac_version():
"""Print the version of CPAC"""
print(importlib.metadata.version('CPAC'))
40 changes: 40 additions & 0 deletions docs/description.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
============================================================
C-PAC: Configurable Pipeline for the Analysis of Connectomes
============================================================

A configurable, open-source, Nipype-based, automated processing pipeline for
resting state fMRI data.
Designed for use by both novice users and experts, C-PAC brings the power,
flexibility and elegance of Nipype to users in a plug-and-play fashion; no
programming required.

Website
-------

CPAC website is located here: https://fcp-indi.github.io/


Documentation
-------------

User documentation can be found here: https://fcp-indi.github.io/docs/user

Developer documention can be found here: https://fcp-indi.github.io/docs/developer

Documentation pertaining to this latest release can be found here: https://fcp-indi.github.io/docs/latest


Dicussion Forum
---------------

CPAC Discussion forum is located here: https://neurostars.org/tag/cpac

Troubleshooting and Help
------------------------

This is a beta version of CPAC, which means that it is still under active
development. As such, although we have done our best to ensure a stable
pipeline, there will likely still be a few bugs that we did not catch. If you
find a bug, have a question that is not answered in the User Guide, or would
like to suggest a new feature, please create an issue on CPAC github issue
page: https://github.com/FCP-INDI/C-PAC/issues?state=open
Loading
Loading