Skip to content

Commit

Permalink
Add black flake8 and pylint, update setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cbedetti committed Dec 1, 2019
1 parent c85e074 commit 134199b
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 47 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 88
extend-ignore = E203
3 changes: 3 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pylint]
disable=bad-continuation,
invalid-name,
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

6 changes: 2 additions & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
ipython>=7.10.0
mkdocs>=1.0.4
pybids>=0.8.0
pytest>=4.3.0
pytest-cov>=2.6.1
tox>=3.7.0
tox>=3.14.0
6 changes: 6 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pybids>=0.9.5
pytest>=5.3.1
pytest-black>=0.3.7
pytest-cov>=2.8.1
pytest-flake8>=1.0.4
pytest-pylint>=0.14.1
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

96 changes: 66 additions & 30 deletions setup.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,50 +1,86 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# type: ignore

"""Setup file for the dcm2bids package"""

import glob
import os
from setuptools import setup


#Get __version__ from dcm2bids.version
exec(open(os.path.join("dcm2bids", "version.py")).read())
def load_version():
"""Execute dcm2bids.version in a global dictionary"""
global_dict = {}
with open(os.path.join("dcm2bids", "version.py")) as _:
exec(_.read(), global_dict)
return global_dict


description = """Reorganising NIfTI files from dcm2niix into the Brain Imaging Data Structure"""


try:
with open('README.md', encoding='utf-8') as f:
long_description = f.read()
except:
#python2 compatibility
from io import open
with open('README.md', encoding='utf-8') as f:
long_description = f.read()
def install_requires():
"""Get list of required modules"""
required = []
for module, meta in _VERSION["REQUIRED_MODULE_METADATA"]:
required.append(f"{module}>={meta['min_version']}")
return required


_VERSION = load_version()
DISTNAME = "dcm2bids"
DESCRIPTION = description
VERSION = __version__
VERSION = _VERSION["__version__"]
AUTHOR = "Christophe Bedetti"
AUTHOR_EMAIL = "christophe.bedetti@umontreal.ca"
URL = "https://github.com/cbedetti/Dcm2Bids"
DOWNLOAD_URL = URL + "/archive/" + VERSION + ".tar.gz"
DESCRIPTION = (
"Reorganising NIfTI files from dcm2niix into the Brain Imaging Data Structure"
)
with open("README.md", encoding="utf-8") as _:
LONG_DESCRIPTION = _.read()
LICENSE = "GPLv3+"
PROJECT_URLS = {
"Documentation": "https://cbedetti.github.io/Dcm2Bids",
"Source Code": "https://github.com/cbedetti/Dcm2Bids",
}
CLASSIFIERS = [
"Intended Audience :: Healthcare Industry",
"Intended Audience :: Science/Research",
# 'Operating System :: MacOS',
# 'Operating System :: Microsoft :: Windows',
# 'Operating System :: POSIX',
# 'Operating System :: Unix',
"Programming Language :: Python",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
]


if __name__ == "__main__":
setup(
name=DISTNAME,
version=VERSION,
description=description,
long_description=long_description,
long_description_content_type='text/markdown',
author=AUTHOR,
author_email=AUTHOR_EMAIL,
url=URL,
download_url=DOWNLOAD_URL,
packages=['dcm2bids'],
scripts=glob.glob('scripts/dcm2bids*'),
install_requires=['future'],
)
name=DISTNAME,
version=VERSION,
packages=[DISTNAME],
scripts=glob.glob("scripts/dcm2bids*"),
entry_points={
"console_scripts": [
"dcm2bids = dcm2bids.dcm2bids:main",
"dcm2bids_helper = dcm2bids.helper:main",
"dcm2bids_scaffold = dcm2bids.scaffold:main",
],
# "configurations": [],
},
python_requires=">=3.5",
install_requires=install_requires(),
package_data={"": ["README.md", "LICENSE.txt"]},
author=AUTHOR,
author_email=AUTHOR_EMAIL,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
# keywords="",
license=LICENSE,
project_urls=PROJECT_URLS,
classifiers=CLASSIFIERS,
)
24 changes: 17 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@
# and then run "tox" from this directory.

[tox]
envlist = py27, py35, py36, py37
envlist = clean, py35, py36, py37, report

[testenv]
deps =
pybids
pytest-cov
pytest
backports.tempfile
deps = -rrequirements-test.txt
commands = pytest --cov --cov-append --black --flake8 --pylint
depends =
{py35, py36, py37}: clean
report: py35, py36, py37

[testenv:report]
deps = coverage
skip_install = true
commands =
pytest --cov=dcm2bids --cov-report html
coverage html
coverage report

[testenv:clean]
deps = coverage
skip_install = true
commands = coverage erase

0 comments on commit 134199b

Please sign in to comment.