Skip to content

Commit 2934fd3

Browse files
committed
added fileformats packages to template resources
1 parent 317b43b commit 2934fd3

File tree

12 files changed

+346
-17
lines changed

12 files changed

+346
-17
lines changed

nipype2pydra/pkg_gen/__init__.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,9 +641,33 @@ def copy_ignore(_, names):
641641
gh_workflows_dir / "ci-cd.yaml",
642642
)
643643

644+
related_pkgs_dir = pkg_dir / "related-packages"
645+
shutil.copytree(TEMPLATES_DIR / "related-packages", related_pkgs_dir)
646+
644647
# Add modified README
645648
os.unlink(pkg_dir / "README.md")
646-
shutil.copy(TEMPLATES_DIR / "README.rst", pkg_dir / "README.rst")
649+
with open(TEMPLATES_DIR / "README.rst") as f:
650+
readme_rst = f.read()
651+
readme_rst = readme_rst.replace("=" * 31, "=" * (23 + len(pkg)))
652+
with open(pkg_dir / "README.rst", "w") as f:
653+
f.write(readme_rst)
654+
655+
fileformat_readme_path = related_pkgs_dir / "fileformats" / "README.rst"
656+
with open(fileformat_readme_path) as f:
657+
ff_readme_rst = f.read()
658+
ff_readme_rst = ff_readme_rst.replace("=" * 29, "=" * (27 + len(pkg)))
659+
with open(fileformat_readme_path, "w") as f:
660+
f.write(ff_readme_rst)
661+
662+
fileformat_extras_readme_path = (
663+
related_pkgs_dir / "fileformats-extras" / "README.rst"
664+
)
665+
with open(fileformat_extras_readme_path) as f:
666+
ffe_readme_rst = f.read()
667+
ffe_readme_rst = ffe_readme_rst.replace("=" * 36, "=" * (34 + len(pkg)))
668+
with open(fileformat_extras_readme_path, "w") as f:
669+
f.write(ffe_readme_rst)
670+
647671
with open(pkg_dir / "pyproject.toml") as f:
648672
pyproject_toml = f.read()
649673
pyproject_toml = pyproject_toml.replace("README.md", "README.rst")

nipype2pydra/pkg_gen/resources/templates/README.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,22 @@ Contributing to this package
7171
Developer installation
7272
~~~~~~~~~~~~~~~~~~~~~~
7373

74+
Install the `fileformats <https://arcanaframework.github.io/fileformats/>`__ packages
75+
corresponding to AFNI specific file formats
76+
77+
78+
.. code-block::
79+
80+
$ pip install -e ./related-packages/fileformats[dev]
81+
$ pip install -e ./related-packages/fileformats-extras[dev]
7482
7583
Install repo in developer mode from the source directory and install pre-commit to
7684
ensure consistent code-style and quality.
7785

7886
.. code-block::
7987
8088
$ pip install -e .[test,dev]
81-
$ pre-commit install
89+
$ pre-commit install
8290
8391
Next install the requirements for running the auto-conversion script and generate the
8492
Pydra task interfaces from their Nipype counterparts
@@ -93,7 +101,8 @@ The run the conversion script to convert Nipype interfaces to Pydra
93101
94102
$ nipype-auto-conv/generate
95103
96-
## Methodology
104+
Methodology
105+
~~~~~~~~~~~
97106

98107
The development of this package is expected to have two phases
99108

