Skip to content

Commit

Permalink
Mimic scilpy's setup
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmaRenauld committed Sep 22, 2023
1 parent e2882ad commit 0d5a51b
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 199 deletions.
47 changes: 32 additions & 15 deletions .pep8speaks.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
# File : .pep8speaks.yml

scanner:
diff_only: True # If False, the entire file touched by the Pull Request is scanned for errors. If True, only the diff is scanned.
linter: flake8 # Other option is pycodestyle
linter: pycodestyle # Alternative option - flake8

pycodestyle: # Valid if scanner.linter is pycodestyle
max-line-length: 79
ignore: [] # Errors and warnings to ignore
exclude: [] # File path patterns to exclude
count: False
first: False
show-pep8: False
show-source: False
statistics: False
hang-closing: False
filename: []
select: []

flake8: # Same as scanner.linter value. Other option is pycodestyle
max-line-length: 79 # Default is 79 in PEP 8
flake8: # Valid if scanner.linter is flake8
max-line-length: 79
ignore: []
exclude: []
count: False
show-source: False
statistics: False
hang-closing: False
filename: []
select: []

descending_issues_order: False # If True, PEP 8 issues in message will be displayed in descending order of line numbers in the file.
no_blank_comment: False # If True, no comment is made on PR without any errors.
only_mention_files_with_errors: True # If False, a separate status comment for each file is made.
descending_issues_order: False # If True, PEP 8 issues in message will be displayed in descending order of line numbers in the file
only_mention_files_with_errors: True # If False, a separate status section for each file is made in the comment.

message: # Customize the comment made by the bot,
message: # Customize the comment made by the bot
opened: # Messages when a new PR is submitted
header: "Hello @{name}! Thanks for opening this PR. "
# The keyword {name} is converted into the author's username
header: "Hello @{name}, Thank you for submitting the Pull Request !"
footer: "Do see the [PEP 8 -- Style Guide for Python Code](https://www.python.org/dev/peps/pep-0008/)"
# The messages can be written as they would over GitHub
updated: # Messages when new commits are added to the PR
header: "Hello @{name}! Thanks for updating this PR. "
footer: "" # Why to comment the link to the style guide everytime? :)
no_errors: "There are currently no PEP 8 issues detected in this Pull Request. Cheers! :rocket: "
updated: # Messages when a PR is updated
header: "Hello @{name}, Thank you for updating !"
footer: ""
no_errors: "There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: "
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
28 changes: 9 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
# Minimal makefile for Sphinx documentation
#
flake8:
@if command -v flake8 > /dev/null; then \
echo "Running flake8"; \
flake8 flake8 --ignore N802,N806 `find . -name \*.py | grep -v setup.py | grep -v /doc/`; \
else \
echo "flake8 not found, please install it!"; \
exit 1; \
fi;
@echo "flake8 passed"

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = doc
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
55 changes: 0 additions & 55 deletions dwi_ml/info.py

This file was deleted.

87 changes: 87 additions & 0 deletions dwi_ml/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# -*- coding: utf-8 -*-

import glob

# Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z"
_version_major = 1
_version_minor = 0
_version_micro = 0
_version_extra = ''

# Construct full version string from these.
_ver = [_version_major, _version_minor]
if _version_micro:
_ver.append(_version_micro)
if _version_extra:
_ver.append(_version_extra)

__version__ = '.'.join(map(str, _ver))

CLASSIFIERS = ["Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering",
'Topic :: Scientific/Engineering ::Neuroimaging']

PYTHON_VERSION = ""
with open('.python-version') as f:
py_version = f.readline().strip("\n").split(".")
py_major = py_version[0]
py_minor = py_version[1]
py_micro = "*"
py_extra = None
if len(py_version) > 2:
py_micro = py_version[2]
if len(py_version) > 3:
py_extra = py_version[3]

PYTHON_VERSION = ".".join([py_major, py_minor, py_micro])
if py_extra:
PYTHON_VERSION = ".".join([PYTHON_VERSION, py_extra])

PYTHON_VERSION = "".join(["==", PYTHON_VERSION])

# Description should be a one-liner:
description = 'Diffusion Magnetic Resonance Imaging analysis toolkit ' + \
'using machine learning and deep learning methods.'

