Skip to content

Commit 62909d2

Browse files
authoredJul 16, 2021
Update package for PyPI distribution (#143)
* Test the distribution build * Updates for publishing to PyPI * Update install instructions
1 parent 1ee19b5 commit 62909d2

File tree

5 files changed

+97
-13
lines changed

5 files changed

+97
-13
lines changed
 

‎.github/workflows/publish-package.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
jobs:
16+
deploy:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set up Python
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: "3.8"
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install build
29+
- name: Build package
30+
run: python -m build
31+
- name: Publish package
32+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
33+
with:
34+
user: __token__
35+
password: ${{ secrets.PYPI_API_TOKEN }}

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ dataset_cache.pkl
1818
.mypy_cache/
1919
lightning_logs/
2020
*.pt
21+
build/
22+
dist/

‎README.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,24 @@ We have tested this code using:
5252

5353
First install PyTorch according to the directions at the
5454
[PyTorch Website](https://pytorch.org/get-started/) for your operating system
55-
and CUDA setup.
56-
57-
Then, navigate to the `fastmri` root directory and run
55+
and CUDA setup. Then, run
5856

5957
```bash
60-
pip install -e .
58+
pip install fastmri
6159
```
6260

6361
`pip` will handle all package dependencies. After this you should be able to
6462
run most of the code in the repository.
6563

64+
### Installing Directly from Source
65+
66+
If you want to install directly from the GitHub source, clone the repository,
67+
navigate to the `fastmri` root directory and run
68+
69+
```bash
70+
pip install -e .
71+
```
72+
6673
## Package Structure & Usage
6774

6875
The repository is centered around the `fastmri` module. The following breaks

‎fastmri/__init__.py

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
This source code is licensed under the MIT license found in the
55
LICENSE file in the root directory of this source tree.
66
"""
7+
8+
__version__ = "0.1.0.post210716"
9+
__author__ = "Facebook/NYU fastMRI Team"
10+
__author_email__ = "fastmri@fb.com"
11+
__license__ = "MIT"
12+
__homepage__ = "https://fastmri.org/"
13+
714
import torch
815
from packaging import version
916

‎setup.py

+42-9
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,67 @@
55
LICENSE file in the root directory of this source tree.
66
"""
77

8+
import os
9+
import re
10+
811
from setuptools import find_packages, setup
912

13+
# from https://github.com/facebookresearch/ClassyVision/blob/master/setup.py
14+
# get version string from module
15+
with open(os.path.join(os.path.dirname(__file__), "fastmri/__init__.py"), "r") as f:
16+
readval = re.search(r"__version__ = ['\"]([^'\"]*)['\"]", f.read(), re.M)
17+
if readval is None:
18+
raise RuntimeError("Version not found.")
19+
version = readval.group(1)
20+
print("-- Building version " + version)
21+
22+
with open("README.md", encoding="utf8") as f:
23+
readme = f.read()
24+
1025
install_requires = [
1126
"numpy>=1.18.5",
1227
"scikit_image>=0.16.2",
13-
"torchvision>=0.6.0",
14-
"torch>=1.6",
28+
"torchvision>=0.8.1",
29+
"torch>=1.7.0",
1530
"runstats>=1.8.0",
16-
"pytorch_lightning",
17-
"h5py",
18-
"PyYAML",
31+
"pytorch_lightning>=1.0.6,<1.1",
32+
"h5py>=2.10.0",
33+
"PyYAML>=5.3.1",
1934
]
2035

2136
setup(
2237
name="fastmri",
2338
author="Facebook/NYU fastMRI Team",
2439
author_email="fastmri@fb.com",
25-
version="0.1",
40+
version=version,
41+
license="MIT",
42+
description="A large-scale dataset of both raw MRI measurements and clinical MRI images.",
43+
long_description_content_type="text/markdown",
44+
long_description=readme,
45+
project_urls={
46+
"Homepage": "https://fastmri.org/",
47+
"Source": "https://github.com/facebookresearch/fastMRI",
48+
},
49+
python_requires=">=3.6",
2650
packages=find_packages(
2751
exclude=[
2852
"tests",
2953
"fastmri_examples",
30-
"data",
31-
"common",
3254
"banding_removal",
33-
"models",
3455
]
3556
),
3657
setup_requires=["wheel"],
3758
install_requires=install_requires,
59+
classifiers=[
60+
"Programming Language :: Python :: 3",
61+
"Programming Language :: Python :: 3.6",
62+
"License :: OSI Approved :: MIT License",
63+
"Operating System :: OS Independent",
64+
"Development Status :: 3 - Alpha",
65+
"Intended Audience :: Developers",
66+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
67+
"Topic :: Scientific/Engineering :: Image Processing",
68+
"Topic :: Scientific/Engineering :: Medical Science Apps.",
69+
"Topic :: Scientific/Engineering :: Physics",
70+
],
3871
)

0 commit comments

Comments
 (0)
Please sign in to comment.