Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 1, 2024
1 parent 9e50677 commit 1c07a76
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ MANIFEST

# Singularity Images
**/*.simg
**/*.sif
**/*.sif
34 changes: 17 additions & 17 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,38 +42,38 @@ Usage
[--tag TAG] [--working_dir PATH] [-v] [-vv]
{run,utils,version,group,gradients,tsconcat,pull,upgrade,enter,bash,shell,parse-resources,parse_resources,crash}
...
cpac: a Python package that simplifies using C-PAC <http://fcp-indi.github.io> containerized images.
cpac: a Python package that simplifies using C-PAC <http://fcp-indi.github.io> containerized images.
This commandline interface package is designed to minimize repetition.
As such, nearly all arguments are optional.
When launching a container, this package will try to bind any paths mentioned in
When launching a container, this package will try to bind any paths mentioned in
• the command
• the data configuration
An example minimal run command:
cpac run /path/to/data /path/for/outputs
An example run command with optional arguments:
cpac -B /path/to/data/configs:/configs \
--image fcpindi/c-pac --tag latest \
run /path/to/data /path/for/outputs \
--data_config_file /configs/data_config.yml \
--save_working_dir
Each command can take "--help" to provide additonal usage information, e.g.,
cpac run --help
Known issues:
- Some Docker containers unexpectedly persist after cpac finishes. To clear them, run
1. `docker ps` to list the containers
For each C-PAC conatainer that persists, run
2. `docker attach <container_name>`
3. `exit`
- https://github.com/FCP-INDI/cpac/issues
positional arguments:
{run,utils,version,group,gradients,tsconcat,pull,upgrade,enter,bash,shell,parse-resources,parse_resources,crash}
run Run C-PAC. See
Expand All @@ -87,7 +87,7 @@ Usage
"cpac [--platform {docker,apptainer,singularity}] [--image IMAGE] [--tag TAG] group --help"
for more information.
gradients Run ba_timeseries_gradients. See
"cpac [--platform "{docker,singularity}] gradients --help"
"cpac [--platform "{docker,singularity}] gradients --help"
for more information.
tsconcat Run ba-tsconcat (<0.2.0,>=0.1.2)
pull (upgrade) Upgrade your local C-PAC version to the latest version
Expand All @@ -98,21 +98,21 @@ Usage
Enter a new C-PAC container via BASH.
parse-resources (parse_resources)
.
When provided with a `callback.log` file, this utility can sort through
the memory `runtime` usage, `estimate`, and associated `efficiency`, to
identify the `n` tasks with the `highest` or `lowest` of each of these
categories.
"parse-resources" is intended to be run outside a C-PAC container.
See "cpac parse-resources --help" for more information.
crash Convert a crash pickle to plain text (C-PAC < 1.8.0).
options:
-h, --help show this help message and exit
--version show program's version number and exit
-o OPT, --container_option OPT, --container_options OPT
parameters and flags to pass through to Docker or Singularity
This flag can take multiple arguments so cannot be
the final argument before the command argument (i.e.,
run or any other command that does not start with - or --)
Expand All @@ -123,7 +123,7 @@ Usage
real_path:container_path
(eg, /home/C-PAC/run5/outputs:/outputs).
Use absolute paths for both paths.
This flag can take multiple arguments so cannot be
the final argument before the command argument (i.e.,
run or any other command that does not start with - or --)
Expand All @@ -134,7 +134,7 @@ Usage
--image IMAGE path to Apptainer/Singularity image file OR name of Docker image (eg, "fcpindi/c-pac").
Will attempt to pull from Singularity Hub or Docker Hub if not provided.
If image is specified but platform is not, platform is
assumed to be Apptainer/Singularity if image is a path or
assumed to be Apptainer/Singularity if image is a path or
Docker if image is an image name.
--tag TAG tag of the Docker image to use (eg, "latest" or "nightly").
--working_dir PATH working directory
Expand Down
1 change: 1 addition & 0 deletions src/cpac/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
"""Init file for cpac."""

from importlib.metadata import distribution, PackageNotFoundError

DIST_NAME = __name__
Expand Down
1 change: 1 addition & 0 deletions src/cpac/backends/apptainer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Backend for Apptainer images."""

from .apptainer import Apptainer

__all__ = ["Apptainer"]
1 change: 1 addition & 0 deletions src/cpac/backends/apptainer/apptainer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Backend for Apptainer images."""

from spython import main as spython_main
from spython.main.base import command

Expand Down
1 change: 1 addition & 0 deletions src/cpac/backends/apptainer/spython.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""Modifications to ``spython`` run Apptainer instead of Singularity."""

from spython.main import get_client as get_spython_client


Expand Down
1 change: 1 addition & 0 deletions src/cpac/helpers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Hepler functions for cpac Python package."""

from itertools import chain
import re

Expand Down
1 change: 1 addition & 0 deletions src/cpac/helpers/cpac_parse_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
categories.
`cpac_parse_resources` is intended to be run outside a C-PAC container.
"""

from argparse import ArgumentParser
import configparser
import json
Expand Down
1 change: 1 addition & 0 deletions src/cpac/utils/checks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions to check things like the in-container C-PAC version."""

from packaging.version import Version
from semver import VersionInfo

Expand Down
2 changes: 1 addition & 1 deletion tests/.pylintrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[MAIN]
ignore-imports=y
ignore-imports=y
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Read more about conftest.py under:
https://pytest.org/latest/plugins.html
"""

import logging

import pytest # pylint: disable=import-error
Expand Down
1 change: 1 addition & 0 deletions tests/test_cpac.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for top-level cpac cli."""

from contextlib import redirect_stderr, redirect_stdout
from io import BytesIO, StringIO, TextIOWrapper
import sys
Expand Down
1 change: 1 addition & 0 deletions tests/test_cpac_gradients.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit tests for the command-line interface module of ``ba-timeseries-gradients``."""

from argparse import Namespace
import logging
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_cpac_run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test actually running C-PAC with cpac."""

from datetime import date, timedelta
import os
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_wrapped.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Test bare-wrapped commands."""

from subprocess import call

from pytest import mark, skip
Expand Down

0 comments on commit 1c07a76

Please sign in to comment.