Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Better mechanism to control SetterFlags

Open
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
28/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
api

Research direction

Start by tracing the Python properties, the _set_PMult setter, SetterFlags, and end_edit() used in the issue's test examples, then compare how the proposed context-manager and default-property approaches would pass flags through the C API. Done should establish one documented mechanism that supports individual and batch operations, including ImplicitSizes and AvoidFullRecalc, with the shown property-based usage working.

Written by the indexing model from the issue text.

Description

enhancement

Currently this is an advanced feature, and users need to leave the comfort of the Python properties, using instead the setter methods in order to pass both a value and the flags.

Some context, from the tests:


    alt.Clear()
    ls = alt.LoadShape.new('test_shape')
    with pt.raises(DSSException):
        ls.PMult = [1.0, 2.0, 3.0]

    ls._set_PMult([1.0, 2.0, 3.0], SetterFlags.ImplicitSizes)
    assert tuple(ls.PMult) == (1.0, 2.0, 3.0)

    ls.end_edit()

Some possible alternatives:

  • Use a context manager in Python to keep the flags used in a block, use these flags on each Python function (when passing to the C API) and reset them later. This could be combined with the Edit context manager later.

with alt.with_setter_flags(SetterFlags.ImplicitSizes):
    ls = alt.LoadShape.new('test_shape')
    ls.PMult = [1.0, 2.0, 3.0]
    assert tuple(ls.PMult) == (1.0, 2.0, 3.0)
    ls.end_edit()

  • Introduce a pair of API functions to control some default flags, expose it as a property. For this, we wouldn't need to change much of the Python code, but would require consuming the default flags on the engine:
    alt.DefaultSetterFlags = SetterFlags.ImplicitSizes
#...
    ls = alt.LoadShape.new('test_shape')
    ls.PMult = [1.0, 2.0, 3.0]
    assert tuple(ls.PMult) == (1.0, 2.0, 3.0)
    ls.end_edit()

Other examples include using SetterFlags.AvoidFullRecalc to minimize Yprim and SystemY changes for loads and generators. This is valid for both individual and batch operations.

Dominant language
Python
Stars
19
Forks
2
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dss-extensions/AltDSS-Python

All issues in dss-extensions/AltDSS-Python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.