diff --git a/biapy/__init__.py b/biapy/__init__.py index b23a1679..52d6b867 100644 --- a/biapy/__init__.py +++ b/biapy/__init__.py @@ -1,3 +1,54 @@ -__version__="3.2.0" +__version__="3.4.0" +import argparse +import os +import sys from ._biapy import BiaPy + + +def main(): + + ########################## + # ARGS COMPROBATION # + ########################## + + # Normal exec: + # python -u main.py \ + # --config $input_job_cfg_file \ + # --result_dir $result_dir \ + # --name $job_name \ + # --run_id $job_counter \ + # --gpu 0 + # Distributed: + # python -u -m torch.distributed.run \ + # --nproc_per_node=2 \ + # main.py \ + # --config $input_job_cfg_file \ + # --result_dir $result_dir \ + # --name $job_name \ + # --run_id $job_counter \ + # --gpu 0,1 + + parser = argparse.ArgumentParser() + parser.add_argument("--config", required=True, help="Path to the configuration file") + parser.add_argument("--result_dir", help="Path to where the resulting output of the job will be stored", + default=os.getenv('HOME')) + parser.add_argument("--name", help="Job name", default="unknown_job") + parser.add_argument("--run_id", help="Run number of the same job", type=int, default=1) + parser.add_argument("--gpu", help="GPU number according to 'nvidia-smi' command", type=str) + + # Distributed training parameters + parser.add_argument('--world_size', default=1, type=int, + help='number of distributed processes') + parser.add_argument('--local_rank', default=-1, type=int, + help='Node rank for distributed training. Necessary for using the torch.distributed.launch utility.') + parser.add_argument('--dist_on_itp', action='store_true') + parser.add_argument('--dist_url', default='env://', + help='url used to set up distributed training') + parser.add_argument('--dist_backend', type=str, default='nccl', choices=['nccl', 'gloo'], + help='Backend to use in distributed mode') + args = parser.parse_args() + + _biapy = BiaPy(**vars(args)) + _biapy.run_job() + sys.exit(0) diff --git a/main.py b/main.py index 946abf85..31b05b83 100644 --- a/main.py +++ b/main.py @@ -2,51 +2,7 @@ import os import sys -from biapy import BiaPy +from biapy import main if __name__ == '__main__': - - ########################## - # ARGS COMPROBATION # - ########################## - - # Normal exec: - # python -u main.py \ - # --config $input_job_cfg_file \ - # --result_dir $result_dir \ - # --name $job_name \ - # --run_id $job_counter \ - # --gpu 0 - # Distributed: - # python -u -m torch.distributed.run \ - # --nproc_per_node=2 \ - # main.py \ - # --config $input_job_cfg_file \ - # --result_dir $result_dir \ - # --name $job_name \ - # --run_id $job_counter \ - # --gpu 0,1 - - parser = argparse.ArgumentParser() - parser.add_argument("--config", required=True, help="Path to the configuration file") - parser.add_argument("--result_dir", help="Path to where the resulting output of the job will be stored", - default=os.getenv('HOME')) - parser.add_argument("--name", help="Job name", default="unknown_job") - parser.add_argument("--run_id", help="Run number of the same job", type=int, default=1) - parser.add_argument("--gpu", help="GPU number according to 'nvidia-smi' command", type=str) - - # Distributed training parameters - parser.add_argument('--world_size', default=1, type=int, - help='number of distributed processes') - parser.add_argument('--local_rank', default=-1, type=int, - help='Node rank for distributed training. Necessary for using the torch.distributed.launch utility.') - parser.add_argument('--dist_on_itp', action='store_true') - parser.add_argument('--dist_url', default='env://', - help='url used to set up distributed training') - parser.add_argument('--dist_backend', type=str, default='nccl', choices=['nccl', 'gloo'], - help='Backend to use in distributed mode') - args = parser.parse_args() - - _biapy = BiaPy(**vars(args)) - _biapy.run_job() - sys.exit(0) \ No newline at end of file + main() \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 8e51b0b1..fcf8eaef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,14 +1,16 @@ [build-system] -requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2", "numpy>=1.24.3"] +requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] name = "biapy" -version = "3.3.8" +version = "3.4.0" description = "BiaPy: Bioimage analysis pipelines in Python" readme = "README.md" +requires-python = ">=3.10" authors = [{ name = "Daniel Franco-Barranco", email = "daniel.franco@dipc.org" }] -license = { file = "LICENSE" } +maintainers = [{ name = "Daniel Franco-Barranco", email = "daniel.franco@dipc.org" }] +license = { file = "LICENSE.md" } classifiers = [ "License :: OSI Approved :: MIT License", "Environment :: GPU :: NVIDIA CUDA :: 11.8", @@ -34,11 +36,19 @@ dependencies = [ "bioimageio.core==0.5.9", "imagecodecs>=2024.1.1", "pytorch-msssim>=1.0.0", + "numpy>=1.26.4", ] -requires-python = ">=3.10" [project.scripts] -spam-cli = "biapy:BiaPy" +biapy = "biapy:main" [project.urls] -Homepage = "https://github.com/BiaPyX/BiaPy" +"Homepage" = "https://biapyx.github.io" +"Source" = "https://github.com/BiaPyX/BiaPy" +"Forum" = "https://forum.image.sc/tag/biapy" + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.packages.find] +include = ['biapy*'] diff --git a/setup.py b/setup.py deleted file mode 100644 index 9e01afe7..00000000 --- a/setup.py +++ /dev/null @@ -1,53 +0,0 @@ -import os -import sys -import numpy as np -from distutils.sysconfig import get_python_inc -from setuptools import setup, Extension, find_namespace_packages - -requirements = [ - "imgaug>=0.4.0", - "matplotlib>=3.7.1", - "scikit-learn>=1.4.0", - "pydot>=1.4.2", - "yacs>=0.1.8", - "tqdm>=4.66.1", - "scikit-image>=0.22.0", - "edt>=2.3.2", - "fill-voids>=2.0.6", - "opencv-python>=4.8.0.76", - "pandas>=1.5.3", - "torchinfo>=1.8.0", - "tensorboardX>=2.6.2.2", - "h5py>=3.9.0", - "zarr>=2.16.1", - "bioimageio.core==0.5.9", - "imagecodecs>=2024.1.1", - "pytorch-msssim>=1.0.0", -] - - -def getInclude(): - dirName = get_python_inc() - return [dirName, os.path.dirname(dirName), np.get_include()] - - -def setup_package(): - __version__ = '3.3.8' - url = 'https://github.com/BiaPyX/BiaPy' - - setup(name='biapy', - description='Bioimage analysis pipelines in Python', - version=__version__, - url=url, - license='MIT', - author='BiaPy Contributors', - install_requires=requirements, - include_dirs=getInclude(), - packages=find_namespace_packages(), - include_package_data=True, - ) - - -if __name__ == '__main__': - # pip install --editable . - setup_package()