diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e70f0f8cf..5c06ee94f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,9 +42,9 @@ jobs: # python-version: "3.13.0-alpha - 3.13.0" fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -139,9 +139,9 @@ jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install dependencies @@ -155,18 +155,14 @@ jobs: - name: Run doctest run: | python -m sphinx -b doctest -W --keep-going doc build - - uses: actions/upload-artifact@v3 - with: - name: sphinx-out - path: ./build/ - retention-days: 5 build: + name: Packaging runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: Build wheel and sdist @@ -174,24 +170,25 @@ jobs: - name: Check build artifacts run: pipx run twine check --strict dist/* - name: Save artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: python-can-dist + name: release path: ./dist upload_pypi: needs: [build] + name: Release to PyPi runs-on: ubuntu-latest + permissions: + id-token: write # upload to PyPI only on release if: github.event.release && github.event.action == 'published' steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: - name: python-can-dist path: dist + merge-multiple: true - - uses: pypa/gh-action-pypi-publish@v1.4.2 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} + - name: Publish release distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8798c19c7..404b68c3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,37 @@ +Version 4.4.0 +============= + +Features +-------- + +* TRC 1.3 Support: Added support for .trc log files as generated by PCAN Explorer v5 and other tools, expanding compatibility with common log file formats (#1753). +* ASCReader refactor: improved the ASCReader code (#1717). +* SYSTEC Interface Enhancements: Added the ability to pass an explicit DLC value to the send() method when using the SYSTEC interface, enhancing flexibility for message definitions (#1756). +* Socketcand Beacon Detection: Introduced a feature for detecting socketcand beacons, facilitating easier connection and configuration with socketcand servers (#1687). +* PCAN Driver Echo Frames: Enabled echo frames in the PCAN driver when receive_own_messages is set, improving feedback for message transmissions (#1723). +* CAN FD Bus Connection for VectorBus: Enabled connecting to CAN FD buses without specifying bus timings, simplifying the connection process for users (#1716). +* Neousys Configs Detection: Updated the detection mechanism for available Neousys configurations, ensuring more accurate and comprehensive configuration discovery (#1744). + + +Bug Fixes +--------- + +* Send Periodic Messages: Fixed an issue where fixed-duration periodic messages were sent one extra time beyond their intended count (#1713). +* Vector Interface on Windows 11: Addressed compatibility issues with the Vector interface on Windows 11, ensuring stable operation across the latest OS version (#1731). +* ASCWriter Millisecond Handling: Corrected the handling of milliseconds in ASCWriter, ensuring accurate time representation in log files (#1734). +* Various minor bug fixes: Addressed several minor bugs to improve overall stability and performance. + +Miscellaneous +------------- + +* Invert default value logic for BusABC._is_shutdown. (#1774) +* Implemented various logging enhancements to provide more detailed and useful operational insights (#1703). +* Updated CI to use OIDC for connecting GitHub Actions to PyPi, improving security and access control for CI workflows. +* Fix CI to work for MacOS (#1772). +* +The release also includes various other minor enhancements and bug fixes aimed at improving the reliability and performance of the software. + + Version 4.3.1 ============= diff --git a/can/__init__.py b/can/__init__.py index 9b6a26f58..d504aa16b 100644 --- a/can/__init__.py +++ b/can/__init__.py @@ -8,7 +8,7 @@ import logging from typing import Any, Dict -__version__ = "4.3.1" +__version__ = "4.4.0-rc.1" __all__ = [ "ASCReader", "ASCWriter", diff --git a/can/io/asc.py b/can/io/asc.py index ceffaf5cb..68c0d38eb 100644 --- a/can/io/asc.py +++ b/can/io/asc.py @@ -69,6 +69,7 @@ def __init__( # TODO - what is this used for? The ASC Writer only prints `absolute` self.timestamps_format: Optional[str] = None self.internal_events_logged = False + self._extract_header() def _extract_header(self) -> None: for _line in self.file: @@ -110,9 +111,18 @@ def _extract_header(self) -> None: if events_match: self.internal_events_logged = events_match.group("no_events") is None - break + continue - break + if trigger_match := ASC_TRIGGER_REGEX.match(line): + datetime_str = trigger_match.group("datetime_string") + self.start_time = ( + 0.0 + if self.timestamps_format == "relative" + else self._datetime_to_timestamp(datetime_str) + ) + # attribute `start_timestamp` for unified as BLFReader + self.start_timestamp = self.start_time + break @staticmethod def _datetime_to_timestamp(datetime_string: str) -> float: @@ -260,20 +270,10 @@ def _process_fd_can_frame(self, line: str, msg_kwargs: Dict[str, Any]) -> Messag return Message(**msg_kwargs) def __iter__(self) -> Generator[Message, None, None]: - self._extract_header() for _line in self.file: line = _line.strip() - if trigger_match := ASC_TRIGGER_REGEX.match(line): - datetime_str = trigger_match.group("datetime_string") - self.start_time = ( - 0.0 - if self.relative_timestamp - else self._datetime_to_timestamp(datetime_str) - ) - continue - if not ASC_MESSAGE_REGEX.match(line): # line might be a comment, chip status, # J1939 message or some other unsupported event @@ -282,7 +282,7 @@ def __iter__(self) -> Generator[Message, None, None]: msg_kwargs: Dict[str, Union[float, bool, int]] = {} try: _timestamp, channel, rest_of_message = line.split(None, 2) - timestamp = float(_timestamp) + self.start_time + timestamp = float(_timestamp) + self.start_timestamp msg_kwargs["timestamp"] = timestamp if channel == "CANFD": msg_kwargs["is_fd"] = True