Skip to content
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

expose public regulated data types as a python package #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ot-goegelem
Copy link

Problem

I want to write a small tool that uses pycyphal and the public regulated data types.
But is quite annoying that it is not possible to just add/install the public regulated data types as a dependency.

I understand that this is a deliberate decision to make it possible to add custom data types, but my tool does not rely on custom data types and I want to being able to have one setup with all dependencies without needing some custom setup from the end user.

Solution

It is then possible to use this dependency by just specifying the git repository

pip install git+ssh://[email protected]/ot-goegelem/public_regulated_data_types.git@feature/python_package

@ot-goegelem ot-goegelem marked this pull request as ready for review November 6, 2024 12:22
Copy link
Member

@pavel-kirienko pavel-kirienko left a comment

Choose a reason for hiding this comment

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

Thanks! Please see my comment inquiring if it's possible to strap down the setup.py

Copy link
Member

Choose a reason for hiding this comment

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

Is the following not a valid replacement?

import setuptools
import distutils.command.build_py
from pathlib import Path

class BuildPy(distutils.command.build_py.build_py):
    def run(self):
        import pycyphal
        output_dir = Path(self.build_lib, self.pkg_name, ".demo_dsdl_compiled")
        cur_path = pathlib.Path(__file__).parent
        pycyphal.dsdl.compile_all(
            [
                cur_path / "uavcan",
                cur_path / "reg",
            ],
            output_directory=output_dir,
        )
        super().run()

setuptools.setup(cmdclass={"build_py": BuildPy})

@@ -0,0 +1,13 @@
[build-system]
requires = ['setuptools', 'pycyphal>=1.20.0']
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
requires = ['setuptools', 'pycyphal>=1.20.0']
requires = ['setuptools', 'pycyphal~=1.20.0']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants