Skip to content

Add support for the mf4 io format #554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 43 commits into from
Sep 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
bee6d4d
add extra dependency
danielhrisca Feb 18, 2019
4c3d917
Merge branch 'develop' of https://github.com/hardbyte/python-can into…
danielhrisca Apr 14, 2019
1fc9bf2
add mf4 io writer
danielhrisca Apr 18, 2019
07c0a4c
Merge remote-tracking branch 'remotes/upstrem/develop' into mf4_io
danielhrisca Apr 18, 2019
ad33863
update asammdf requirement
danielhrisca Apr 18, 2019
b6f73af
add missing comma in setup.py
danielhrisca Apr 22, 2019
70f1be4
Merge branch 'develop' of https://github.com/hardbyte/python-can into…
danielhrisca Apr 22, 2019
26cd255
changes after initial review
danielhrisca Apr 22, 2019
74e8472
simplify append call
danielhrisca Apr 22, 2019
59c3db9
add MF4Reader class
danielhrisca Apr 22, 2019
efdfdc9
start testing
danielhrisca Apr 22, 2019
38d67ac
passes tests
danielhrisca Apr 22, 2019
a11440b
update documentation
danielhrisca Apr 22, 2019
b736542
update docs and CI scripts
danielhrisca Apr 23, 2019
c2db9f6
retrigger build
danielhrisca Apr 25, 2019
3953060
Merge branch 'develop' into mf4_io
felixdivo Apr 27, 2019
72469fc
Merge branch 'develop' into mf4_io
felixdivo Apr 30, 2019
ddbb985
Merge branch 'develop' of https://github.com/hardbyte/python-can into…
danielhrisca May 1, 2019
08cd68c
Merge branch 'develop' into mf4_io
felixdivo May 3, 2019
b1e7d5c
Merge branch 'develop' of https://github.com/hardbyte/python-can into…
danielhrisca May 6, 2019
2a2e77e
update setup.py according to review
danielhrisca May 6, 2019
a2937bb
Merge branch 'mf4_io' of https://github.com/danielhrisca/python-can i…
danielhrisca May 6, 2019
be0d168
remove debug save file
danielhrisca May 6, 2019
9f7e6b4
install and test mf4
danielhrisca May 6, 2019
2d74d3c
Merge branch 'develop' into mf4_io
felixdivo May 8, 2019
368c505
changes after review
danielhrisca May 12, 2019
afd20d7
Merge branch 'develop' into mf4_io
danielhrisca May 12, 2019
dff0f69
Merge branch 'develop' into mf4_io
felixdivo May 18, 2019
a8abbf0
updates after review
danielhrisca May 18, 2019
74b6c6f
Merge branch 'develop' into mf4_io
hardbyte May 19, 2019
8c60906
Merge branch 'develop' into mf4_io
felixdivo May 19, 2019
3be4d52
Merge branch 'develop' into mf4_io
felixdivo May 19, 2019
70614d9
Merge branch 'develop' into mf4_io
felixdivo May 20, 2019
29b293a
Merge branch 'develop' into mf4_io
felixdivo Jun 9, 2019
b155217
Merge branch 'develop' into mf4_io
felixdivo Jun 12, 2019
683f464
Merge branch 'develop' into mf4_io
felixdivo Jun 22, 2019
d70b2bf
Merge branch 'develop' of https://github.com/hardbyte/python-can into…
danielhrisca Jun 28, 2019
11ca866
Merge branch 'develop' into mf4_io
danielhrisca Jul 10, 2019
bb4813c
Merge branch 'develop' of https://github.com/hardbyte/python-can into…
danielhrisca Jul 10, 2019
c9a4a57
add cython requirement
danielhrisca Jul 10, 2019
3a3a7d9
Merge branch 'mf4_io' of https://github.com/danielhrisca/python-can i…
danielhrisca Jul 10, 2019
7085a3d
Merge branch 'develop' into mf4_io
felixdivo Jul 14, 2019
74a2759
Merge branch 'mf4-io' into mf4_io
felixdivo Sep 4, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ install:
- set PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%

# We need to install the python-can library itself including the dependencies
- "python -m pip install .[test,neovi]"
- "python -m pip install .[test,neovi,mf4]"

build: off

Expand Down
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ python:
# PyPy:
- pypy3

env:


