Skip to content

Commit

Permalink
python: specify packages to install for each module (#1246)
Browse files Browse the repository at this point in the history
### Changelog
- Fixed: python packages `mcap`, `mcap-protobuf-support`,
`mcap-ros1-support`, `mcap-ros2-support` now only install their main
packages rather than all packages including tests.
- Fixed: Add type annotations to `__init__` methods with no arguments
implementing this guide:
https://mypy.readthedocs.io/en/stable/class_basics.html#annotating-init-methods

### Docs

<!-- Link to a Docs PR, tracking ticket in Linear, OR write "None" if no
documentation changes are needed. -->

### Description

Rely on setuptools' auto-discovery mechanism to find the python packages
we're trying to expose while auto-excluding `tests`, which were
previously being included into users' install directories.

### Testing
- Inspected wheel contents using `python -m zipfile --list
mcap_protobuf_support-0.5.2-py3-none-any.whl` to ensure that the whole
library content is present and no test directories are present.
  • Loading branch information
james-rms authored Oct 9, 2024
1 parent 4ec37c5 commit 2789ad4
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion python/mcap-protobuf-support/mcap_protobuf/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.5.1"
__version__ = "0.5.2"
2 changes: 1 addition & 1 deletion python/mcap-protobuf-support/mcap_protobuf/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DecoderFactory(McapDecoderFactory):
messages. Requires valid `protobuf` schemas to decode messages.
"""

def __init__(self):
def __init__(self) -> None:
self._types: Dict[int, Type[Any]] = {}

def decoder_for(
Expand Down
1 change: 0 additions & 1 deletion python/mcap-protobuf-support/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ install_requires =
mcap>=0.0.14
protobuf>=4.25
install_package_data = True
packages = find:
python_requires = >=3.7

[options.package_data]
Expand Down
2 changes: 1 addition & 1 deletion python/mcap-ros1-support/mcap_ros1/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.2"
__version__ = "0.7.3"
2 changes: 1 addition & 1 deletion python/mcap-ros1-support/mcap_ros1/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DecoderFactory(McapDecoderFactory):
Requires a valid `ros1msg` schema to decode messages.
"""

def __init__(self):
def __init__(self) -> None:
self._types: Dict[int, Type[Any]] = {}

def decoder_for(
Expand Down
3 changes: 1 addition & 2 deletions python/mcap-ros1-support/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ classifiers =

[options]
install_package_data = True
install_requires =
install_requires =
mcap>=0.0.14
pyyaml
packages = find:
python_requires = >=3.7

[options.package_data]
Expand Down
2 changes: 1 addition & 1 deletion python/mcap-ros2-support/mcap_ros2/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.5.4"
__version__ = "0.5.5"
2 changes: 1 addition & 1 deletion python/mcap-ros2-support/mcap_ros2/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DecoderFactory(McapDecoderFactory):
currently supported.
"""

def __init__(self):
def __init__(self) -> None:
self._decoders: Dict[int, DecoderFunction] = {}

def decoder_for(
Expand Down
3 changes: 1 addition & 2 deletions python/mcap-ros2-support/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ classifiers =

[options]
install_package_data = True
install_requires =
install_requires =
mcap>=0.0.14
packages = find:
python_requires = >=3.7

[options.package_data]
Expand Down
2 changes: 1 addition & 1 deletion python/mcap/mcap/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.2.0"
__version__ = "1.2.1"
2 changes: 1 addition & 1 deletion python/mcap/mcap/data_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def read_prefixed_string(self) -> str:


class RecordBuilder:
def __init__(self):
def __init__(self) -> None:
self._buffer = BytesIO()

@property
Expand Down
2 changes: 1 addition & 1 deletion python/mcap/mcap/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class Summary:
def __init__(self):
def __init__(self) -> None:
"""contains information from the summary section of an MCAP.
:ivar schemas: a dict of schema ID to schema record.
:ivar channels: a dict of channel ID to channel record.
Expand Down
3 changes: 1 addition & 2 deletions python/mcap/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ classifiers =

[options]
include_package_data = True
install_requires =
install_requires =
lz4
zstandard
packages = find:
python_requires = >=3.7

[options.package_data]
Expand Down

0 comments on commit 2789ad4

Please sign in to comment.