From 510bec6e5e225b99645b49ccc8a58b179ecc1a94 Mon Sep 17 00:00:00 2001 From: Tom Close Date: Sat, 16 Mar 2024 14:40:54 +1100 Subject: [PATCH 1/9] moved fileformats sub-packages into separate sub-directories --- README.md | 8 +- fileformats/medimage-CHANGEME/conftest.py | 37 ++++++++ .../fileformats/medimage_CHANGEME/__init__.py | 1 + fileformats/medimage-CHANGEME/pyproject.toml | 84 ++++++++++++++++++ .../medimage-CHANGME-extras/conftest.py | 37 ++++++++ .../extras/medimage_CHANGEME/__init__.py | 1 + .../medimage-CHANGME-extras/pyproject.toml | 87 +++++++++++++++++++ pyproject.toml | 11 ++- .../pydra}/tasks/CHANGEME/__init__.py | 0 {pydra => src/pydra}/tasks/CHANGEME/latest.py | 0 .../pydra}/tasks/CHANGEME/v1/__init__.py | 0 11 files changed, 258 insertions(+), 8 deletions(-) create mode 100644 fileformats/medimage-CHANGEME/conftest.py create mode 100644 fileformats/medimage-CHANGEME/fileformats/medimage_CHANGEME/__init__.py create mode 100644 fileformats/medimage-CHANGEME/pyproject.toml create mode 100644 fileformats/medimage-CHANGME-extras/conftest.py create mode 100644 fileformats/medimage-CHANGME-extras/fileformats/extras/medimage_CHANGEME/__init__.py create mode 100644 fileformats/medimage-CHANGME-extras/pyproject.toml rename {pydra => src/pydra}/tasks/CHANGEME/__init__.py (100%) rename {pydra => src/pydra}/tasks/CHANGEME/latest.py (100%) rename {pydra => src/pydra}/tasks/CHANGEME/v1/__init__.py (100%) diff --git a/README.md b/README.md index 3166e8a..ecc6dba 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,13 @@ All tasks will be inserted into the `pydra.tasks.` namespac 1. One of the folders is called CHANGEME. This should also be renamed to your package name. 1. Under the newly renamed package (i.e. formerly CHANGEME) there is a directory named "v1", - `pydra/tasks//v1`, change this to valid Python package name starting with + `src/pydra/tasks//v1`, change this to valid Python package name starting with 'v' to indicate the version of the tool the Pydra interfaces will be designed for, - e.g. FSL v6.0.2 could be `pydra/tasks/fsl/v6` or `pydra/tasks/fsl/v6_0` depending on + e.g. FSL v6.0.2 could be `src/pydra/tasks/fsl/v6` or `src/pydra/tasks/fsl/v6_0` depending on how stable the CLI of the tool is between minor versions. -1. Edit `pydra/tasks//latest.py` to update references to `v1` to the +1. Edit `src/pydra/tasks//latest.py` to update references to `v1` to the tool target version -1. Add tasks to the `pydra/tasks//v` folder. +1. Add tasks to the `src/pydra/tasks//v` folder. 1. You may want to initialize a [Sphinx] docs directory. 1. Review the workflow in `.github/workflows/pythonpackage.yml`. Testing editable installations is probably not useful unless you are reconfiguring namespace packages. diff --git a/fileformats/medimage-CHANGEME/conftest.py b/fileformats/medimage-CHANGEME/conftest.py new file mode 100644 index 0000000..2a703c0 --- /dev/null +++ b/fileformats/medimage-CHANGEME/conftest.py @@ -0,0 +1,37 @@ +import os +import logging +from pathlib import Path +import tempfile +import pytest + +# Set DEBUG logging for unittests + +log_level = logging.WARNING + +logger = logging.getLogger("fileformats") +logger.setLevel(log_level) + +sch = logging.StreamHandler() +sch.setLevel(log_level) +formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") +sch.setFormatter(formatter) +logger.addHandler(sch) + + +# For debugging in IDE's don't catch raised exceptions and let the IDE +# break at it +if os.getenv("_PYTEST_RAISE", "0") != "0": + + @pytest.hookimpl(tryfirst=True) + def pytest_exception_interact(call): + raise call.excinfo.value + + @pytest.hookimpl(tryfirst=True) + def pytest_internalerror(excinfo): + raise excinfo.value + + +@pytest.fixture +def work_dir(): + work_dir = tempfile.mkdtemp() + return Path(work_dir) diff --git a/fileformats/medimage-CHANGEME/fileformats/medimage_CHANGEME/__init__.py b/fileformats/medimage-CHANGEME/fileformats/medimage_CHANGEME/__init__.py new file mode 100644 index 0000000..8dee4bf --- /dev/null +++ b/fileformats/medimage-CHANGEME/fileformats/medimage_CHANGEME/__init__.py @@ -0,0 +1 @@ +from ._version import __version__ diff --git a/fileformats/medimage-CHANGEME/pyproject.toml b/fileformats/medimage-CHANGEME/pyproject.toml new file mode 100644 index 0000000..734fa88 --- /dev/null +++ b/fileformats/medimage-CHANGEME/pyproject.toml @@ -0,0 +1,84 @@ +[build-system] +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[project] +name = "fileformats-medimage-CHANGEME" +description = "Classes for representing different file formats in Python classes for use in type hinting in data workflows" +readme = "../README.rst" +requires-python = ">=3.8" +dependencies = [ + "fileformats >= 0.4", + "fileformats-medimage > = 0.2" +] +license = {file = "../LICENSE"} +authors = [ + {name = "Thomas G. Close", email = "tom.g.close@gmail.com"}, +] +maintainers = [ + {name = "Thomas G. Close", email = "tom.g.close@gmail.com"}, +] +keywords = [ + "file formats", + "data", +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Environment :: Console", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: Apache Software License", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering", +] +dynamic = ["version"] + +[project.optional-dependencies] +dev = [ + "black", + "pre-commit", + "codespell", + "flake8", + "flake8-pyproject", +] +test = [ + "pytest >=6.2.5", + "pytest-env>=0.6.2", + "pytest-cov>=2.12.1", + "codecov", + "fileformats-medimage-CHANGME", +] + +[project.urls] +repository = "https://github.com/nipype/pydra-freesurfer" + +[tool.hatch.version] +source = "vcs" +raw-options = { root = ".." } + +[tool.hatch.build.hooks.vcs] +version-file = "fileformats/medimage_freesurfer/_version.py" + +[tool.hatch.build.targets.wheel] +packages = ["fileformats"] + +[tool.black] +target-version = ['py38'] +exclude = "fileformats/medimage_freesurfer/_version.py" + +[tool.codespell] +ignore-words = ".codespell-ignorewords" + +[tool.flake8] +doctests = true +per-file-ignores = [ + "__init__.py:F401" +] +max-line-length = 88 +select = "C,E,F,W,B,B950" +extend-ignore = ['E203', 'E501', 'E129'] diff --git a/fileformats/medimage-CHANGME-extras/conftest.py b/fileformats/medimage-CHANGME-extras/conftest.py new file mode 100644 index 0000000..2a703c0 --- /dev/null +++ b/fileformats/medimage-CHANGME-extras/conftest.py @@ -0,0 +1,37 @@ +import os +import logging +from pathlib import Path +import tempfile +import pytest + +# Set DEBUG logging for unittests + +log_level = logging.WARNING + +logger = logging.getLogger("fileformats") +logger.setLevel(log_level) + +sch = logging.StreamHandler() +sch.setLevel(log_level) +formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") +sch.setFormatter(formatter) +logger.addHandler(sch) + + +# For debugging in IDE's don't catch raised exceptions and let the IDE +# break at it +if os.getenv("_PYTEST_RAISE", "0") != "0": + + @pytest.hookimpl(tryfirst=True) + def pytest_exception_interact(call): + raise call.excinfo.value + + @pytest.hookimpl(tryfirst=True) + def pytest_internalerror(excinfo): + raise excinfo.value + + +@pytest.fixture +def work_dir(): + work_dir = tempfile.mkdtemp() + return Path(work_dir) diff --git a/fileformats/medimage-CHANGME-extras/fileformats/extras/medimage_CHANGEME/__init__.py b/fileformats/medimage-CHANGME-extras/fileformats/extras/medimage_CHANGEME/__init__.py new file mode 100644 index 0000000..8dee4bf --- /dev/null +++ b/fileformats/medimage-CHANGME-extras/fileformats/extras/medimage_CHANGEME/__init__.py @@ -0,0 +1 @@ +from ._version import __version__ diff --git a/fileformats/medimage-CHANGME-extras/pyproject.toml b/fileformats/medimage-CHANGME-extras/pyproject.toml new file mode 100644 index 0000000..808781f --- /dev/null +++ b/fileformats/medimage-CHANGME-extras/pyproject.toml @@ -0,0 +1,87 @@ +[build-system] +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[project] +name = "fileformats-medimage-CHANGEME-extras" +description = "Classes for representing file formats used exclusively by the Freesurfer tool in Python classes for use in type hinting in data workflows" +readme = "../README.rst" +requires-python = ">=3.8" +dependencies = [ + "fileformats >= 0.7", + "fileformats-medimage-freesurfer", + "pydra >= 0.22.0" +] +license = {file = "../LICENSE"} +authors = [ + {name = "Thomas G. Close", email = "tom.g.close@gmail.com"}, +] +maintainers = [ + {name = "Thomas G. Close", email = "tom.g.close@gmail.com"}, +] +keywords = [ + "file formats", + "data", +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Environment :: Console", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: Apache Software License", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering", +] +dynamic = ["version"] + +[project.optional-dependencies] +dev = [ + "black", + "pre-commit", + "codespell", + "flake8", + "flake8-pyproject", +] +test = [ + "pytest >=6.2.5", + "pytest-env>=0.6.2", + "pytest-cov>=2.12.1", + "codecov", +] + +converters = [ +] + +[project.urls] +repository = "https://github.com/nipype/pydra-freesurfer" + +[tool.hatch.version] +source = "vcs" +raw-options = { root = ".." } + +[tool.hatch.build.hooks.vcs] +version-file = "fileformats/extras/medimage_freesurfer/_version.py" + +[tool.hatch.build.targets.wheel] +packages = ["fileformats"] + +[tool.black] +target-version = ['py38'] +exclude = "fileformats/extras/medimage_freesurfer/_version.py" + +[tool.codespell] +ignore-words = ".codespell-ignorewords" + +[tool.flake8] +doctests = true +per-file-ignores = [ + "__init__.py:F401" +] +max-line-length = 88 +select = "C,E,F,W,B,B950" +extend-ignore = ['E203', 'E501', 'E129'] diff --git a/pyproject.toml b/pyproject.toml index 31d4625..f9eb32b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["hatchling", "hatch-vcs"] build-backend = "hatchling.build" [project] -name = "pydra-tasks-CHANGEME" +name = "pydra-CHANGEME" description = "Pydra tasks package for CHANGEME" readme = "README.md" requires-python = ">=3.8" @@ -11,7 +11,9 @@ dependencies = [ "pydra >=0.22", "fileformats >=0.8.3", "fileformats-datascience >=0.1", - "fileformats-medimage >=0.4.1"] + "fileformats-medimage >=0.4.1", + "fileformats-medimage-CHANGEME" +] license = {file = "LICENSE"} authors = [{name = "Nipype developers", email = "neuroimaging@python.org"}] maintainers = [{name = "Nipype developers", email = "neuroimaging@python.org"}] @@ -51,17 +53,18 @@ test = [ "fileformats-extras", "fileformats-datascience-extras", "fileformats-medimage-extras", + "fileformats-medimage-CHANGEME-extras" ] [tool.hatch.version] source = "vcs" [tool.hatch.build.hooks.vcs] -version-file = "pydra/tasks/CHANGEME/_version.py" +version-file = "src/pydra/tasks/CHANGEME/_version.py" [tool.hatch.build.targets.wheel] packages = ["pydra"] -include-only = ["pydra/tasks/CHANGEME"] +include-only = ["src/pydra/tasks/CHANGEME"] [tool.black] target-version = ["py38"] diff --git a/pydra/tasks/CHANGEME/__init__.py b/src/pydra/tasks/CHANGEME/__init__.py similarity index 100% rename from pydra/tasks/CHANGEME/__init__.py rename to src/pydra/tasks/CHANGEME/__init__.py diff --git a/pydra/tasks/CHANGEME/latest.py b/src/pydra/tasks/CHANGEME/latest.py similarity index 100% rename from pydra/tasks/CHANGEME/latest.py rename to src/pydra/tasks/CHANGEME/latest.py diff --git a/pydra/tasks/CHANGEME/v1/__init__.py b/src/pydra/tasks/CHANGEME/v1/__init__.py similarity index 100% rename from pydra/tasks/CHANGEME/v1/__init__.py rename to src/pydra/tasks/CHANGEME/v1/__init__.py From e8d9ad53dfe0590eec65f196eef06cab4073af54 Mon Sep 17 00:00:00 2001 From: Tom Close Date: Sat, 16 Mar 2024 14:40:54 +1100 Subject: [PATCH 2/9] updated location of fileformats packages --- README.md | 6 ++++-- .../conftest.py | 0 .../fileformats/extras}/medimage_CHANGEME/__init__.py | 0 .../pyproject.toml | 10 +++++----- fileformats/{medimage-CHANGME-extras => }/conftest.py | 0 .../medimage_CHANGEME/__init__.py | 0 fileformats/{medimage-CHANGEME => }/pyproject.toml | 8 ++++---- 7 files changed, 13 insertions(+), 11 deletions(-) rename {fileformats/medimage-CHANGEME => fileformats-extras}/conftest.py (100%) rename {fileformats/medimage-CHANGEME/fileformats => fileformats-extras/fileformats/extras}/medimage_CHANGEME/__init__.py (100%) rename {fileformats/medimage-CHANGME-extras => fileformats-extras}/pyproject.toml (82%) rename fileformats/{medimage-CHANGME-extras => }/conftest.py (100%) rename fileformats/{medimage-CHANGME-extras/fileformats/extras => fileformats}/medimage_CHANGEME/__init__.py (100%) rename fileformats/{medimage-CHANGEME => }/pyproject.toml (89%) diff --git a/README.md b/README.md index ecc6dba..8eeecc5 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,10 @@ All tasks will be inserted into the `pydra.tasks.` namespac 1. Give your repo a name. 1. Once the repo is created and cloned, search for CHANGEME (`grep -rn CHANGEME . `) and replace with appropriate name. -1. One of the folders is called CHANGEME. This should also be renamed to your package - name. +1. Rename the following folders to replace `CHANGEME` with the name of the package: + * `src/pydra/tasks/CHANGEME` + * `fileformats/fileformats/medimage_CHANGEME` + * `fileformats/fileformats/extras/medimage_CHANGEME` 1. Under the newly renamed package (i.e. formerly CHANGEME) there is a directory named "v1", `src/pydra/tasks//v1`, change this to valid Python package name starting with 'v' to indicate the version of the tool the Pydra interfaces will be designed for, diff --git a/fileformats/medimage-CHANGEME/conftest.py b/fileformats-extras/conftest.py similarity index 100% rename from fileformats/medimage-CHANGEME/conftest.py rename to fileformats-extras/conftest.py diff --git a/fileformats/medimage-CHANGEME/fileformats/medimage_CHANGEME/__init__.py b/fileformats-extras/fileformats/extras/medimage_CHANGEME/__init__.py similarity index 100% rename from fileformats/medimage-CHANGEME/fileformats/medimage_CHANGEME/__init__.py rename to fileformats-extras/fileformats/extras/medimage_CHANGEME/__init__.py diff --git a/fileformats/medimage-CHANGME-extras/pyproject.toml b/fileformats-extras/pyproject.toml similarity index 82% rename from fileformats/medimage-CHANGME-extras/pyproject.toml rename to fileformats-extras/pyproject.toml index 808781f..31f25a5 100644 --- a/fileformats/medimage-CHANGME-extras/pyproject.toml +++ b/fileformats-extras/pyproject.toml @@ -4,12 +4,12 @@ build-backend = "hatchling.build" [project] name = "fileformats-medimage-CHANGEME-extras" -description = "Classes for representing file formats used exclusively by the Freesurfer tool in Python classes for use in type hinting in data workflows" +description = "Extensions to add functionality to tool-specific *fileformats* classes" readme = "../README.rst" requires-python = ">=3.8" dependencies = [ "fileformats >= 0.7", - "fileformats-medimage-freesurfer", + "fileformats-medimage-CHANGEME", "pydra >= 0.22.0" ] license = {file = "../LICENSE"} @@ -58,21 +58,21 @@ converters = [ ] [project.urls] -repository = "https://github.com/nipype/pydra-freesurfer" +repository = "https://github.com/nipype/pydra-CHANGEME" [tool.hatch.version] source = "vcs" raw-options = { root = ".." } [tool.hatch.build.hooks.vcs] -version-file = "fileformats/extras/medimage_freesurfer/_version.py" +version-file = "fileformats/extras/medimage_CHANGEME/_version.py" [tool.hatch.build.targets.wheel] packages = ["fileformats"] [tool.black] target-version = ['py38'] -exclude = "fileformats/extras/medimage_freesurfer/_version.py" +exclude = "fileformats/extras/medimage_CHANGEME/_version.py" [tool.codespell] ignore-words = ".codespell-ignorewords" diff --git a/fileformats/medimage-CHANGME-extras/conftest.py b/fileformats/conftest.py similarity index 100% rename from fileformats/medimage-CHANGME-extras/conftest.py rename to fileformats/conftest.py diff --git a/fileformats/medimage-CHANGME-extras/fileformats/extras/medimage_CHANGEME/__init__.py b/fileformats/fileformats/medimage_CHANGEME/__init__.py similarity index 100% rename from fileformats/medimage-CHANGME-extras/fileformats/extras/medimage_CHANGEME/__init__.py rename to fileformats/fileformats/medimage_CHANGEME/__init__.py diff --git a/fileformats/medimage-CHANGEME/pyproject.toml b/fileformats/pyproject.toml similarity index 89% rename from fileformats/medimage-CHANGEME/pyproject.toml rename to fileformats/pyproject.toml index 734fa88..c1b8047 100644 --- a/fileformats/medimage-CHANGEME/pyproject.toml +++ b/fileformats/pyproject.toml @@ -51,25 +51,25 @@ test = [ "pytest-env>=0.6.2", "pytest-cov>=2.12.1", "codecov", - "fileformats-medimage-CHANGME", + "fileformats-medimage-CHANGME-extras", ] [project.urls] -repository = "https://github.com/nipype/pydra-freesurfer" +repository = "https://github.com/nipype/pydra-CHANGEME" [tool.hatch.version] source = "vcs" raw-options = { root = ".." } [tool.hatch.build.hooks.vcs] -version-file = "fileformats/medimage_freesurfer/_version.py" +version-file = "fileformats/medimage_CHANGEME/_version.py" [tool.hatch.build.targets.wheel] packages = ["fileformats"] [tool.black] target-version = ['py38'] -exclude = "fileformats/medimage_freesurfer/_version.py" +exclude = "fileformats/medimage_CHANGEME/_version.py" [tool.codespell] ignore-words = ".codespell-ignorewords" From 7db15cd533dc514ae89f457da9820b4936d97cb9 Mon Sep 17 00:00:00 2001 From: Tom Close Date: Sat, 16 Mar 2024 14:40:54 +1100 Subject: [PATCH 3/9] touched up markdown in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8eeecc5..35a8c2c 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ python -m build twine upload dist/* ``` -Note that uploading to PyPI is done via [Continuous integration](#continuous-integration)) when +Note that uploading to PyPI is done via [Continuous integration](#continuous-integration) when a tag is pushed to the repository, so only the first step needs to be donne manually. Note also that we assume tags will be version numbers and not be prefixed with `v` or some other From a6a56a0d3365e7db3c8a1bc2e773799c006a69fb Mon Sep 17 00:00:00 2001 From: Tom Close Date: Sat, 16 Mar 2024 14:40:54 +1100 Subject: [PATCH 4/9] moved fileformats sub-packages inside common subfolder --- fileformats-extras/conftest.py | 37 ------------------ fileformats/extras/LICENSE | 13 +++++++ fileformats/extras/README.rst | 29 ++++++++++++++ .../extras/medimage_CHANGEME/__init__.py | 0 .../extras}/pyproject.toml | 6 +-- fileformats/src/LICENSE | 13 +++++++ fileformats/src/README.rst | 39 +++++++++++++++++++ .../fileformats/medimage_CHANGEME/__init__.py | 0 fileformats/{ => src}/pyproject.toml | 6 +-- .../tasks/CHANGEME/__init__.py | 0 {src/pydra => pydra}/tasks/CHANGEME/latest.py | 0 .../tasks/CHANGEME/v1/__init__.py | 0 pyproject.toml | 4 +- 13 files changed, 102 insertions(+), 45 deletions(-) delete mode 100644 fileformats-extras/conftest.py create mode 100644 fileformats/extras/LICENSE create mode 100644 fileformats/extras/README.rst rename {fileformats-extras => fileformats/extras}/fileformats/extras/medimage_CHANGEME/__init__.py (100%) rename {fileformats-extras => fileformats/extras}/pyproject.toml (95%) create mode 100644 fileformats/src/LICENSE create mode 100644 fileformats/src/README.rst rename fileformats/{ => src}/fileformats/medimage_CHANGEME/__init__.py (100%) rename fileformats/{ => src}/pyproject.toml (95%) rename {src/pydra => pydra}/tasks/CHANGEME/__init__.py (100%) rename {src/pydra => pydra}/tasks/CHANGEME/latest.py (100%) rename {src/pydra => pydra}/tasks/CHANGEME/v1/__init__.py (100%) diff --git a/fileformats-extras/conftest.py b/fileformats-extras/conftest.py deleted file mode 100644 index 2a703c0..0000000 --- a/fileformats-extras/conftest.py +++ /dev/null @@ -1,37 +0,0 @@ -import os -import logging -from pathlib import Path -import tempfile -import pytest - -# Set DEBUG logging for unittests - -log_level = logging.WARNING - -logger = logging.getLogger("fileformats") -logger.setLevel(log_level) - -sch = logging.StreamHandler() -sch.setLevel(log_level) -formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") -sch.setFormatter(formatter) -logger.addHandler(sch) - - -# For debugging in IDE's don't catch raised exceptions and let the IDE -# break at it -if os.getenv("_PYTEST_RAISE", "0") != "0": - - @pytest.hookimpl(tryfirst=True) - def pytest_exception_interact(call): - raise call.excinfo.value - - @pytest.hookimpl(tryfirst=True) - def pytest_internalerror(excinfo): - raise excinfo.value - - -@pytest.fixture -def work_dir(): - work_dir = tempfile.mkdtemp() - return Path(work_dir) diff --git a/fileformats/extras/LICENSE b/fileformats/extras/LICENSE new file mode 100644 index 0000000..e00bcb3 --- /dev/null +++ b/fileformats/extras/LICENSE @@ -0,0 +1,13 @@ + Copyright 2021 Nipype developers + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/fileformats/extras/README.rst b/fileformats/extras/README.rst new file mode 100644 index 0000000..4e12d62 --- /dev/null +++ b/fileformats/extras/README.rst @@ -0,0 +1,29 @@ +FileFormats-CHANGEME Extras +====================================== +.. image:: https://github.com/nipype/pydra-freesurfer/actions/workflows/ci-cd.yaml/badge.svg + :target: https://github.com/nipype/pydra-freesurfer/actions/workflows/ci-cd.yaml + + +This is a extras module for the `fileformats-CHANGEME `__ +fileformats extension package, which provides additional functionality to format classes (i.e. aside +from basic identification and validation), such as conversion tools, metadata parsers, test data generators, etc... + + +Quick Installation +------------------ + +This extension can be installed for Python 3 using *pip*:: + + $ pip3 install fileformats-CHANGEME-extras + +This will install the core package and any other dependencies + +License +------- + +This work is licensed under a +`Creative Commons Attribution 4.0 International License `_ + +.. image:: https://i.creativecommons.org/l/by/4.0/88x31.png + :target: http://creativecommons.org/licenses/by/4.0/ + :alt: Creative Commons Attribution 4.0 International License diff --git a/fileformats-extras/fileformats/extras/medimage_CHANGEME/__init__.py b/fileformats/extras/fileformats/extras/medimage_CHANGEME/__init__.py similarity index 100% rename from fileformats-extras/fileformats/extras/medimage_CHANGEME/__init__.py rename to fileformats/extras/fileformats/extras/medimage_CHANGEME/__init__.py diff --git a/fileformats-extras/pyproject.toml b/fileformats/extras/pyproject.toml similarity index 95% rename from fileformats-extras/pyproject.toml rename to fileformats/extras/pyproject.toml index 31f25a5..20a6559 100644 --- a/fileformats-extras/pyproject.toml +++ b/fileformats/extras/pyproject.toml @@ -5,14 +5,14 @@ build-backend = "hatchling.build" [project] name = "fileformats-medimage-CHANGEME-extras" description = "Extensions to add functionality to tool-specific *fileformats* classes" -readme = "../README.rst" +readme = "README.rst" requires-python = ">=3.8" dependencies = [ "fileformats >= 0.7", "fileformats-medimage-CHANGEME", "pydra >= 0.22.0" ] -license = {file = "../LICENSE"} +license = {file = "LICENSE"} authors = [ {name = "Thomas G. Close", email = "tom.g.close@gmail.com"}, ] @@ -62,7 +62,7 @@ repository = "https://github.com/nipype/pydra-CHANGEME" [tool.hatch.version] source = "vcs" -raw-options = { root = ".." } +raw-options = { root = "../.." } [tool.hatch.build.hooks.vcs] version-file = "fileformats/extras/medimage_CHANGEME/_version.py" diff --git a/fileformats/src/LICENSE b/fileformats/src/LICENSE new file mode 100644 index 0000000..e00bcb3 --- /dev/null +++ b/fileformats/src/LICENSE @@ -0,0 +1,13 @@ + Copyright 2021 Nipype developers + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/fileformats/src/README.rst b/fileformats/src/README.rst new file mode 100644 index 0000000..be65e8f --- /dev/null +++ b/fileformats/src/README.rst @@ -0,0 +1,39 @@ +How to customise this template +============================== + +#. Rename the `fileformats/src/CHANGEME` directory to the name of the fileformats subpackage (e.g. `medimage_fsl`) +#. Search and replace "CHANGEME" with the name of the fileformats subpackage the extras are to be added +#. Replace name + email placeholders in `pyproject.toml` for developers and maintainers +#. Add the extension file-format classes +#. Ensure that all the extension file-format classes are imported into the extras package root, i.e. `fileformats/CHANGEME` +#. Delete these instructions + +... + +FileFormats Extension - CHANGEME +==================================== +.. image:: https://github.com/nipype/pydra-CHANGEME/actions/workflows/ci-cd.yml/badge.svg + :target: https://github.com/nipype/pydra-CHANGEME/actions/workflows/ci-cd.yml + +This is the "CHANGEME" extension module for the +`fileformats `__ package + + +Quick Installation +------------------ + +This extension can be installed for Python 3 using *pip*:: + + $ pip3 install fileformats-CHANGEME + +This will install the core package and any other dependencies + +License +------- + +This work is licensed under a +`Creative Commons Attribution 4.0 International License `_ + +.. image:: https://i.creativecommons.org/l/by/4.0/88x31.png + :target: http://creativecommons.org/licenses/by/4.0/ + :alt: Creative Commons Attribution 4.0 International License diff --git a/fileformats/fileformats/medimage_CHANGEME/__init__.py b/fileformats/src/fileformats/medimage_CHANGEME/__init__.py similarity index 100% rename from fileformats/fileformats/medimage_CHANGEME/__init__.py rename to fileformats/src/fileformats/medimage_CHANGEME/__init__.py diff --git a/fileformats/pyproject.toml b/fileformats/src/pyproject.toml similarity index 95% rename from fileformats/pyproject.toml rename to fileformats/src/pyproject.toml index c1b8047..4f5db09 100644 --- a/fileformats/pyproject.toml +++ b/fileformats/src/pyproject.toml @@ -5,13 +5,13 @@ build-backend = "hatchling.build" [project] name = "fileformats-medimage-CHANGEME" description = "Classes for representing different file formats in Python classes for use in type hinting in data workflows" -readme = "../README.rst" +readme = "README.rst" requires-python = ">=3.8" dependencies = [ "fileformats >= 0.4", "fileformats-medimage > = 0.2" ] -license = {file = "../LICENSE"} +license = {file = "LICENSE"} authors = [ {name = "Thomas G. Close", email = "tom.g.close@gmail.com"}, ] @@ -59,7 +59,7 @@ repository = "https://github.com/nipype/pydra-CHANGEME" [tool.hatch.version] source = "vcs" -raw-options = { root = ".." } +raw-options = { root = "../.." } [tool.hatch.build.hooks.vcs] version-file = "fileformats/medimage_CHANGEME/_version.py" diff --git a/src/pydra/tasks/CHANGEME/__init__.py b/pydra/tasks/CHANGEME/__init__.py similarity index 100% rename from src/pydra/tasks/CHANGEME/__init__.py rename to pydra/tasks/CHANGEME/__init__.py diff --git a/src/pydra/tasks/CHANGEME/latest.py b/pydra/tasks/CHANGEME/latest.py similarity index 100% rename from src/pydra/tasks/CHANGEME/latest.py rename to pydra/tasks/CHANGEME/latest.py diff --git a/src/pydra/tasks/CHANGEME/v1/__init__.py b/pydra/tasks/CHANGEME/v1/__init__.py similarity index 100% rename from src/pydra/tasks/CHANGEME/v1/__init__.py rename to pydra/tasks/CHANGEME/v1/__init__.py diff --git a/pyproject.toml b/pyproject.toml index f9eb32b..a5ea6c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,11 +60,11 @@ test = [ source = "vcs" [tool.hatch.build.hooks.vcs] -version-file = "src/pydra/tasks/CHANGEME/_version.py" +version-file = "pydra/tasks/CHANGEME/_version.py" [tool.hatch.build.targets.wheel] packages = ["pydra"] -include-only = ["src/pydra/tasks/CHANGEME"] +include-only = ["pydra/tasks/CHANGEME"] [tool.black] target-version = ["py38"] From 40fb77d7fd3d3ae2897247b39caafdbecb254853 Mon Sep 17 00:00:00 2001 From: Tom Close Date: Sat, 16 Mar 2024 14:40:54 +1100 Subject: [PATCH 5/9] renamed github action to ci-cd from pythonpackage --- .github/workflows/{pythonpackage.yaml => ci-cd.yaml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{pythonpackage.yaml => ci-cd.yaml} (99%) diff --git a/.github/workflows/pythonpackage.yaml b/.github/workflows/ci-cd.yaml similarity index 99% rename from .github/workflows/pythonpackage.yaml rename to .github/workflows/ci-cd.yaml index 8709e55..2a7da3b 100644 --- a/.github/workflows/pythonpackage.yaml +++ b/.github/workflows/ci-cd.yaml @@ -4,7 +4,7 @@ # For deployment, it will be necessary to create a PyPI API token and store it as a secret # https://docs.github.com/en/actions/reference/encrypted-secrets -name: Python package +name: CI/CD on: push: From 76a7a87d56b07e9563ff0608e7045a0f6f044c8d Mon Sep 17 00:00:00 2001 From: Tom Close Date: Sat, 16 Mar 2024 14:40:54 +1100 Subject: [PATCH 6/9] moved fileformats packages into 'related-packages' to avoid issues when installing pydra-task packages in dev mode --- {fileformats => related-packages}/conftest.py | 0 .../extras => related-packages/fileformats-extras}/LICENSE | 0 .../extras => related-packages/fileformats-extras}/README.rst | 0 .../fileformats/extras/medimage_CHANGEME/__init__.py | 0 .../fileformats-extras}/pyproject.toml | 4 ++-- {fileformats/src => related-packages/fileformats}/LICENSE | 0 {fileformats/src => related-packages/fileformats}/README.rst | 2 +- .../fileformats}/fileformats/medimage_CHANGEME/__init__.py | 0 .../src => related-packages/fileformats}/pyproject.toml | 4 ++-- 9 files changed, 5 insertions(+), 5 deletions(-) rename {fileformats => related-packages}/conftest.py (100%) rename {fileformats/extras => related-packages/fileformats-extras}/LICENSE (100%) rename {fileformats/extras => related-packages/fileformats-extras}/README.rst (100%) rename {fileformats/extras => related-packages/fileformats-extras}/fileformats/extras/medimage_CHANGEME/__init__.py (100%) rename {fileformats/extras => related-packages/fileformats-extras}/pyproject.toml (97%) rename {fileformats/src => related-packages/fileformats}/LICENSE (100%) rename {fileformats/src => related-packages/fileformats}/README.rst (91%) rename {fileformats/src => related-packages/fileformats}/fileformats/medimage_CHANGEME/__init__.py (100%) rename {fileformats/src => related-packages/fileformats}/pyproject.toml (97%) diff --git a/fileformats/conftest.py b/related-packages/conftest.py similarity index 100% rename from fileformats/conftest.py rename to related-packages/conftest.py diff --git a/fileformats/extras/LICENSE b/related-packages/fileformats-extras/LICENSE similarity index 100% rename from fileformats/extras/LICENSE rename to related-packages/fileformats-extras/LICENSE diff --git a/fileformats/extras/README.rst b/related-packages/fileformats-extras/README.rst similarity index 100% rename from fileformats/extras/README.rst rename to related-packages/fileformats-extras/README.rst diff --git a/fileformats/extras/fileformats/extras/medimage_CHANGEME/__init__.py b/related-packages/fileformats-extras/fileformats/extras/medimage_CHANGEME/__init__.py similarity index 100% rename from fileformats/extras/fileformats/extras/medimage_CHANGEME/__init__.py rename to related-packages/fileformats-extras/fileformats/extras/medimage_CHANGEME/__init__.py diff --git a/fileformats/extras/pyproject.toml b/related-packages/fileformats-extras/pyproject.toml similarity index 97% rename from fileformats/extras/pyproject.toml rename to related-packages/fileformats-extras/pyproject.toml index 20a6559..fbb1237 100644 --- a/fileformats/extras/pyproject.toml +++ b/related-packages/fileformats-extras/pyproject.toml @@ -8,9 +8,9 @@ description = "Extensions to add functionality to tool-specific *fileformats* cl readme = "README.rst" requires-python = ">=3.8" dependencies = [ - "fileformats >= 0.7", + "fileformats", "fileformats-medimage-CHANGEME", - "pydra >= 0.22.0" + "pydra >= 0.23.0a" ] license = {file = "LICENSE"} authors = [ diff --git a/fileformats/src/LICENSE b/related-packages/fileformats/LICENSE similarity index 100% rename from fileformats/src/LICENSE rename to related-packages/fileformats/LICENSE diff --git a/fileformats/src/README.rst b/related-packages/fileformats/README.rst similarity index 91% rename from fileformats/src/README.rst rename to related-packages/fileformats/README.rst index be65e8f..8e4c9b2 100644 --- a/fileformats/src/README.rst +++ b/related-packages/fileformats/README.rst @@ -1,7 +1,7 @@ How to customise this template ============================== -#. Rename the `fileformats/src/CHANGEME` directory to the name of the fileformats subpackage (e.g. `medimage_fsl`) +#. Rename the `related-packages/fileformats/CHANGEME` directory to the name of the fileformats subpackage (e.g. `medimage_fsl`) #. Search and replace "CHANGEME" with the name of the fileformats subpackage the extras are to be added #. Replace name + email placeholders in `pyproject.toml` for developers and maintainers #. Add the extension file-format classes diff --git a/fileformats/src/fileformats/medimage_CHANGEME/__init__.py b/related-packages/fileformats/fileformats/medimage_CHANGEME/__init__.py similarity index 100% rename from fileformats/src/fileformats/medimage_CHANGEME/__init__.py rename to related-packages/fileformats/fileformats/medimage_CHANGEME/__init__.py diff --git a/fileformats/src/pyproject.toml b/related-packages/fileformats/pyproject.toml similarity index 97% rename from fileformats/src/pyproject.toml rename to related-packages/fileformats/pyproject.toml index 4f5db09..b070d1f 100644 --- a/fileformats/src/pyproject.toml +++ b/related-packages/fileformats/pyproject.toml @@ -8,8 +8,8 @@ description = "Classes for representing different file formats in Python classes readme = "README.rst" requires-python = ">=3.8" dependencies = [ - "fileformats >= 0.4", - "fileformats-medimage > = 0.2" + "fileformats", + "fileformats-medimage" ] license = {file = "LICENSE"} authors = [ From 31fa4801f509ddf09f186c58d498a19f43c97f3f Mon Sep 17 00:00:00 2001 From: Tom Close Date: Sat, 16 Mar 2024 14:40:54 +1100 Subject: [PATCH 7/9] added _version.py to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0adc809..de08422 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ __pycache__/ .Python build/ develop-eggs/ +_version.py dist/ downloads/ eggs/ From 4483115d26cd13018267206463b358f7d25d49c4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 16 Mar 2024 03:41:11 +0000 Subject: [PATCH 8/9] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tools/rename_template.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/rename_template.py b/tools/rename_template.py index 2b6b13b..53d7b8d 100755 --- a/tools/rename_template.py +++ b/tools/rename_template.py @@ -8,17 +8,19 @@ PACKAGE_ROOT = Path(__file__).absolute().parent.parent + @functools.lru_cache() def load_gitignore(repo): - gitignore = repo / '.gitignore' + gitignore = repo / ".gitignore" ignore = [fnmatch.translate(".git/"), fnmatch.translate(Path(__file__).name)] if gitignore.exists(): ignore.extend( fnmatch.translate(line.strip()) for line in gitignore.read_text().splitlines() - if line.strip() and not line[0] == '#' + if line.strip() and not line[0] == "#" ) - return re.compile('|'.join(ignore)) + return re.compile("|".join(ignore)) + cmd, new_name, *_ = sys.argv @@ -31,7 +33,7 @@ def load_gitignore(repo): root = Path(root) for src in list(dirs): - if 'TODO' in src: + if "TODO" in src: dst = src.replace("TODO", new_name) print(f"Renaming: {root / src} -> {root / dst}") os.rename(root / src, root / dst) @@ -40,6 +42,6 @@ def load_gitignore(repo): for fname in files: f = root / fname text = Path.read_text(root / fname) - if 'TODO' in text: + if "TODO" in text: print(f"Rewriting: {root / fname}") Path.write_text(root / fname, text.replace("TODO", new_name)) From ff5b628806e763d0e02f24f89b8848d5f900500d Mon Sep 17 00:00:00 2001 From: Tom Close Date: Sat, 16 Mar 2024 14:42:03 +1100 Subject: [PATCH 9/9] updated TODO to CHANGEME in rename_template script --- tools/rename_template.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/rename_template.py b/tools/rename_template.py index 53d7b8d..ef1889c 100755 --- a/tools/rename_template.py +++ b/tools/rename_template.py @@ -33,8 +33,8 @@ def load_gitignore(repo): root = Path(root) for src in list(dirs): - if "TODO" in src: - dst = src.replace("TODO", new_name) + if "CHANGEME" in src: + dst = src.replace("CHANGEME", new_name) print(f"Renaming: {root / src} -> {root / dst}") os.rename(root / src, root / dst) dirs.remove(src) @@ -42,6 +42,6 @@ def load_gitignore(repo): for fname in files: f = root / fname text = Path.read_text(root / fname) - if "TODO" in text: + if "CHANGEME" in text: print(f"Rewriting: {root / fname}") - Path.write_text(root / fname, text.replace("TODO", new_name)) + Path.write_text(root / fname, text.replace("CHANGEME", new_name))