install:
- if [[ "$TEST_SOCKETCAN" ]]; then sudo bash test/open_vcan.sh ; fi
- travis_retry pip install .[test]
- travis_retry pip install .[test,mf4]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is not the right way to configure the tests. Maybe we should simply not support the combination of MF4 & PyPy (as mentioned above). This could be done by only installing travis_retry pip install .[test] and instead changing setup.py to:

import platform
is_cpython = 'CPython' == platform.python_implementation()

tests_require = [
    'pytest~=4.3',
    'pytest-timeout~=1.3',
    'pytest-cov~=2.6',
    'codecov~=2.0',
    'six',
    'hypothesis'
] + extras_require['serial']

if is_cpython:
    tests_require += extras_require['mf4']

A very simple not in the docs should be added as well:
.. note:: *MF4* is currently only supported on CPython and not on PyPy.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.python.org/dev/peps/pep-0508/#environment-markers

'mf4; platform_python_implementation == "CPython"'

Maybe? Untested, but definitely want to get away from arbitrary code relating to setup. Also maybe != "PyPy" depending on intent.

Copy link
Collaborator

@felixdivo felixdivo Jun 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@altendky This does not seem to work on my machine: I get python-can 3.2.0 does not provide the extra 'mf4' on CPython 3.6. Removing the spaces did not help either.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielhrisca Sorry for the long delay. With the above change, this should be ready to finally be merged.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felixdivo, I think maybe I misread the code there. Sorry. The point is to document dependencies in a way that can be retrieved regardless of what Python is being used to run setup.py. For example, what I wrote (or something like it) can go into a wheel intact and be processed when the wheel is installed. if is_cpython: would be processed when the wheel is built and then when the wheel is used it would be fixed according to the Python used to create the wheel. This is also quite relevant to locking dependencies.

But... I was thinking at a different layer. I don't know that there's a tidy all around solution for this yet. Applying the environment markers to each dependency of the mf4 extra could make it a no-op at least and then it could be unconditionally (code-wise) included wherever. Maybe that's what I would do, I'm not quite sure.

It would be nice if the extra could be made conditionally available but my naive attempt didn't work.

https://gist.github.com/altendky/357e6a19691912593080f18ddcc39235

It would also be nice if setup.py could reference its own extras as dependencies like .[mf4] or such but last I played with that I didn't find anything that worked.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got that idea, but it's largely unsupported for now. :( I was just trying what is implemented and what not. That shortcoming of setup.py is really annoying as well. -.-


script:
- |
Expand Down Expand Up @@ -74,6 +71,7 @@ jobs:
# -a Write all files
# -n nitpicky
- python -m sphinx -an doc build

- stage: linter
name: "Linter Checks"
python: "3.7"
Expand Down Expand Up @@ -109,6 +107,7 @@ jobs:
- travis_retry pip install -r requirements-lint.txt
script:
- black --check --verbose .

- stage: deploy
name: "PyPi Deployment"
python: "3.7"
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Features
- receiving, sending, and periodically sending messages
- normal and extended arbitration IDs
- limited `CAN FD <https://en.wikipedia.org/wiki/CAN_FD>`__ support
- many different loggers and readers supporting playback: ASC (CANalyzer format), BLF (Binary Logging Format by Vector), CSV, SQLite and Canutils log
- many different loggers and readers supporting playback: ASC (CANalyzer format), BLF (Binary Logging Format by Vector), CSV, SQLite, Canutils log and MF4 (Measurement Data Format v4 by ASAM)
- efficient in-kernel or in-hardware filtering of messages on supported interfaces
- bus configuration reading from file or environment variables
- CLI tools for working with CAN buses (see the `docs <https://python-can.readthedocs.io/en/stable/scripts.html>`__)
Expand Down
4 changes: 4 additions & 0 deletions can/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class CanError(IOError):
from .io import CanutilsLogReader, CanutilsLogWriter
from .io import CSVWriter, CSVReader
from .io import SqliteWriter, SqliteReader
try:
from .io import MF4Writer, MF4Reader
except ImportError:
pass

from .util import set_logging_level

Expand Down
4 changes: 4 additions & 0 deletions can/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@
from .csv import CSVWriter, CSVReader
from .sqlite import SqliteReader, SqliteWriter
from .printer import Printer
try:
from .mf4 import MF4Writer, MF4Reader
except ImportError:
pass
Loading