Skip to content

Update package for PyPI distribution #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ dataset_cache.pkl
.mypy_cache/
lightning_logs/
*.pt
build/
dist/
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions fastmri/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = "[email protected]"
__license__ = "MIT"
__homepage__ = "https://fastmri.org/"

import torch
from packaging import version

Expand Down
51 changes: 42 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]",
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",
],
)