Skip to content

Commit a8d0fb1

Browse files
committed
Revert "update docs (hardbyte#1421)"
This reverts commit d3103d8.
1 parent 6cfed6b commit a8d0fb1

File tree

17 files changed

+85
-170
lines changed

17 files changed

+85
-170
lines changed

can/interface.py

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -60,44 +60,37 @@ class Bus(BusABC): # pylint: disable=abstract-method
6060
6161
Instantiates a CAN Bus of the given ``interface``, falls back to reading a
6262
configuration file from default locations.
63+
"""
6364

64-
:param channel:
65-
Channel identification. Expected type is backend dependent.
66-
Set to ``None`` to let it be resolved automatically from the default
67-
:ref:`configuration`.
65+
@staticmethod
66+
def __new__( # type: ignore # pylint: disable=keyword-arg-before-vararg
67+
cls: Any, channel: Optional[Channel] = None, *args: Any, **kwargs: Any
68+
) -> BusABC:
69+
"""
70+
Takes the same arguments as :class:`can.BusABC.__init__`.
71+
Some might have a special meaning, see below.
6872
69-
:param interface:
70-
See :ref:`interface names` for a list of supported interfaces.
71-
Set to ``None`` to let it be resolved automatically from the default
72-
:ref:`configuration`.
73+
:param channel:
74+
Set to ``None`` to let it be resolved automatically from the default
75+
configuration. That might fail, see below.
7376
74-
:param args:
75-
``interface`` specific positional arguments.
77+
Expected type is backend dependent.
7678
77-
:param kwargs:
78-
``interface`` specific keyword arguments.
79+
:param dict kwargs:
80+
Should contain an ``interface`` key with a valid interface name. If not,
81+
it is completed using :meth:`can.util.load_config`.
7982
80-
:raises ~can.exceptions.CanInterfaceNotImplementedError:
81-
if the ``interface`` isn't recognized or cannot be loaded
83+
:raises: can.CanInterfaceNotImplementedError
84+
if the ``interface`` isn't recognized or cannot be loaded
8285
83-
:raises ~can.exceptions.CanInitializationError:
84-
if the bus cannot be instantiated
86+
:raises: can.CanInitializationError
87+
if the bus cannot be instantiated
8588
86-
:raises ValueError:
87-
if the ``channel`` could not be determined
88-
"""
89+
:raises: ValueError
90+
if the ``channel`` could not be determined
91+
"""
8992

90-
@staticmethod
91-
def __new__( # type: ignore # pylint: disable=keyword-arg-before-vararg
92-
cls: Any,
93-
channel: Optional[Channel] = None,
94-
interface: Optional[str] = None,
95-
*args: Any,
96-
**kwargs: Any,
97-
) -> BusABC:
9893
# figure out the rest of the configuration; this might raise an error
99-
if interface is not None:
100-
kwargs["interface"] = interface
10194
if channel is not None:
10295
kwargs["channel"] = channel
10396
if "context" in kwargs:

