Skip to content

Commit

Permalink
Update files for Sphinx and PyPI compatibility
Browse files Browse the repository at this point in the history
- Sphinx: sequence.py updates matplotlib.rcParams when plot() is called
- PyPI:
--- Modify MANIFEST.in to include VERSION and seq_examples/*
--- Modify setup.py to include VERSION and seq_examples/*
  • Loading branch information
sravan953 committed Apr 11, 2021
1 parent d52dcb6 commit 6ce8fe4
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 21 deletions.
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
include pypulseq/utils/SAR/QGlobal.mat
include VERSION
include pypulseq/SAR/QGlobal.mat
recursive-include pypulseq/seq_examples/* *
4 changes: 2 additions & 2 deletions pypulseq/Sequence/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
from pypulseq.points_to_waveform import points_to_waveform
from pypulseq.supported_labels import get_supported_labels

mpl.rcParams['lines.linewidth'] = 0.75 # Set default Matplotlib linewidth


class Sequence:
version_major = major
Expand Down Expand Up @@ -494,6 +492,8 @@ def plot(self, label: str = str(), save: bool = False, time_range=(0, np.inf), t
plot_type : str, default='Gradient'
Gradients display type, must be one of either 'Gradient' or 'Kspace'.
"""
mpl.rcParams['lines.linewidth'] = 0.75 # Set default Matplotlib linewidth

valid_plot_types = ['Gradient', 'Kspace']
valid_time_units = ['s', 'ms', 'us']
valid_labels = get_supported_labels()
Expand Down
74 changes: 56 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,69 @@
from typing import Tuple

import setuptools

try: # Unicode decode error on Windows
with open("README.md", "r") as fh:
long_description = fh.read()
except:
long_description = 'Pulseq in Python'

def _get_version() -> Tuple[int, int, int]:
"""
Returns version of current PyPulseq release.
Returns
-------
major, minor, revision : int
Major, minor and revision numbers of current PyPulseq release.
"""
with open('VERSION', 'r') as version_file:
major, minor, revision = version_file.read().strip().split('.')
return major, minor, revision


def _get_long_description() -> str:
"""
Returns long description from `README.md` if possible, else 'Pulseq in Python'.
Returns
-------
str
Long description of PyPulseq project.
"""
try: # Unicode decode error on Windows
with open("README.md", "r") as fh:
long_description = fh.read()
except:
long_description = 'Pulseq in Python'
return long_description


setuptools.setup(
name="pypulseq",
version="1.2.0.post3",
author="Keerthi Sravan Ravi",
author_email="ks3621@columbia.edu",
description="Pulseq in Python",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/imr-framework/pypulseq",
packages=setuptools.find_packages(),
include_package_data=True,
package_data={'pypulseq.utils.SAR': ['QGlobal.mat']},
install_requires=['matplotlib>=3.0.3',
'numpy>=1.16.3',
'scipy>=1.4.1'],
license='License :: OSI Approved :: GNU Affero General Public License v3',
classifiers=[
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: OS Independent",
],
description="Pulseq in Python",
include_package_data=True,
install_requires=[
'matplotlib>=3.3.4',
'numpy>=1.19.5',
'scipy>=1.5.4'
],
license='License :: OSI Approved :: GNU Affero General Public License v3',
long_description=_get_long_description(),
long_description_content_type="text/markdown",
name="pypulseq",
packages=setuptools.find_packages(),
# package_data for wheel distributions; MANIFEST.in for source distributions
package_data={
'': ['../VERSION'],
'pypulseq.SAR': ['QGlobal.mat']
},
project_urls={
'Documentation': 'https://pypulseq.readthedocs.io/en/latest/'
},
python_requires='>=3.6.3',
url="https://github.com/imr-framework/pypulseq",
version=".".join(_get_version()),
)

0 comments on commit 6ce8fe4

Please sign in to comment.