Skip to content

Add a flag to VensimModel to change underscores to white space in Variable names#405

Merged
quaquel merged 15 commits intomasterfrom
underscore_flag
Sep 8, 2025
Merged

Add a flag to VensimModel to change underscores to white space in Variable names#405
quaquel merged 15 commits intomasterfrom
underscore_flag

Conversation

@quaquel
Copy link
Copy Markdown
Owner

@quaquel quaquel commented Sep 3, 2025

In 3.0, all variables and model names must be valid python identifiers. This is highlly inconvenient for Vensim models where it is the convention to use white space instead of underscores. This PR adds a flag to VensimModel to automatically map the name of all variables from being a valid python identifier (i.e., with underscores) to being valid for Vensim (i.e., replace underscores with white space).

In addition, it cleans up a whole bunch of technological debt and other minor bugs found along the way. Most notably

  • Constants did not subclass Variable
  • Variable class now handles name and variable name dynamics
  • Constants are now included in calls to run_model so they can be handled by _tranform as well
  • A wrong class (Policy vs. Scenario) in sample_uncertainties
  • ruff fixes in various places
  • adding type hints in vensim.py and model.py
  • model name shifts from having to be alpha numerical to being a valid python identifier

closes #393

@coveralls
Copy link
Copy Markdown

coveralls commented Sep 3, 2025

Coverage Status

coverage: 85.15% (+0.01%) from 85.136%
when pulling 3d3b2c3 on underscore_flag
into e920d8b on master.

@quaquel quaquel changed the title WIP Add a flag to VensimModel to change underscores to white space in Variable names Sep 4, 2025
@quaquel quaquel linked an issue Sep 8, 2025 that may be closed by this pull request
@quaquel quaquel merged commit 4e94f84 into master Sep 8, 2025
20 of 22 checks passed
@quaquel quaquel deleted the underscore_flag branch September 8, 2025 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flag for underscores in names of parameters

2 participants