diff --git a/.gitignore b/.gitignore index 214e03b7..27ac06fd 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ docs/build # Distribution / packaging .Python develop-eggs/ +build/ dist/ downloads/ eggs/ @@ -121,3 +122,4 @@ build/win/build .zgroup *.png +aydin/_version.py diff --git a/aydin/__init__.py b/aydin/__init__.py index b0d24ec3..4bb2a3a8 100644 --- a/aydin/__init__.py +++ b/aydin/__init__.py @@ -3,3 +3,8 @@ from aydin.restoration.denoise.classic import Classic # noqa: F401 from aydin.restoration.denoise.classic import classic_denoise # noqa: F401 from aydin.restoration.deconvolve.lr import lucyrichardson # noqa: F401 + +try: + from ._version import version as __version__ +except ImportError: + __version__ = "not-installed" diff --git a/aydin/cli/cli.py b/aydin/cli/cli.py index b3c8b8dc..45bf133f 100644 --- a/aydin/cli/cli.py +++ b/aydin/cli/cli.py @@ -5,7 +5,6 @@ import click import numpy import napari -from importlib_metadata import version, PackageNotFoundError from aydin.gui.gui import run from aydin.it.base import ImageTranslatorBase @@ -16,22 +15,17 @@ from aydin.util.misc.json import load_any_json from aydin.util.log.log import lprint, Log from aydin.util.misc.slicing_helper import apply_slicing - +from aydin import __version__ CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) -VERSION = None - -try: - VERSION = version("aydin") -except PackageNotFoundError: - lprint("Aydin installation has problems, please re-install") +VERSION = __version__ @click.group(invoke_without_command=True, context_settings=CONTEXT_SETTINGS) @click.pass_context @click.version_option(version=VERSION) -def aydin(ctx): +def cli(ctx): """aydin cli Parameters @@ -56,7 +50,7 @@ def exception_hook(exctype, value, traceback): pass -@aydin.command() +@cli.command() @click.argument('files', nargs=-1) @click.option('-ts', '--training-slicing', default='', type=str) @click.option('-is', '--inference-slicing', default='', type=str) @@ -150,7 +144,7 @@ def denoise(files, **kwargs): lprint("DONE") -@aydin.command() +@cli.command() @click.argument('files', nargs=-1) @click.argument('psf_path', nargs=1) @click.option('-s', '--slicing', default='', type=str) @@ -184,7 +178,7 @@ def lucyrichardson(files, psf_path, **kwargs): imwrite(deconvolved, path) -@aydin.command() +@cli.command() @click.argument('files', nargs=-1) @click.option('-s', '--slicing', default='', type=str) def info(files, **kwargs): @@ -201,7 +195,7 @@ def info(files, **kwargs): ) # we are not printing anything here as aydin.io.imread prints logs -@aydin.command() +@cli.command() @click.argument('files', nargs=-1) @click.option('-s', '--slicing', default='', type=str) def view(files, **kwargs): @@ -225,7 +219,7 @@ def view(files, **kwargs): viewer.add_image(image, name=filenames[idx]) -@aydin.command() +@cli.command() @click.argument('files', nargs=-1) @click.option('-s', '--slicing', default='', type=str) def hyperstack(files, **kwargs): @@ -282,4 +276,4 @@ def handle_files(files, slicing): if __name__ == '__main__': - aydin() + cli() diff --git a/pyproject.toml b/pyproject.toml index d7cee5b0..94f7d57d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,13 @@ target-version = ['py36', 'py37'] skip-string-normalization = true + [build-system] -requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"] +requires = [ + "setuptools >= 42", + "wheel", + "setuptools_scm[toml]>=3.4" +] [tool.setuptools_scm] +write_to = "aydin/_version.py" diff --git a/requirements/default.txt b/requirements/default.txt index 07b94ffc..571a6775 100644 --- a/requirements/default.txt +++ b/requirements/default.txt @@ -19,5 +19,4 @@ qtpy==1.11.2 scikit-image==0.18.3 tensorflow==2.6.0 keras==2.6.0 -zarr==2.4.0; sys_platform == "darwin" -zarr==2.10.2; sys_platform == "win32" or sys_platform == "linux" +zarr==2.4.0 diff --git a/setup.cfg b/setup.cfg index b88034e4..201a85db 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,51 @@ [metadata] -description-file = README.md +name = aydin +url = https://royerlab.github.io/aydin/ +download_url = https://github.com/royerlab/aydin +license = BSD 3-Clause +license_file = LICENSE.txt +description = Aydin - Denoising but chill +long_description = file: README.md +long_description_content_type = text/markdown +classifiers = + Development Status :: 3 - Alpha + Environment :: X11 Applications :: Qt + Intended Audience :: Science/Research + License :: OSI Approved :: BSD License + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.9 + Topic :: Scientific/Engineering + Topic :: Scientific/Engineering :: Image Processing + Operating System :: Microsoft :: Windows + Operating System :: POSIX + Operating System :: Unix + Operating System :: MacOS + +[options] +zip_safe = False +packages = find: +python_requires = >=3.9 +include_package_data = True +install_requires = + catboost==1.0.1 + Click==8.0.3 + czifile==2019.7.2 + docstring-parser==0.12 + gdown==4.2.0 + googledrivedownloader==0.4 + importlib-metadata==4.8.1 + jsonpickle==1.3.0 + lightgbm==3.3.1 + napari==0.4.12 + nd2reader==3.3.0 + numba==0.54.1 + numexpr==2.7.3 + numpy>=1.19.2 + pynndescent==0.5.5 + PyQt5==5.15.5 + QDarkStyle==3.0.2 + qtpy==1.11.2 + scikit-image==0.18.3 + tensorflow==2.6.0 + keras==2.6.0 + zarr==2.4.0 diff --git a/setup.py b/setup.py index 2b6738b3..3acda2a9 100644 --- a/setup.py +++ b/setup.py @@ -1,43 +1,32 @@ import sys -import os from setuptools import setup -if sys.version_info < (3, 7): +if sys.version_info < (3, 9): sys.stderr.write( f'You are using Python ' + "{'.'.join(str(v) for v in sys.version_info[:3])}.\n\n" - + 'aydin only supports Python 3.7 and above.\n\n' - + 'Please install Python 3.7 using:\n' - + ' $ pip install python==3.7\n\n' + + 'aydin only supports Python 3.9 and above.\n\n' + + 'Please install Python 3.9 using:\n' + + ' $ pip install python==3.9\n\n' ) sys.exit(1) -with open(os.path.join('requirements', 'default.txt')) as f: - default_requirements = [ - line.strip() for line in f if line and not line.startswith('#') - ] - -INSTALL_REQUIRES = default_requirements -REQUIRES = [] +# with open(os.path.join('requirements', 'default.txt')) as f: +# default_requirements = [ +# line.strip() for line in f if line and not line.startswith('#') +# ] +# +# INSTALL_REQUIRES = default_requirements +# REQUIRES = [] # Handle pyopencl # os.system("pip install -r " + os.path.join('requirements', 'pyopencl.txt')) setup( - name='aydin', - packages=['aydin'], - use_scm_version=True, + use_scm_version={"write_to": "aydin/_version.py"}, setup_requires=['setuptools_scm'], - install_requires=INSTALL_REQUIRES, - py_modules=['aydin'], - entry_points=''' - [console_scripts] - aydin=aydin.cli.cli:aydin - ''', - download_url='https://github.com/royerlab/aydin/archive/refs/tags/v0.1.6.tar.gz', - classifiers=[ - 'Development Status :: 3 - Alpha', - 'Programming Language :: Python :: 3.9', - ], + entry_points={ + 'console_scripts': ['aydin=aydin.cli.cli:cli'] + }, )