Skip to content

Commit

Permalink
Merge pull request #165 from Exopy/tasks-docs
Browse files Browse the repository at this point in the history
docs: clarify perform vs perform_ in the docs and remove Python 2 men…
  • Loading branch information
MatthieuDartiailh committed Dec 5, 2019
2 parents 2f6d9bd + 95eaa4c commit 0fe3eb9
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 29 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -12,6 +12,7 @@ matrix:
include:
- env: PYTHON=3.5 CONDA_PY=35 QT_VERSION=5
- env: PYTHON=3.6 CONDA_PY=36 QT_VERSION=5
- env: PYTHON=3.7 CONDA_PY=37 QT_VERSION=5

before_install:

Expand Down
1 change: 0 additions & 1 deletion docs/source/dev_guide/style_guide.rst
Expand Up @@ -97,7 +97,6 @@ Imports should be at the top of the file (after the module docstring) save in
special cases. They should be group as follow (each group separated from the
following by a blank line) :

- special imports for Python 2/3 compatibility
- standard library imports
- third parties libraries imports
- relative imports
Expand Down
10 changes: 6 additions & 4 deletions docs/source/dev_guide/tasks.rst
Expand Up @@ -44,12 +44,12 @@ otherwise you can specify the function to use to serialize/desarialize should
be passed as a tuple/list.

If a parameter value can depend on values stored in the database, it should be
declared as a Unicode member to let the user enter a formula ('{' and '}' are
declared as a Str member to let the user enter a formula ('{' and '}' are
used to identify the part to replace with the value stored in the database).

.. code-block:: python
from atom.api import Unicode, Int
from atom.api import Str, Int
class MyTask(SimpleTask):
"""MyTask description.
Expand Down Expand Up @@ -87,8 +87,10 @@ The actual description of what the task is meant to do is contained in the
interfaceable task see next section). This method take either no argument, or a
single keyword argument if it can be used inside a loop in which case the
argument will be the current value of the loop. If subclassing |ComplexTask|
be sure to call the perform methods of all children tasks (stored in the
`children` member). Below is a list of some useful methods :
be sure to call the `perform_` methods of all children tasks (stored in the
``children`` member). Note the trailing ``_`` in ``perform_``, which denotes that
``perform`` has been properly wrapped to handle parallelism and synchornisation.
Below is a list of some useful methods :

- |write_in_database|: is used to write a value in the database. In the
database, values are stored according to the path to the task and its name,
Expand Down
14 changes: 7 additions & 7 deletions docs/source/user_guide/installation.rst
Expand Up @@ -6,7 +6,7 @@ Installation
Compatibility
-------------

Exopy is compatible with Python 2.7 and 3.4 or later.
Exopy is compatible with Python 3.4 or later.

Linux, Windows and OSX should all work as long as Qt 4 or Qt 5 is supported
by the platform.
Expand All @@ -28,10 +28,10 @@ Once you have conda installed, just type::
or::

$ conda update -c exopy exopy

.. note::

The -c option select the exopy channel on <http://anaconda.org> as Exopy is
The -c option select the exopy channel on <http://anaconda.org> as Exopy is
not part of the standard Python stack.

Installing from source
Expand All @@ -42,21 +42,21 @@ source, to do so just use :

$ pip install https://github.com/Exopy/exopy/tarball/master

The dependencies of Exopy however can be more cumbersome to install. You can
The dependencies of Exopy however can be more cumbersome to install. You can
find the list in the setup.py script at the root of the Exopy repository.

Checking your installation
--------------------------

You should then be able to start exopy using the exopy command in a command
line or the launcher present in the Anaconda Launcher if you are using
line or the launcher present in the Anaconda Launcher if you are using
Anaconda.

In case this does not work you can run the application from the command line
In case this does not work you can run the application from the command line
using:

$ python -m exopy -s

This allows to display the error log directly in the console which should allow
you to track down the origin of the issue.

11 changes: 3 additions & 8 deletions exopy/app/preferences/manifest.enaml
Expand Up @@ -95,14 +95,9 @@ def check_app_folder(workbench, cmd_args):
if (not os.path.isfile(app_dir) or
'app_path' not in ConfigObj(app_dir, encoding='utf-8') or
getattr(cmd_args, 'reset_app_folder', None)):
path = ''
try:
# Explicit casting to detect encoding issues.
path = str(os.path.expanduser(os.path.join('~', 'exopy')))
except Exception:
# Silently ignore issues on Python 2 when userpath contains
# non-ascii characters.
pass

# Explicit casting to detect encoding issues.
path = str(os.path.expanduser(os.path.join('~', 'exopy')))
dial = AppDirSelectionDialog(path=path)
if not dial.exec_():
sys.exit(1)
Expand Down
10 changes: 3 additions & 7 deletions exopy/app/states/plugin.py
Expand Up @@ -124,16 +124,12 @@ def _build_state(self, state_id):
"""
state = self._states.contributions[state_id]

# Explicit casting required as Python 2 does not like Unicode for class
# name
class_name = str(''.join([s.capitalize()
for s in state_id.split('.')]))
# Create the class name
class_name = ''.join([s.capitalize() for s in state_id.split('.')])

members = {}
# Explicit casting required as Python 2 does not like Unicode for
# members name
for m in state.sync_members:
members[str(m)] = Value()
members[m] = Value()
state_class = type(class_name, (_StateHolder,), members)

# Instantiation , initialisation, and binding of the state object to
Expand Down
2 changes: 1 addition & 1 deletion exopy/tasks/tasks/task_interface.py
Expand Up @@ -409,5 +409,5 @@ def _post_setattr_parent(self, old, new):
self.interface_id = self.parent.interface_id + ':' + i_id
else:
self.interface_id = i_id
task_member = self.get_member(str('task')) # Python 2, Atom 0.x compat
task_member = self.get_member('task')
task_member.reset(self)
2 changes: 1 addition & 1 deletion exopy/utils/plugin_tools.py
Expand Up @@ -59,7 +59,7 @@ def handler(event):
pl = event.workbench.get_plugin(id)
return getattr(pl, method_name)(**event.parameters)

handler.__name__ += str('_' + method_name) # Python 2 needs a bytes string
handler.__name__ += '_' + method_name
return handler


Expand Down

0 comments on commit 0fe3eb9

Please sign in to comment.