nipype2pydra/pkg_gen/resources/templates/gh_workflows/ci-cd.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2525
- name: Revert version to most recent tag on upstream update
2626
if: github.event_name == 'repository_dispatch'
2727
run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}')
2828
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v4
29+
uses: actions/setup-python@v5
3030
- name: Install build dependencies
3131
run: python -m pip install --upgrade pip
3232
- name: Install requirements
@@ -50,7 +50,7 @@ jobs:
5050
- '--editable git+https://github.com/nipype/pydra.git#egg=pydra'
5151
steps:
5252
- name: Checkout
53-
uses: actions/checkout@v3
53+
uses: actions/checkout@v4
5454
- name: Revert version to most recent tag on upstream update
5555
if: github.event_name == 'repository_dispatch'
5656
run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}')
@@ -63,7 +63,7 @@ jobs:
6363
run: |
6464
sed -i '/\/pydra\/tasks\/CHANGEME\/auto/d' .gitignore
6565
- name: Set up Python ${{ matrix.python-version }}
66-
uses: actions/setup-python@v4
66+
uses: actions/setup-python@v5
6767
with:
6868
python-version: ${{ matrix.python-version }}
6969
- name: Install build dependencies
@@ -90,12 +90,12 @@ jobs:
9090
matrix:
9191
python-version: ['3.8', '3.11']
9292
steps:
93-
- uses: actions/checkout@v3
93+
- uses: actions/checkout@v4
9494
- name: Revert version to most recent tag on upstream update
9595
if: github.event_name == 'repository_dispatch'
9696
run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}')
9797
- name: Set up Python ${{ matrix.python-version }}
98-
uses: actions/setup-python@v4
98+
uses: actions/setup-python@v5
9999
with:
100100
python-version: ${{ matrix.python-version }}
101101
- name: Install build dependencies
@@ -149,7 +149,7 @@ jobs:
149149
source $FREESURFER_HOME/SetUpFreeSurfer.sh
150150
echo $FREESURFER_LICENCE > $FREESURFER_HOME/license.txt
151151
export PATH=$FREESURFER_HOME/bin:$PATH
152-
- uses: actions/checkout@v3
152+
- uses: actions/checkout@v4
153153
- name: Revert version to most recent tag on upstream update
154154
if: github.event_name == 'repository_dispatch'
155155
run: git checkout $(git tag -l | tail -n 1 | awk -F post '{print $1}')
@@ -162,7 +162,7 @@ jobs:
162162
run: |
163163
sed -i '/\/src\/pydra\/tasks\/CHANGEME\/auto/d' .gitignore
164164
- name: Set up Python ${{ matrix.python-version }}
165-
uses: actions/setup-python@v4
165+
uses: actions/setup-python@v5
166166
with:
167167
python-version: ${{ matrix.python-version }}
168168
- name: Install build dependencies
@@ -187,12 +187,12 @@ jobs:
187187
needs: [devcheck, test]
188188
runs-on: ubuntu-latest
189189
steps:
190-
- uses: actions/checkout@v3
190+
- uses: actions/checkout@v4
191191
with:
192192
submodules: recursive
193193
fetch-depth: 0
194194
- name: Set up Python
195-
uses: actions/setup-python@v4
195+
uses: actions/setup-python@v5
196196
with:
197197
python-version: '3.11'
198198
- name: Install build tools
@@ -219,12 +219,12 @@ jobs:
219219
needs: [deploy-fileformats]
220220
runs-on: ubuntu-latest
221221
steps:
222-
- uses: actions/checkout@v3
222+
- uses: actions/checkout@v4
223223
with:
224224
submodules: recursive
225225
fetch-depth: 0
226226
- name: Set up Python
227-
uses: actions/setup-python@v4
227+
uses: actions/setup-python@v5
228228
with:
229229
python-version: '3.11'
230230
- name: Install build tools
@@ -251,7 +251,7 @@ jobs:
251251
needs: [deploy-fileformats-extras]
252252
runs-on: ubuntu-latest
253253
steps:
254-
- uses: actions/checkout@v3
254+
- uses: actions/checkout@v4
255255
with:
256256
submodules: recursive
257257
fetch-depth: 0
@@ -270,7 +270,7 @@ jobs:
270270
git commit -am"added auto-generated version to make new tag for package version"
271271
git tag ${TAG}post${POST}
272272
- name: Set up Python
273-
uses: actions/setup-python@v4
273+
uses: actions/setup-python@v5
274274
with:
275275
python-version: '3.11'
276276
- name: Install build tools
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import os
2+
import logging
3+
from pathlib import Path
4+
import tempfile
5+
import pytest
6+
7+
# Set DEBUG logging for unittests
8+
9+
log_level = logging.WARNING
10+
11+
logger = logging.getLogger("fileformats")
12+
logger.setLevel(log_level)
13+
14+
sch = logging.StreamHandler()
15+
sch.setLevel(log_level)
16+
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
17+
sch.setFormatter(formatter)
18+
logger.addHandler(sch)
19+
20+
21+
# For debugging in IDE's don't catch raised exceptions and let the IDE
22+
# break at it
23+
if os.getenv("_PYTEST_RAISE", "0") != "0":
24+
25+
@pytest.hookimpl(tryfirst=True)
26+
def pytest_exception_interact(call):
27+
raise call.excinfo.value
28+
29+
@pytest.hookimpl(tryfirst=True)
30+
def pytest_internalerror(excinfo):
31+
raise excinfo.value
32+
33+
34+
@pytest.fixture
35+
def work_dir():
36+
work_dir = tempfile.mkdtemp()
37+
return Path(work_dir)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2021 Nipype developers
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FileFormats-medimage-CHANGEME Extras
2+
====================================
3+
4+
.. image:: https://github.com/nipype/pydra-freesurfer/actions/workflows/ci-cd.yaml/badge.svg
5+
:target: https://github.com/nipype/pydra-freesurfer/actions/workflows/ci-cd.yaml
6+
7+
8+
This is a extras module for the `fileformats-medimage-CHANGEME <https://github.com/nipype/pydra-CHANGEME/>`__
9+
fileformats extension package, which provides additional functionality to format classes (i.e. aside
10+
from basic identification and validation), such as conversion tools, metadata parsers,
11+
sample data generators, etc...
12+
13+
14+
Quick Installation
15+
------------------
16+
17+
This extension can be installed for Python 3 using *pip*::
18+
19+
$ pip3 install fileformats-medimage-CHANGEME-extras
20+
21+
This will install the package, base packages, and any other dependencies required to
22+
implement the extra functionality.
23+
24+
License
25+
-------
26+
27+
This work is licensed under a
28+
`Creative Commons Attribution 4.0 International License <http://creativecommons.org/licenses/by/4.0/>`_
29+
30+
.. image:: https://i.creativecommons.org/l/by/4.0/88x31.png
31+
:target: http://creativecommons.org/licenses/by/4.0/
32+
:alt: Creative Commons Attribution 4.0 International License
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from ._version import __version__
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
[build-system]
2+
requires = ["hatchling", "hatch-vcs"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "fileformats-medimage-CHANGEME-extras"
7+
description = "Extensions to add functionality to tool-specific *fileformats* classes"
8+
readme = "README.rst"
9+
requires-python = ">=3.8"
10+
dependencies = [
11+
"fileformats",
12+
"fileformats-medimage-CHANGEME",
13+
"pydra >= 0.23.0a"
14+
]
15+
license = {file = "LICENSE"}
16+
authors = [
17+
{name = "Thomas G. Close", email = "[email protected]"},
18+
]
19+
maintainers = [
20+
{name = "Thomas G. Close", email = "[email protected]"},
21+
]
22+
keywords = [
23+
"file formats",
24+
"data",
25+
]
26+
classifiers = [
27+
"Development Status :: 3 - Alpha",
28+
"Environment :: Console",
29+
"Intended Audience :: Science/Research",
30+
"License :: OSI Approved :: Apache Software License",
31+
"Operating System :: MacOS :: MacOS X",
32+
"Operating System :: Microsoft :: Windows",
33+
"Operating System :: POSIX :: Linux",
34+
"Programming Language :: Python :: 3.8",
35+
"Programming Language :: Python :: 3.9",
36+
"Programming Language :: Python :: 3.10",
37+
"Programming Language :: Python :: 3.11",
38+
"Topic :: Scientific/Engineering",
39+
]
40+
dynamic = ["version"]
41+
42+
[project.optional-dependencies]
43+
dev = [
44+
"black",
45+
"pre-commit",
46+
"codespell",
47+
"flake8",
48+
"flake8-pyproject",
49+
]
50+
test = [
51+
"pytest >=6.2.5",
52+
"pytest-env>=0.6.2",
53+
"pytest-cov>=2.12.1",
54+
"codecov",
55+
]
56+
57+
converters = [
58+
]
59+
60+
[project.urls]
61+
repository = "https://github.com/nipype/pydra-CHANGEME"
62+
63+
[tool.hatch.version]
64+
source = "vcs"
65+
raw-options = { root = "../.." }
66+
67+
[tool.hatch.build.hooks.vcs]
68+
version-file = "fileformats/extras/medimage_CHANGEME/_version.py"
69+
70+
[tool.hatch.build.targets.wheel]
71+
packages = ["fileformats"]
72+
73+
[tool.black]
74+
target-version = ['py38']
75+
exclude = "fileformats/extras/medimage_CHANGEME/_version.py"
76+
77+
[tool.codespell]
78+
ignore-words = ".codespell-ignorewords"
79+
80+
[tool.flake8]
81+
doctests = true
82+
per-file-ignores = [
83+
"__init__.py:F401"
84+
]
85+
max-line-length = 88
86+
select = "C,E,F,W,B,B950"
87+
extend-ignore = ['E203', 'E501', 'E129']
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2021 Nipype developers
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

0 commit comments

Comments
 (0)