Skip to content

Commit 6a6c641

Browse files
authored
Feature update deprecation notes (#437)
* Bump version to 3.0.0-dev and update deprecation notes * Update changelog with message changes * Split installation requirements onto own line
1 parent c37420d commit 6a6c641

10 files changed

Lines changed: 36 additions & 29 deletions

File tree

CHANGELOG.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Version 2.3.0
1+
Version 3.0.0
22
====
33

44
Major features
@@ -18,6 +18,8 @@ Major features
1818
Breaking changes
1919
----------------
2020

21+
- Interfaces should no longer override `send_periodic` and instead implement
22+
`_send_periodic_internal` #426
2123
- writing to closed writers is not supported any more (it was supported only for some)
2224
- the method `Listener.on_message_received()` is now abstract (using `@abc.abstractmethod`)
2325
- the file in the reader/writer is now always stored in the attribute uniformly called `file`, and not in
@@ -28,6 +30,11 @@ Breaking changes
2830
Other notable changes
2931
---------------------
3032

33+
* can.Message class updated #413
34+
- Addition of a Message.equals method.
35+
- Deprecate id_type in favor of is_extended_id
36+
- documentation, testing and example updates
37+
- Addition of support for various builtins: __repr__, __slots__, __copy__
3138
* IO module updates to bring consistency to the different CAN message writers and readers. #348
3239
- context manager support for all readers and writers
3340
- they share a common super class called `BaseIOHandler`
@@ -112,7 +119,7 @@ Version 2.2.0 (2018-06-30)
112119
* Added synchronized (thread-safe) Bus variant.
113120
* context manager support for the Bus class.
114121
* Dropped support for Python 3.3 (officially reached end-of-life in Sept. 2017)
115-
* Deprecated the old `CAN` module, please use the newer `can` entry point (will be removed in version 2.4)
122+
* Deprecated the old `CAN` module, please use the newer `can` entry point (will be removed in an upcoming major version)
116123

117124
Version 2.1.0 (2018-02-17)
118125
=====

can/CAN.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
This module was once the core of python-can, containing
55
implementations of all the major classes in the library, now
66
however all functionality has been refactored out. This API
7-
is left intact for version 2.0 to 2.3 to aide with migration.
7+
is left intact for version 2.x to aide with migration.
88
99
WARNING:
10-
This module is deprecated an will get removed in version 2.4.
10+
This module is deprecated an will get removed in version 3.x.
1111
Please use ``import can`` instead.
1212
"""
1313

@@ -18,14 +18,12 @@
1818
from can.util import set_logging_level
1919
from can.io import *
2020

21-
import logging
22-
23-
log = logging.getLogger('can')
21+
import warnings
2422

2523
# See #267.
2624
# Version 2.0 - 2.1: Log a Debug message
2725
# Version 2.2: Log a Warning
28-
# Version 2.3: Log an Error
29-
# Version 2.4: Remove the module
30-
log.error('Loading python-can via the old "CAN" API is deprecated since v2.0 an will get removed in v2.4. '
31-
'Please use `import can` instead.')
26+
# Version 3.x: DeprecationWarning
27+
# Version 4.0: Remove the module
28+
warnings.warn('Loading python-can via the old "CAN" API is deprecated since v3.0 an will get removed in v4.0 '
29+
'Please use `import can` instead.', DeprecationWarning)

can/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import logging
1010

11-
__version__ = "2.3.0-dev"
11+
__version__ = "3.0.0-dev"
1212

1313
log = logging.getLogger('can')
1414

can/broadcastmanager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import logging
1212
import threading
1313
import time
14-
14+
import warnings
1515

1616
log = logging.getLogger('can.bcm')
1717

@@ -153,6 +153,6 @@ def send_periodic(bus, message, period, *args, **kwargs):
153153
:param float period: The minimum time between sending messages.
154154
:return: A started task instance
155155
"""
156-
log.warning("The function `can.send_periodic` is deprecated and will " +
157-
"be removed in version 3.0. Please use `can.Bus.send_periodic` instead.")
156+
warnings.warn("The function `can.send_periodic` is deprecated and will " +
157+
"be removed in an upcoming version. Please use `can.Bus.send_periodic` instead.", DeprecationWarning)
158158
return bus.send_periodic(message, period, *args, **kwargs)

can/interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
if 'linux' in sys.platform:
2323
# Deprecated and undocumented access to SocketCAN cyclic tasks
24-
# Will be removed in version 3.0
24+
# Will be removed in version 4.0
2525
from can.interfaces.socketcan import CyclicSendTask, MultiRateCyclicSendTask
2626

2727
# Required by "detect_available_configs" for argument interpretation

can/interfaces/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
Interfaces contain low level implementations that interact with CAN hardware.
55
"""
66

7-
import logging
8-
7+
import warnings
98
from pkg_resources import iter_entry_points
109

11-
logger = logging.getLogger(__name__)
1210

1311
# interface_name => (module, classname)
1412
BACKENDS = {
@@ -31,10 +29,10 @@
3129
for interface in iter_entry_points('can.interface')
3230
})
3331

34-
# Old entry point name. May be removed in 3.0.
32+
# Old entry point name. May be removed >3.0.
3533
for interface in iter_entry_points('python_can.interface'):
3634
BACKENDS[interface.name] = (interface.module_name, interface.attrs[0])
37-
logger.warning('%s is using the deprecated python_can.interface entry point. '
38-
'Please change to can.interface instead.', interface.name)
35+
warnings.warn('{} is using the deprecated python_can.interface entry point. '.format(interface.name) +
36+
'Please change to can.interface instead.', DeprecationWarning)
3937

4038
VALID_INTERFACES = frozenset(list(BACKENDS.keys()) + ['socketcan_native', 'socketcan_ctypes'])

can/util.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import platform
1313
import re
1414
import logging
15+
import warnings
16+
1517
try:
1618
from configparser import ConfigParser
1719
except ImportError:
@@ -184,11 +186,11 @@ def load_config(path=None, config=None, context=None):
184186
if key not in config:
185187
config[key] = None
186188

187-
# deprecated socketcan types
189+
# Handle deprecated socketcan types
188190
if config['interface'] in ('socketcan_native', 'socketcan_ctypes'):
189-
# Change this to a DeprecationWarning in future 2.x releases
190-
# Remove completely in 3.0
191-
log.warning('%s is deprecated, use socketcan instead', config['interface'])
191+
# DeprecationWarning in 3.x releases
192+
# TODO: Remove completely in 4.0
193+
warnings.warn('{} is deprecated, use socketcan instead'.format(config['interface']), DeprecationWarning)
192194
config['interface'] = 'socketcan'
193195

194196
if config['interface'] not in VALID_INTERFACES:

doc/bcm.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Functional API
4949

5050
.. warning::
5151
The functional API in :func:`can.broadcastmanager.send_periodic` is now deprecated
52-
and will be removed in version 3.0.
52+
and will be removed in version 4.0.
5353
Use the object oriented API via :meth:`can.BusABC.send_periodic` instead.
5454

5555
.. autofunction:: can.broadcastmanager.send_periodic

doc/interfaces/socketcan.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The full documentation for socketcan can be found in the kernel docs at
1010
Versions before 2.2 had two different implementations named
1111
``socketcan_ctypes`` and ``socketcan_native``. These are now
1212
deprecated and the aliases to ``socketcan`` will be removed in
13-
version 3.0. Future 2.x release may raise a DeprecationWarning.
13+
version 4.0. 3.x releases raise a DeprecationWarning.
1414

1515

1616
Socketcan Quickstart

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@
9999
# see https://www.python.org/dev/peps/pep-0345/#version-specifiers
100100
python_requires=">=2.7,!=3.0,!=3.1,!=3.2,!=3.3",
101101
install_requires=[
102-
'wrapt~=1.10', 'typing', 'windows-curses;platform_system=="Windows"',
102+
'wrapt~=1.10',
103+
'typing',
104+
'windows-curses;platform_system=="Windows"',
103105
],
104106
extras_require=extras_require,
105107

0 commit comments

Comments
 (0)