can/interfaces/cantact.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(
5959
Bitrate in bits/s
6060
:param bool monitor:
6161
If true, operate in listen-only monitoring mode
62-
:param BitTiming bit_timing:
62+
:param BitTiming bit_timing
6363
Optional BitTiming to use for custom bit timing setting. Overrides bitrate if not None.
6464
"""
6565

doc/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Library API
22
===========
33

4-
The main objects are the :class:`~can.Bus` and the :class:`~can.Message`.
4+
The main objects are the :class:`~can.BusABC` and the :class:`~can.Message`.
55
A form of CAN interface is also required.
66

77
.. hint::

doc/bus.rst

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,24 @@ and implements the :class:`~can.BusABC` API.
1515

1616
A thread safe bus wrapper is also available, see `Thread safe bus`_.
1717

18+
Autoconfig Bus
19+
''''''''''''''
20+
1821
.. autoclass:: can.Bus
19-
:class-doc-from: class
20-
:show-inheritance:
2122
:members:
22-
:inherited-members:
23+
24+
25+
API
26+
'''
27+
28+
.. autoclass:: can.BusABC
29+
:members:
30+
31+
.. automethod:: __iter__
32+
.. automethod:: _recv_internal
33+
.. automethod:: _apply_filters
34+
.. automethod:: _detect_available_configs
35+
.. automethod:: _send_periodic_internal
2336

2437
.. autoclass:: can.bus.BusState
2538
:members:
@@ -68,7 +81,7 @@ Example defining two filters, one to pass 11-bit ID ``0x451``, the other to pass
6881
See :meth:`~can.BusABC.set_filters` for the implementation.
6982

7083
Thread safe bus
71-
'''''''''''''''
84+
---------------
7285

7386
This thread safe version of the :class:`~can.BusABC` class can be used by multiple threads at once.
7487
Sending and receiving is locked separately to avoid unnecessary delays.

doc/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"sphinx.ext.viewcode",
4949
"sphinx.ext.graphviz",
5050
"sphinxcontrib.programoutput",
51-
"sphinx_inline_tabs",
5251
"sphinx_rtd_theme",
5352
]
5453

doc/configuration.rst

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
.. _configuration:
2-
31
Configuration
42
=============
53

@@ -102,7 +100,6 @@ For example:
102100

103101
``CAN_INTERFACE=socketcan CAN_CONFIG={"receive_own_messages": true, "fd": true}``
104102

105-
.. _interface names:
106103

107104
Interface Names
108105
---------------
@@ -112,51 +109,31 @@ Lookup table of interface names:
112109
+---------------------+-------------------------------------+
113110
| Name | Documentation |
114111
+=====================+=====================================+
115-
| ``"canalystii"`` | :doc:`interfaces/canalystii` |
116-
+---------------------+-------------------------------------+
117-
| ``"cantact"`` | :doc:`interfaces/cantact` |
112+
| ``"socketcan"`` | :doc:`interfaces/socketcan` |
118113
+---------------------+-------------------------------------+
119-
| ``"etas"`` | :doc:`interfaces/etas` |
114+
| ``"kvaser"`` | :doc:`interfaces/kvaser` |
120115
+---------------------+-------------------------------------+
121-
| ``"gs_usb"`` | :doc:`interfaces/gs_usb` |
116+
| ``"serial"`` | :doc:`interfaces/serial` |
122117
+---------------------+-------------------------------------+
123-
| ``"iscan"`` | :doc:`interfaces/iscan` |
118+
| ``"slcan"`` | :doc:`interfaces/slcan` |
124119
+---------------------+-------------------------------------+
125120
| ``"ixxat"`` | :doc:`interfaces/ixxat` |
126121
+---------------------+-------------------------------------+
127-
| ``"kvaser"`` | :doc:`interfaces/kvaser` |
128-
+---------------------+-------------------------------------+
129-
| ``"neousys"`` | :doc:`interfaces/neousys` |
122+
| ``"pcan"`` | :doc:`interfaces/pcan` |
130123
+---------------------+-------------------------------------+
131-
| ``"neovi"`` | :doc:`interfaces/neovi` |
124+
| ``"usb2can"`` | :doc:`interfaces/usb2can` |
132125
+---------------------+-------------------------------------+
133126
| ``"nican"`` | :doc:`interfaces/nican` |
134127
+---------------------+-------------------------------------+
135-
| ``"nixnet"`` | :doc:`interfaces/nixnet` |
136-
+---------------------+-------------------------------------+
137-
| ``"pcan"`` | :doc:`interfaces/pcan` |
138-
+---------------------+-------------------------------------+
139-
| ``"robotell"`` | :doc:`interfaces/robotell` |
140-
+---------------------+-------------------------------------+
141-
| ``"seeedstudio"`` | :doc:`interfaces/seeedstudio` |
128+
| ``"iscan"`` | :doc:`interfaces/iscan` |
142129
+---------------------+-------------------------------------+
143-
| ``"serial"`` | :doc:`interfaces/serial` |
130+
| ``"neovi"`` | :doc:`interfaces/neovi` |
144131
+---------------------+-------------------------------------+
145-
| ``"slcan"`` | :doc:`interfaces/slcan` |
132+
| ``"vector"`` | :doc:`interfaces/vector` |
146133
+---------------------+-------------------------------------+
147-
| ``"socketcan"`` | :doc:`interfaces/socketcan` |
134+
| ``"virtual"`` | :doc:`interfaces/virtual` |
148135
+---------------------+-------------------------------------+
149-
| ``"socketcand"`` | :doc:`interfaces/socketcand` |
136+
| ``"canalystii"`` | :doc:`interfaces/canalystii` |
150137
+---------------------+-------------------------------------+
151138
| ``"systec"`` | :doc:`interfaces/systec` |
152139
+---------------------+-------------------------------------+
153-
| ``"udp_multicast"`` | :doc:`interfaces/udp_multicast` |
154-
+---------------------+-------------------------------------+
155-
| ``"usb2can"`` | :doc:`interfaces/usb2can` |
156-
+---------------------+-------------------------------------+
157-
| ``"vector"`` | :doc:`interfaces/vector` |
158-
+---------------------+-------------------------------------+
159-
| ``"virtual"`` | :doc:`interfaces/virtual` |
160-
+---------------------+-------------------------------------+
161-
162-
Additional interface types can be added via the :ref:`plugin interface`.

doc/development.rst

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@ The following assumes that the commands are executed from the root of the reposi
3535

3636
The project can be built with::
3737

38-
pipx run build
39-
pipx run twine check dist/*
38+
pip install wheel
39+
python setup.py sdist bdist_wheel
4040

4141
The project can be installed in editable mode with::
4242

4343
pip install -e .
4444

4545
The unit tests can be run with::
4646

47-
pipx run tox -e py
47+
pip install tox
48+
tox -e py
4849

4950
The documentation can be built with::
5051

@@ -78,11 +79,6 @@ These steps are a guideline on how to add a new backend to python-can.
7879
To get started, have a look at ``back2back_test.py``:
7980
Simply add a test case like ``BasicTestSocketCan`` and some basic tests will be executed for the new interface.
8081

81-
.. attention::
82-
We strongly recommend using the :ref:`plugin interface` to extend python-can.
83-
Publish a python package that contains your :class:`can.BusABC` subclass and use
84-
it within the python-can API. We will mention your package inside this documentation
85-
and add it as an optional dependency.
8682

8783
Code Structure
8884
--------------

doc/doc-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
sphinx>=5.2.3
22
sphinxcontrib-programoutput
33
sphinx_rtd_theme
4-
sphinx-inline-tabs

doc/interfaces.rst

Lines changed: 11 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
.. _can interface modules:
2-
31
CAN Interface Modules
42
---------------------
53

@@ -14,13 +12,11 @@ The available interfaces are:
1412
:maxdepth: 1
1513

1614
interfaces/canalystii
17-
interfaces/cantact
1815
interfaces/etas
1916
interfaces/gs_usb
2017
interfaces/iscan
2118
interfaces/ixxat
2219
interfaces/kvaser
23-
interfaces/neousys
2420
interfaces/neovi
2521
interfaces/nican
2622
interfaces/nixnet
@@ -37,58 +33,19 @@ The available interfaces are:
3733
interfaces/vector
3834
interfaces/virtual
3935

40-
The *Interface Names* are listed in :doc:`configuration`.
41-
42-
43-
.. _plugin interface:
44-
45-
Plugin Interface
46-
^^^^^^^^^^^^^^^^
47-
48-
External packages can register a new interfaces by using the ``can.interface`` entry point
49-
in its project configuration. The format of the entry point depends on your project
50-
configuration format (*pyproject.toml*, *setup.cfg* or *setup.py*).
51-
52-
In the following example ``module`` defines the location of your bus class inside your
53-
package e.g. ``my_package.subpackage.bus_module`` and ``classname`` is the name of
54-
your :class:`can.BusABC` subclass.
55-
56-
.. tab:: pyproject.toml (PEP 621)
57-
58-
.. code-block:: toml
36+
Additional interfaces can be added via a plugin interface. An external package
37+
can register a new interface by using the ``can.interface`` entry point in its setup.py.
5938

60-
# Note the quotes around can.interface in order to escape the dot .
61-
[project.entry-points."can.interface"]
62-
interface_name = "module:classname"
39+
The format of the entry point is ``interface_name=module:classname`` where
40+
``classname`` is a concrete :class:`can.BusABC` implementation.
6341

64-
.. tab:: setup.cfg
42+
::
6543

66-
.. code-block:: ini
44+
entry_points={
45+
'can.interface': [
46+
"interface_name=module:classname",
47+
]
48+
},
6749

68-
[options.entry_points]
69-
can.interface =
70-
interface_name = module:classname
7150

72-
.. tab:: setup.py
73-
74-
.. code-block:: python
75-
76-
from setuptools import setup
77-
78-
setup(
79-
# ...,
80-
entry_points = {
81-
'can.interface': [
82-
'interface_name = module:classname'
83-
]
84-
}
85-
)
86-
87-
The ``interface_name`` can be used to
88-
create an instance of the bus in the **python-can** API:
89-
90-
.. code-block:: python
91-
92-
import can
93-
94-
bus = can.Bus(interface="interface_name", channel=0)
51+
The *Interface Names* are listed in :doc:`configuration`.

doc/interfaces/cantact.rst

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)