Releases: enthought/traits-futures
Traits Futures 0.3.1
This is a bugfix release which fixes a regression introduced in Traits Futures 0.3.0, namely that subclasses of BaseFuture
could not be instantiated without any arguments.
Traits Futures 0.3.0
This is a feature release of Traits Futures, with a some minor backwards incompatible changes that users should be aware of. New features include multiprocessing support, wxPython support, support for delivering events using an asyncio
event loop in place of a GUI toolkit event loop, and better support for synchronous executor shutdown.
Migration guide
The majority of existing code using Traits Futures 0.2.0 should continue to work with Traits Futures 0.3.0 with no changes. However, there are some minor changes that could affect current code, and some major backwards-incompatible changes for anyone making use of the ITaskSpecification
interface to create their own background task types. For the ITaskSpecification
changes, see the detailed changelog in the documentation.
- The
cancel
method on a future no longer raise aRuntimeError
exception when a future is not cancellable; instead, it silently does nothing. Code that needs to distinguish can use the new return value of thecancel
method to determine whether thecancel
call actually caused cancellation to occur. Code that currently checks thecancellable
property before cancelling should be able to safely drop that check. - The
executor_state
trait of a |TraitsExecutor| is no longer writable. - The
executor
andcallable
parameters to thesubmit_call
,submit_iteration
andsubmit_progress
functions may become positional-only in a future version of Traits Futures. If you're passing arguments by name instead of by position, for example usingsubmit_call(executor=my_executor, callable=do_calculation, ...)
, you should fix your code to pass by position instead:submit_call(my_executor, do_calculation, ...)
.
See the changelog in the documentation for a full list of changes.
Traits Futures 0.2.0
This is a feature release of Traits Futures. The main features of this
release are:
- Improved support for user-defined background task types.
- Easier creation of background calculations that can be (cooperatively)
cancelled mid-calculation. - Significant internal refactoring and cleanup, aimed at eventual support
for alternative front ends (GUI event loops other than the Qt event
loop) and back ends (e.g., multiprocessing). - Improved and expanded documentation.
There are no immediately API-breaking changes in this release: existing working
code using Traits Futures 0.1.1 should continue to work with no changes
required. However, some parts of the existing API have been deprecated, and
will be removed in a future release. See the Changes section below for more
details.
Detailed changes follow. Note that the list below is not exhaustive: many
more minor PRs have been omitted.
Features
- Users can now easily create their own background task types to supplement
the provided task types (background calls, background iterations and
background progress). A combination of a newITaskSpecification
interface and a convenienceBaseFuture
base class support this.
(#198) - The
submit_iteration
function now supports generator functions that
return a result. This provides an easy way to submit background computations
that can be cancelled mid-calculation. (#167) - The
TraitsExecutor
class now accepts amax_workers
argument,
which specifies the maximum number of workers for a worker pool created
by the executor. (#125) - There are new task submission functions
submit_call
,
submit_iteration
andsubmit_progress
. These functions replace
the eponymous existingTraitsExecutor
methods, which are now
deprecated. (#166) - There's a new
IFuture
interface class in the
traits_futures.api
module, to aid in typing and Trait declarations.
(#169) - A new
IParallelContext
interface supports eventual addition
of alternative back ends. The newMultithreadingContext
class
implements this interface and provides the default threading back-end.
(#149)
Changes
- The
state
trait onCallFuture
,IterationFuture
andProgressFuture
is
now read-only. It used to be writable. - The default number of workers in an owned worker pool (that is, a worker pool
created by aTraitsExecutor
) has changed. Previously it was
hard-coded as4
. Now it defaults to whatever Python's
concurrent.futures
executors give, but can be controlled by passing
themax_workers
argument. (#125) - The
submit_call
,submit_iteration
andsubmit_progress
methods on theTraitsExecutor
have been deprecated. Use the
submit_call
,submit_iteration
andsubmit_progress
convenience functions instead. (#159) - The
thread_pool
argument toTraitsExecutor
has been renamed
toworker_pool
. The original name is still available for backwards
compatibility, but its use is deprecated. (#144, #148) - Python 2.7 is no longer supported. Traits Futures requires Python >= 3.5,
and has been tested with Python 3.5 through Python 3.9. (#123, #130, #131,
#132, #133, #138, #145)
Fixes
- Don't create a new MessageRouter at executor shutdown time. (#187)
Tests
- Fix some intermittent test failures due to test interactions. (#176)
- The 'null' backend that's used for testing in the absence of a Qt backend
now uses aasyncio
-based event loop instead of a custom event loop.
(#107, #179) - Rewrite the Qt
GuiTestAssistant
to react rather than polling. This
significantly speeds up the test run. (#153) - Ensure that all tests properly stop the executors they create. (#108, #146)
- Refactor the test structure in preparation for multiprocessing
support. (#135, #141) - Test the
GuiTestAssistant
class. (#109)
Developer tooling
- Add a new
python -m ci shell
click cmd. (#204) - Update edm version in CI. (#205)
- Add checks for missing or malformed copyright headers in Python files (and
fix existing copyright headers). (#193) - Add import order checks (and fix existing import order bugs). (#161)
- Add separate "build" and "ci" modes for setting up the development
environment. (#104) - Don't pin dependent packages in the build environment. (#99)
Documentation
- Update docs to use the Enthought Sphinx Theme. (#128)
- Autogenerated API documentation is now included in the documentation
build. (#177, #181) - Restructure the documentation to avoid nesting 'User Guide'
under 'User Documentation'. (#191) - Document creation of new background task types. (#198)
- Document use of
submit_iteration
for interruptible tasks. (#188)