From cdbc5f0ffdc9373300230a0d22dbd005bdbf6e93 Mon Sep 17 00:00:00 2001 From: Pierre-Alexandre Fonta Date: Wed, 31 Jan 2018 18:58:20 +0100 Subject: [PATCH] Changes to release v0.4.1 on PyPI --- MANIFEST.in | 3 - README.md | 118 +++++++++++++------------- neurocurator/{main.py => __main__.py} | 6 +- neurocurator/mainWin.py | 6 +- neurocurator/settingsDlg.py | 6 +- neurocurator/utils.py | 10 +-- neurocurator/zotero_widget.py | 4 +- setup.cfg | 2 - setup.py | 109 ++++++++++++------------ upload2pypi.sh | 1 - 10 files changed, 129 insertions(+), 136 deletions(-) delete mode 100644 MANIFEST.in rename neurocurator/{main.py => __main__.py} (88%) delete mode 100644 setup.cfg delete mode 100644 upload2pypi.sh diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 8283aca..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,3 +0,0 @@ -include *.txt -include *.md -recursive-include neurocurator *.py diff --git a/README.md b/README.md index ceef19b..55eccf0 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -[Getting started](#getting-started) | +[Getting Started](#getting-started) | [Releases](#releases) | -[Status](#status) | -[Requirements: macOS](#macos) | -[Requirements: Ubuntu](#ubuntu) | -[Packaging](#packaging) +[Status](#status) # NeuroCurator -Desktop application to perform systematic and collaborative curation of neuroscientific literature. +Desktop application to perform systematic and collaborative curation of +neuroscientific literature. -This is a Graphical User Interface (GUI) for the Python package [NeuroAnnotation Toolbox (NAT)](https://github.com/BlueBrain/nat). +This is a Graphical User Interface (GUI) for the Python package +[NeuroAnnotation Toolbox (NAT)](https://github.com/BlueBrain/nat). -This framework has been described in details in the following open-access paper: https://doi.org/10.3389/fninf.2017.00027. +This framework has been described in details in the following open-access +paper: https://doi.org/10.3389/fninf.2017.00027. With NeuroCurator, annotations are: - traceable, @@ -20,74 +20,78 @@ With NeuroCurator, annotations are: --- -## Getting started +## Getting Started -Install the [requirements](#requirements). +**Requirements:** -Download the packaged executable of the [latest release](https://github.com/BlueBrain/neurocurator/releases/latest). +System side: -Launch NeuroCurator: -``` -./neurocurator___x64 -``` -(in the folder where you downloaded the file) - -## Releases - -In the [dedicated section](https://github.com/BlueBrain/neurocurator/releases/), you can find: -- the latest version, -- the notable changes of each version, -- the packaged executables for macOS and Ubuntu. - -## Status - -Created during 2016. - -Ongoing reengineering in the branch _refactor-architecture_. - -The branch _refactor-architecture_ is **not** intended to be used by end-users. - -New features, bug fixes and improvements are done on the reengineered code sections. +- [Git 1.7.0+](https://git-scm.com/downloads) +- [ImageMagick 6](http://docs.wand-py.org/en/latest/guide/install.html) +- [Python 3.4*](https://www.python.org/downloads/) +- [Qt 4.8.7*](https://doc.qt.io/archives/qt-4.8/supported-platforms.html) +- [Miniconda*](https://conda.io/miniconda.html) -When a reengineered code section is stable, it's merged into the branch _master_ and a release is published. +Python side: -## Requirements +- [NAT](https://github.com/BlueBrain/nat) +- [PySide 1.2.4](https://wiki.qt.io/PySide) +- [NumPy](http://www.numpy.org) +- [pandas](https://pandas.pydata.org) +- [Wand](http://docs.wand-py.org) -### macOS +*Miniconda is not required. It simplifies only temporary the installation: +no need to compile Qt and to install manually Python 3.4. -Work on El Capitan (10.11.x) and higher. +**Installation:** -The packaged executable needs [Git](https://git-scm.com) and [ImageMagick](https://www.imagemagick.org) **6**. - -ImageMagick 6 can be installed with [Homebrew](https://brew.sh): -``` -brew install imagemagick@6 -brew link imagemagick@6 --force +Create a virtual environment with Python 3.4: +```bash +conda create -y --name nc python=3.4 ``` -Git can also be installed with Homebrew: +Switch to the virtual environment: +```bash +source activate nc ``` -brew install git + +Install PySide 1.2.4 and Qt 4.8.7 from [conda-forge](https://conda-forge.org): +```bash +conda install -y pyside --channel conda-forge ``` -You might require to allow execution: +Install NeuroCurator: +```bash +pip install nat +pip install neurocurator --no-deps ``` -sudo chmod u+x neurocurator__mac_x64 + +Launch NeuroCurator: +```bash +neurocurator ``` -### Ubuntu +For the future uses: +1. enter the virtual environment: `source activate nc` +2. launch NeuroCurator: `neurocurator` +3. use NeuroCurator +4. close NeuroCurator +5. exit the virtual environment: `source deactivate` -Should work on 16.04.x LTS (Xenial) and higher, and also on other Debian-based distributions. +## Releases -The packaged executable needs [Git](https://git-scm.com): -``` -sudo apt install git -``` +Versions and their notable changes are listed in the +[releases section](https://github.com/BlueBrain/neurocurator/releases/). + +## Status -## Packaging +Created during 2016. -The code from the branch _master_ of NeuroCurator and [NAT](https://github.com/BlueBrain/nat) is used. +Ongoing stabilization and reengineering in the branch _refactor-architecture_. -The packaged executables of NeuroCurator are created on up-to-date 64 bits OS X El Capitan and Ubuntu 16.04 LTS systems. +The branch _refactor-architecture_ is **not** intended to be used by end-users. + +New features, bug fixes and improvements are done on the reengineered code sections. -NeuroCurator's configuration is stored in a *settings.ini* file created alongside the executable. +When a reengineered code section is stable, it's merged into the branch +_master_ and a release is published. diff --git a/neurocurator/main.py b/neurocurator/__main__.py similarity index 88% rename from neurocurator/main.py rename to neurocurator/__main__.py index 3f2175e..1587b93 100755 --- a/neurocurator/main.py +++ b/neurocurator/__main__.py @@ -10,7 +10,7 @@ from neurocurator.mainWin import Window -if __name__ == '__main__': +def main(): app = QApplication(sys.argv) window = Window() # FIXME DEBUG. @@ -18,3 +18,7 @@ # /FIXME DEBUG. window.show() sys.exit(app.exec_()) + + +if __name__ == "__main__": + main() diff --git a/neurocurator/mainWin.py b/neurocurator/mainWin.py index 6b9a935..9f9ee40 100644 --- a/neurocurator/mainWin.py +++ b/neurocurator/mainWin.py @@ -24,7 +24,7 @@ from nat.restClient import RESTClient, RESTImportPDFErr from nat.tag import Tag from nat.utils import Id2FileName # , fileName2Id -from neurocurator import utils +from neurocurator.utils import package_directory from neurocurator.zotero_widget import ZoteroTableWidget from requests.exceptions import ConnectionError from .addOntoTermDlg import AddOntoTermDlg @@ -374,10 +374,10 @@ def setupWindowsUI(self) : # FIXME Delayed refactoring. Do settings management with QSettings. zotero_settings = self.settings.config["ZOTERO"] - work_dir = utils.working_directory() + directory = package_directory() # NB: Don't specify a parent for widgets to be added to a QTabWidget. - self.zotero_widget = ZoteroTableWidget(zotero_settings, work_dir, self.checkIdInDB, self.dbPath, self) + self.zotero_widget = ZoteroTableWidget(zotero_settings, directory, self.checkIdInDB, self.dbPath, self) self.zotero_widget.view.doubleClicked.connect(self.changeTagToAnnotations) diff --git a/neurocurator/settingsDlg.py b/neurocurator/settingsDlg.py index 5217ab4..55d2a41 100644 --- a/neurocurator/settingsDlg.py +++ b/neurocurator/settingsDlg.py @@ -7,7 +7,7 @@ from PySide import QtGui, QtCore -from neurocurator import utils +from neurocurator.utils import package_directory def getSettings(popDialog = False): @@ -29,7 +29,7 @@ def popDialogFct(): class Settings: - fileName = os.path.join(utils.working_directory(), 'settings.ini') + fileName = os.path.join(package_directory(), 'settings.ini') def __init__(self): self.config = configparser.ConfigParser() with open(Settings.fileName) as configfile: # Raise an exception if file does not exist @@ -114,7 +114,7 @@ def writeConfig(self): config = self.projectSettings.writeConfig(config) - with open(os.path.join(utils.working_directory(), 'settings.ini'), 'w') as configfile: + with open(os.path.join(package_directory(), 'settings.ini'), 'w') as configfile: config.write(configfile) self.accept() diff --git a/neurocurator/utils.py b/neurocurator/utils.py index bcb521b..121dc89 100644 --- a/neurocurator/utils.py +++ b/neurocurator/utils.py @@ -1,18 +1,14 @@ __author__ = "Pierre-Alexandre Fonta" import os -import sys from PySide.QtCore import Qt from PySide.QtGui import QFormLayout -def working_directory(): - """Return the working directory according to it being bundled/frozen.""" - if getattr(sys, 'frozen', False): - return os.path.dirname(sys.executable) - else: - return os.path.dirname(__file__) +def package_directory(): + """Return the absolute path to the directory containing the package files.""" + return os.path.abspath(os.path.dirname(__file__)) def configure_form_layout(form_layout): diff --git a/neurocurator/zotero_widget.py b/neurocurator/zotero_widget.py index a09e38b..f1d4d80 100644 --- a/neurocurator/zotero_widget.py +++ b/neurocurator/zotero_widget.py @@ -14,7 +14,7 @@ class ZoteroTableWidget(QWidget): - def __init__(self, settings, work_dir, check_id_fct, annotations_path, parent=None): + def __init__(self, settings, directory, check_id_fct, annotations_path, parent=None): super().__init__(parent) # FIXME Delayed refactoring of check_id_fct and annotations_path. @@ -23,7 +23,7 @@ def __init__(self, settings, work_dir, check_id_fct, annotations_path, parent=No library_id = settings["libraryID"] library_type = settings["libraryType"] api_key = settings["apiKey"] - self._zotero = ZoteroWrap(library_id, library_type, api_key, work_dir) + self._zotero = ZoteroWrap(library_id, library_type, api_key, directory) # Widgets section. diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b88034e..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[metadata] -description-file = README.md diff --git a/setup.py b/setup.py index feb37ca..442ea87 100644 --- a/setup.py +++ b/setup.py @@ -1,64 +1,59 @@ -from distutils.core import setup +__authors__ = ["Pierre-Alexandre Fonta", "Christian O'Reilly"] +__maintainer__ = "Pierre-Alexandre Fonta" + import os -PACKAGE = "neurocurator" -NAME = "neurocurator" -DESCRIPTION = open(os.path.join(os.path.dirname(__file__), "README.md")).read() -AUTHOR = "Christian O'Reilly, Pierre-Alexandre Fonta" -AUTHOR_EMAIL = "christian.oreilly@epfl.ch" -VERSION = "0.4.0" -REQUIRED = ["nat", "PySide", "numpy", "parse", "metapub", "pyzotero", "GitPython", - "biopython", "beautifulsoup4", "quantities", "wand", "scipy", "pandas"] +from setuptools import setup -def is_package(path): - return ( - os.path.isdir(path) and - os.path.isfile(os.path.join(path, '__init__.py')) - ) +VERSION = "0.4.1" -def find_packages(path, base=""): - """ Find all packages in path """ - packages = {} - for item in os.listdir(path): - dir = os.path.join(path, item) - if is_package( dir ): - if base: - module_name = "%(base)s.%(item)s" % vars() - else: - module_name = item - packages[module_name] = dir - packages.update(find_packages(dir, module_name)) - return packages +HERE = os.path.abspath(os.path.dirname(__file__)) -packages=find_packages(".") +# Get the long description from the README file. +# Convert to rst with: pandoc --from=markdown --to=rst README.md -o README.rst. +with open(os.path.join(HERE, "README.rst"), encoding="utf-8") as f: + long_description = f.read() setup( - name=NAME, - packages=packages.keys(), - package_dir=packages, - version=VERSION, - description=DESCRIPTION, - long_description=DESCRIPTION, #open("README.txt").read(), - author=AUTHOR, - author_email=AUTHOR_EMAIL, - maintainer=AUTHOR, - maintainer_email=AUTHOR_EMAIL, - license='LICENSE.txt', - requires=REQUIRED, - install_requires=REQUIRED, - url="https://github.com/christian-oreilly/neurocurator", - classifiers=["Development Status :: 3 - Alpha", - "Environment :: MacOS X", #"Environment :: Win32 (MS Windows)", - "Environment :: X11 Applications", - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - "License :: Free for non-commercial use", - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - "Natural Language :: English", - "Programming Language :: Python :: 3.4", - "Topic :: Scientific/Engineering"]) - - - - - + name="neurocurator", + version=VERSION, + description="Application to perform curation of neuroscientific literature.", + long_description=long_description, + keywords="neuroscience annotation curation literature modeling parameters", + url="https://github.com/BlueBrain/neurocurator", + author="Christian O'Reilly, Pierre-Alexandre Fonta", + author_email="christian.oreilly@epfl.ch, pierre-alexandre.fonta@epfl.ch", + # NB: 'If maintainer is provided, distutils lists it as the author in PKG-INFO'. + # https://docs.python.org/3/distutils/setupscript.html#meta-data + # maintainer="Pierre-Alexandre Fonta", + # maintainer_email="pierre-alexandre@epfl.ch", + license="GPLv3", + packages=["neurocurator"], + python_requires="~=3.4.0", # Until #6 is solved. + install_requires=[ + "nat==" + VERSION, + "pyside", + "numpy", + "pandas", + "wand" + ], + data_files=[("", ["LICENSE.txt"])], + entry_points={ + # NB: gui_scripts: on Windows no console is attached (no stdout/stderr). + "console_scripts": ["neurocurator = neurocurator.__main__:main"] + }, + classifiers=[ + "Development Status :: 3 - Alpha", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering", + "Environment :: X11 Applications :: Qt", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "License :: Free for non-commercial use", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.4", + "Operating System :: MacOS", + "Operating System :: POSIX :: Linux", + "Operating System :: Microsoft :: Windows", + "Natural Language :: English" + ] +) diff --git a/upload2pypi.sh b/upload2pypi.sh deleted file mode 100644 index 69dd71e..0000000 --- a/upload2pypi.sh +++ /dev/null @@ -1 +0,0 @@ -python3 setup.py register sdist upload -r pypi \ No newline at end of file