Enhancement: Python client Symbol cannot list a usage's inherited members (parts, ports, bindings), unlike attributes()
Maintainer thường phản hồi trong vòng 1 ngày
@devin-ai-integration đang làm issue này rồi.
Từ ngày 5/11/2026.
- #1974 của @devin-ai-integration — đang mở
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- api, developer-experience
Hướng nghiên cứu
The issue names the Python client, children(), parts(), attributes(), and docs/reference/python-api.md; it also links pull request #1974, which is already open. Start by reviewing the linked pull request and the client API behavior described in the reproduction. Done means the API and docs clearly specify inherited members and address the reported behavior, including redefinitions and standard-library members.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
This issue was written with AI help. The model, the reproduction script and its output are
attached and were run against the version below.This is partly a feature request. The issue form points feature requests to Discussions, but
Discussions are not enabled on this repository, so it is filed as an issue.
What happened, and what you expected instead
A part definition declares a boundary port, a nested part and a named binding between them, and a
part usage in the system is typed by it:
part def Controller {
attribute gain : ScalarValues::Real;
port cmdIn : CmdPort;
part logic : Logic;
binding delegate bind cmdIn = logic.cmdIn;
}
part system {
part controller : Controller;
}
Walking the system structure from Python, model.get("…::system::controller") gives:
| Method | Returns |
|---|---|
attributes() |
['…::Controller::gain']: own and inherited, as its docstring says |
parts() |
[]: the inherited logic is missing |
children() |
[]: the inherited gain, cmdIn, logic and delegate are all missing |
children() lists only the members the element itself declares (its owned members). For a usage
typed by a definition that is usually nothing, so a client that walks the structure through
usages, which is the natural way to walk an instance hierarchy, never sees the definition's ports,
parts or bindings. If one member is redefined (part tuned : Controller { attribute :>> gain = 2.0; }),
children() returns only that member.
Nothing documents this. children() says only "Return all child symbols", and parts() says
"Return child symbols that are part definitions or usages". Meanwhile attributes() on the same
object does include inherited members, so the two methods disagree about what belongs to the
element.
The service already has the inherited members. Through reflection,
last(system::controller.metadata).member starts with gain, cmdIn, logic, delegate, followed
by about 70 standard-library features. model.instantiate("…::system").controller has the
features cmdIn, delegate, gain and logic. The Symbol API is the only place that cannot
list them. The workaround is to fetch the definition (type_facts.resolved_id) and the targets of
specializations, then merge their children with the usage's own, applying redefinitions by
hand, which is the walk attributes() already does internally for attributes.
Requested:
- A way to list a symbol's members own and inherited, as
attributes()does for
attributes. That could bechildren(inherited=True), amembers()method, or inherited ids
onSymbolInfo. It would follow the same rules asattributes(): a redefinition masks what it
redefines, and standard-library members are left out and reported as withheld
(withheld_library_attributesdoes this for attributes today). parts()behaves likeattributes()and includes inherited parts, or both are documented as
different on purpose.- The docstrings of
children()andparts()(anddocs/reference/python-api.md) say whether
inherited members are included.
Related: #1960 (children() also drops unnamed members of the element that declares them).
Reproduction
$ python repro_inherited.py # loads inherited-model.sysml with opensysml.loads() over sysml-grpc
## The definition declares the members
[INFO] InheritedMembers::Controller.children()
observed: [('attributeUsage', 'InheritedMembers::Controller::gain'), ('portUsage', 'InheritedMembers::Controller::cmdIn'), ('partUsage', 'InheritedMembers::Controller::logic'), ('bindingUsage', 'InheritedMembers::Controller::delegate')]
## The usage typed by it
[OK ] InheritedMembers::system::controller is typed by InheritedMembers::Controller
[OK ] InheritedMembers::system::controller.attributes() includes the inherited attribute (documented: own and inherited)
observed: ['InheritedMembers::Controller::gain']
[BUG ] InheritedMembers::system::controller.parts() includes the inherited part 'logic'
observed: []
expected: ['InheritedMembers::Controller::logic']
[BUG ] InheritedMembers::system::controller: some Symbol method lists the inherited binding 'delegate'
observed: []
expected: ['InheritedMembers::Controller::gain', 'InheritedMembers::Controller::cmdIn', 'InheritedMembers::Controller::logic', 'InheritedMembers::Controller::delegate']
## A usage that redefines one member lists only that one
[INFO] InheritedMembers::system::tuned.children()
observed: ['InheritedMembers::system::tuned::gain']
## The service does know the inherited members
[INFO] reflection: ownedMember (empty, as children())
observed: []
[INFO] reflection: member (first four of the list; the rest are standard-library features)
observed: ['gain', 'cmdIn', 'logic', 'delegate']
[INFO] instance: features of system.controller
observed: ['cmdIn', 'delegate', 'gain', 'logic']
inherited-model.sysml:
package InheritedMembers {
port def CmdPort {
in attribute cmd : ScalarValues::Integer;
}
part def Logic {
port cmdIn : CmdPort;
}
part def Controller {
attribute gain : ScalarValues::Real;
port cmdIn : CmdPort; // boundary port
part logic : Logic;
binding delegate bind cmdIn = logic.cmdIn; // boundary-to-child binding, named
}
part system {
part controller : Controller; // usage typed by the definition
part tuned : Controller { // the same, redefining one member
attribute :>> gain = 2.0;
}
}
}
Reproduction files (attached)
| File | Contents |
|---|---|
| model | inline above (no file attached): save it as inherited-model.sysml next to repro_inherited.py |
repro_inherited.py |
loads inherited-model.sysml with opensysml.loads() and compares children(), parts() and attributes() of the definition and the usages, then shows the same members through reflection and an instance. Each check prints OK, BUG or INFO, and the script exits 1 while any BUG reproduces. |
output_inherited.txt |
the full output of the run reported here |
_common.py |
shared helper the script imports: starts the sysml-grpc named by $OPENSYSML_BINARY, prints the server and client versions, and formats the checks |
To run it, put _common.py in the parent directory of the folder holding repro_inherited.py and the model,
install the client (pip install -e client/python from an OpenSysML checkout), and point
OPENSYSML_BINARY at a sysml-grpc build:
$ OPENSYSML_BINARY=/path/to/OpenSysML/bin/sysml-grpc python repro_inherited.py
Without OPENSYSML_BINARY, _common.py assumes an OpenSysML checkout next to the directory
that holds _common.py, with bin/sysml-grpc built by make build-grpc.
Version
sysml-grpc v0.12.0-262-gc86932321 (develop at c86932321), opensysml Python client 0.12.0, Python 3.13.15
Surface
Python client (opensysml)
- Ngôn ngữ chính
- Go
- Star
- 56
- Fork
- 17
- Merge trung bình
- 12 giờ 50 phút
- Pull request đã merge (30 ngày)
- 905
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Open-MBEE/OpenSysML
-
dependencies
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Open-MBEE/OpenSysML#1951 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug spec compliance
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 43/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug spec compliance
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Open-MBEE/OpenSysML#2033 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Open-MBEE/OpenSysML#2029 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Open-MBEE/OpenSysML
Issue tương tự
-
type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 86/100
eugenioenko/autentico#605 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Test failure: github.com/teramoby/speedle-plus/cmd/spctl/command TestCLITokenInputAndEnvironmentĐang mởtest-failure
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
teramoby/speedle-plus#298 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
hive
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area/admin/user area/internationalization automated-triage issue/auto-triaged type/bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
grafana/grafana#137281 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày