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

provide a way to prune type trees #99

Open
thirtytwobits opened this issue Mar 25, 2024 · 1 comment
Open

provide a way to prune type trees #99

thirtytwobits opened this issue Mar 25, 2024 · 1 comment
Labels
class-feature help wanted Extra attention is needed
Milestone

Comments

@thirtytwobits
Copy link
Member

Currently pydsdl simply discovers all dsdl types under a given root folder. For large projects this presents a problem where a significant number of types may exist under a root but a given consumer/producer only uses a small subset of them.

This issue is to provide a way to select target types which become leaf-nodes allowing all other branches to be pruned.

For example, adding a target types: Optional[List[str]] argument to pydsdl.read_namespace would provide the right interface to enable this in consumers like Nunavut.

@pavel-kirienko pavel-kirienko added this to the v1.22 milestone Mar 25, 2024
@pavel-kirienko pavel-kirienko added class-feature help wanted Extra attention is needed labels Mar 25, 2024
@thirtytwobits
Copy link
Member Author

I did a quick experiment where I filtered the types included in the "sources" array here:

https://github.com/OpenCyphal/pydsdl/blob/master/pydsdl/_namespace.py#L446

but only for the target_dsdl_definitions here:

https://github.com/OpenCyphal/pydsdl/blob/master/pydsdl/_namespace.py#L152

Strangely, this did not return a transitive closure. While the target types were found not all of the types they used were included.

thirtytwobits added a commit to thirtytwobits/pydsdl that referenced this issue Mar 30, 2024
This is a draft PR to review a proposed change to the public APIs for pydsdl.

This is non-breaking change that adds an optional named tuple to the `read_namespace` method. This named tuple allows specifying a set of filtering rules to apply when discovering DSDL types from files under a given namespace filetree. The intent is to connect the proposed TypeFilterEngine to the `_construct_dsdl_definitions_from_namespace` method after it creates a `DSDLDefinition` to apply the initial filtering of the target type. From there I need to figure out how to mark that selected type and its transitive dependencies as either weakly-excluded or strongly-included and detect any conflict where user provided rules conflict as processing proceeds. Any advice as to where I could best work with a tree-representation ahead of any expensive processing would be appreciated.
thirtytwobits added a commit to thirtytwobits/pydsdl that referenced this issue Mar 31, 2024
This is a draft PR to review a proposed change to the public APIs for pydsdl.

This is non-breaking change that adds an optional set of visitors allowing users to implement filters. This also allows for new visitor types to be defined in the future without further API changes.
thirtytwobits added a commit to thirtytwobits/pydsdl that referenced this issue Mar 31, 2024
This is a draft PR to review a proposed change to the public APIs for pydsdl.

This is non-breaking change that adds an optional set of visitors allowing users to implement filters. This also allows for new visitor types to be defined in the future without further API changes.
thirtytwobits added a commit to thirtytwobits/pydsdl that referenced this issue Apr 8, 2024
This is a draft PR to review a proposed change to the public APIs for pydsdl.

This is non-breaking change that adds a new public method and datatype

## New Method

read_files - a file-oriented entry point to the front end. This takes a
list of target DSDL files allowing the user to maintain an explicit list
instead of depending on globular filesystem discovery.

## New Datatype

DsdlFile – We define and publish a new abstract data type that encapsulates
all the information collected about and from a given dsdl file. This allows
a backend to associate datatypes with files for the purposes of managing
dependencies (e.g. this would allow the creation of .d files by a back end).
thirtytwobits added a commit to thirtytwobits/pydsdl that referenced this issue Apr 14, 2024
thirtytwobits added a commit to thirtytwobits/pydsdl that referenced this issue May 25, 2024
This is a draft PR to review a proposed change to the public APIs for pydsdl.

This is non-breaking change that adds a new public method and datatype

read_files - a file-oriented entry point to the front end. This takes a
list of target DSDL files allowing the user to maintain an explicit list
instead of depending on globular filesystem discovery.

DsdlFile – We define and publish a new abstract data type that encapsulates
all the information collected about and from a given dsdl file. This allows
a backend to associate datatypes with files for the purposes of managing
dependencies (e.g. this would allow the creation of .d files by a back end).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
class-feature help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants