diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml new file mode 100644 index 00000000..a175402e --- /dev/null +++ b/.github/workflows/publish-package.yml @@ -0,0 +1,35 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + release: + types: [published] + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.8" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: python -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.gitignore b/.gitignore index 52210015..c9cd8de5 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ dataset_cache.pkl .mypy_cache/ lightning_logs/ *.pt +build/ +dist/ diff --git a/README.md b/README.md index e5512bd4..6e07a5c5 100644 --- a/README.md +++ b/README.md @@ -52,17 +52,24 @@ We have tested this code using: First install PyTorch according to the directions at the [PyTorch Website](https://pytorch.org/get-started/) for your operating system -and CUDA setup. - -Then, navigate to the `fastmri` root directory and run +and CUDA setup. Then, run ```bash -pip install -e . +pip install fastmri ``` `pip` will handle all package dependencies. After this you should be able to run most of the code in the repository. +### Installing Directly from Source + +If you want to install directly from the GitHub source, clone the repository, +navigate to the `fastmri` root directory and run + +```bash +pip install -e . +``` + ## Package Structure & Usage The repository is centered around the `fastmri` module. The following breaks diff --git a/fastmri/__init__.py b/fastmri/__init__.py index 4260ce29..fb91a4f1 100644 --- a/fastmri/__init__.py +++ b/fastmri/__init__.py @@ -4,6 +4,13 @@ This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ + +__version__ = "0.1.0.post210716" +__author__ = "Facebook/NYU fastMRI Team" +__author_email__ = "fastmri@fb.com" +__license__ = "MIT" +__homepage__ = "https://fastmri.org/" + import torch from packaging import version diff --git a/setup.py b/setup.py index 213cf53d..028f9945 100644 --- a/setup.py +++ b/setup.py @@ -5,34 +5,67 @@ LICENSE file in the root directory of this source tree. """ +import os +import re + from setuptools import find_packages, setup +# from https://github.com/facebookresearch/ClassyVision/blob/master/setup.py +# get version string from module +with open(os.path.join(os.path.dirname(__file__), "fastmri/__init__.py"), "r") as f: + readval = re.search(r"__version__ = ['\"]([^'\"]*)['\"]", f.read(), re.M) + if readval is None: + raise RuntimeError("Version not found.") + version = readval.group(1) + print("-- Building version " + version) + +with open("README.md", encoding="utf8") as f: + readme = f.read() + install_requires = [ "numpy>=1.18.5", "scikit_image>=0.16.2", - "torchvision>=0.6.0", - "torch>=1.6", + "torchvision>=0.8.1", + "torch>=1.7.0", "runstats>=1.8.0", - "pytorch_lightning", - "h5py", - "PyYAML", + "pytorch_lightning>=1.0.6,<1.1", + "h5py>=2.10.0", + "PyYAML>=5.3.1", ] setup( name="fastmri", author="Facebook/NYU fastMRI Team", author_email="fastmri@fb.com", - version="0.1", + version=version, + license="MIT", + description="A large-scale dataset of both raw MRI measurements and clinical MRI images.", + long_description_content_type="text/markdown", + long_description=readme, + project_urls={ + "Homepage": "https://fastmri.org/", + "Source": "https://github.com/facebookresearch/fastMRI", + }, + python_requires=">=3.6", packages=find_packages( exclude=[ "tests", "fastmri_examples", - "data", - "common", "banding_removal", - "models", ] ), setup_requires=["wheel"], install_requires=install_requires, + classifiers=[ + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Topic :: Scientific/Engineering :: Image Processing", + "Topic :: Scientific/Engineering :: Medical Science Apps.", + "Topic :: Scientific/Engineering :: Physics", + ], )