# Long description will go up on the pypi page
long_description = """
DWI_ML
======
SCIL and VITAL research labs' code for machine learning in medical data.
License
=======
``dwi_ml`` is licensed under the terms of the MIT license. See the file
"LICENSE" for information on the history of this software, terms & conditions
for usage, and a DISCLAIMER OF ALL WARRANTIES.
All trademarks referenced herein are property of their respective holders.
Copyright (c) 2012--, Sherbrooke Connectivity Imaging Lab [SCIL],
Université de Sherbrooke.
"""

NAME = "dwi_ml"
MAINTAINER = "Emmanuelle Renauld (@EmmaRenauld)"
MAINTAINER_EMAIL = ""
DESCRIPTION = description
LONG_DESCRIPTION = long_description
URL = "https://github.com/scil-vital/dwi_ml"
DOWNLOAD_URL = ""
LICENSE = "MIT"
AUTHOR = "The SCIL developers"
AUTHOR_EMAIL = ""
PLATFORMS = "OS Independent"
MAJOR = _version_major
MINOR = _version_minor
MICRO = _version_micro
VERSION = __version__
SCRIPTS = glob.glob("scripts_python/*.py")

PREVIOUS_MAINTAINERS=[]
35 changes: 0 additions & 35 deletions make.bat

This file was deleted.

83 changes: 42 additions & 41 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
#!/usr/bin/env python
"""Installation script for the DWI_ML package."""
import os

from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
from os.path import join as pjoin
import glob
from setuptools import setup, find_packages, Extension
from setuptools.command.build_ext import build_ext

from setup_helpers import read_vars_from
with open('requirements.txt') as f:
required_dependencies = f.read().splitlines()
external_dependencies = []
for dependency in required_dependencies:
if dependency[0:2] == '-e':
repo_name = dependency.split('=')[-1]
repo_url = dependency[3:]
external_dependencies.append('{} @ {}'.format(repo_name, repo_url))
else:
external_dependencies.append(dependency)

# Read package information
info = read_vars_from(pjoin('dwi_ml', 'info.py'))

this_directory = path.abspath(path.dirname(__file__))
# Get version and release info, which is all stored in version.py
ver_file = os.path.join('dwi_ml', 'version.py')
with open(ver_file) as f:
exec(f.read())
opts = dict(name=NAME,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
url=URL,
download_url=DOWNLOAD_URL,
license=LICENSE,
classifiers=CLASSIFIERS,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
platforms=PLATFORMS,
version=VERSION,
packages=find_packages(),
python_requires=PYTHON_VERSION,
setup_requires=['numpy'],
install_requires=external_dependencies,
entry_points={
'console_scripts': ["{}=scripts_python.{}:main".format(
os.path.basename(s),
os.path.basename(s).split(".")[0]) for s in SCRIPTS]
},
data_files=[],
include_package_data=True)

dwi_ml_readme_path = pjoin(this_directory, 'README.rst')
with open(dwi_ml_readme_path, encoding='utf-8') as f:
long_description = f.read()

setup(
name=info.NAME,
version=info.VERSION,
description=info.DESCRIPTION,
long_description=long_description,
long_description_content_type='text/x-rst',
url=info.URL,
project_urls={'Bug tracker': info.BUG_TRACKER,
'Documentation': info.DOCUMENTATION,
'Source code': info.SOURCE_CODE},
license=info.LICENSE,
author=info.AUTHOR,
author_email=info.AUTHOR_EMAIL,
classifiers=info.CLASSIFIERS,
keywords=info.KEYWORDS,
maintainer=info.MAINTAINER,
provides=info.PROVIDES,
packages=find_packages(exclude=['contrib', 'doc', 'tests']),
install_requires=[],
requires=info.REQUIRES,
package_data={},
data_files=[],
entry_points={},
scripts=glob.glob("scripts_python/*.py") + glob.glob("bash_utilities/*.sh") + glob.glob("scripts_python/tests/scripts_on_test_model/*.py")
)
setup(**opts)
34 changes: 0 additions & 34 deletions setup_helpers.py

This file was deleted.

0 comments on commit 0d5a51b

Please sign in to comment.