Salabim

Latest version: v25.0.8

Safety actively analyzes 723400 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 5 of 28

24.0.1

==========================

New functionality (0)
---------------------

The method Environment.ui_granularity has been introduced.
With this, it is possible to set the number of simulation steps that have to be
called before _handle_ui_event is called (again).
This can significantly improve performance during simulation with animation off
and the UI shown.
The ui_granularity is 1 at start-up.
It might require some experimentation to find a suitable value:

- too low might result in slow execution
- too high might result in bad responsiveness


Enhancement (0)
---------------

Component.request() needed to have at least one resource specified.
From now on, the request method also works without any resource (tuple) specified. So
self.request()
is allowed, although it is just a dummy action, like self.hold(0).


Bug fix (0)
-----------

When passing (non-consumed) parameters to the Component.process method, an error was raised in
yieldless mode, so
class X(sim.Component):
def process(self, extra):
print(f"{extra=})
self.hold(1)
x = X(extra="extra")
didn't work properly in yieldless mode.
Fixed.


Bug fix (1)
-----------

In yieldless mode, the line number where a component becomes current,
sometimes incorrectly referred to a line in salabim, instead of the user program. Fixed.


Bug fix (2)
-----------

If ComponentGenerator was used with a spread (i.e. no iat) at a time not being 0,
an error was raised. Fixed.


Bug fix (3)
-----------

With blind_animation mode True, video production didn't work in yieldless mode. Fixed.
(Bug reported by max l)

24.0.0

==========================

Added functionality (0)
-----------------------

The parameter 'interrupted' for Component.hold() has been introduced.
With this it is possible to hold a component, and let it go immediately in interrupted state.
This is very useful to simulate breakdowns, where a component should immediately observe
the breakdown state:
yield self.hold(10, interrupted=machine.mode() == "down")
This functionality would be rather difficult to implement, otherwise.

Note that the parameter 'interrupted' may be also an integer >=1 to denote the interrupt level.


Changed functionality (0)
-------------------------

For stability reasons, Component.interrupt() is from now on only allowed for scheduled components.

Added test (0)
--------------

A common mistake is to test the value of a monitor, like Component.mode or Component.status with
a string or integer.
E.g.
if comp.status == "passive":
...
In this case the test will always fail. Of course it should read:
if comp.status() == "passive":
...

From this version on, testing a monitor against anything else than a monitor will raise
a TypeError.
So, now
if comp.status == "passive":
...
will show:
TypeError: Not allowed to compare Monitor with str . Add parentheses?

23.3.13

===========================

Bug fix (0)
-----------

When calling Component.from_store, the return value was incorrectly None when the request
could be honoured immediately.
Fixed.
(bug reported by Bart van Corven)

Bug fix (1)
-----------

Calling Environment.width() with adjust_x0_x1_y0=True didn't work properly. Fixed.

Bug fix (2)
-----------

Animating an animated gif or webp with AnimateImage(animation_repeat=True) caused a bug. Fixed.

Bug fix (3)
-----------

Calling Resource.release with a non anonymous resource caused an error. Fixed.
(bug reported by Floris Padt)

23.3.12

===========================

Changed functionality (0)
-------------------------

In order to avoid excessive cache size, the sequence number is not cached anymore
for non-serialized names (those that do not end in "." or ",").
To the user that has the effect that calling sequence_number method on non-serialized
components, queues, monitors, resources, environment and states will always return 1.
In practice that means that:
man0 = Man(name="man")
man1 = Man(name="man")
print(man0.sequence_number(), man1.sequence_number())
will now print
1 1
,whereas that used to be
1 2
For
man0 = Man()
man1 = Man()
print(man0.sequence_number(), man1.sequence_number())
the output is still
1 2
Internally, neither the base_name nor the sequence_number are stored anymore
for non-serialized names, which reduces the memory footprint (marginally).

The documentation has been updated reflecting this change.

(inspired by an observation by Floris Padt)

Changed functionality (1)
-------------------------

In AnimateImage, a width of 0, resulted in a ValueError, caused by Pillow.
From now on, a width of 0, is accepted, which can be useful for
dynamic sizing of an image. So,
sim.AnimateImage("my_image.png", width=lambda t: sim.interpolate(t, 0, 10, 1024, 0))
will now result "nothing" after env.t() > 10.

Bug fix (0)
-----------

A bug caused a ValueError when tracing with suppress_trace_linenumbers(True) in yieldless mode. Fixed.
(bug reported by Ben Moverley Smith)

Bug fix (1)
-----------

For some reason, adding audio to a video file didn't work anymore (new version of ffmpeg?).
Fixed by adding the -safe 0 command to the final ffmpeg command.

23.3.11

===========================

Changed functionality (0)
-------------------------

From now on, Monitor.print_statistics and Monitor.print_histogram does not show "no data"
anymore when the number of entries / total weight is zero. This change is made to be
have a more consistent output, which is important when post processing the output string.

In relation to this, histogram_autoscale now also returns 'sensible' values when
there are no entries or the total weight is zero.

Changed functionality (1)
-------------------------

When a component is cancelled, any claimed resources are now automatically released.
This is in line with the termination of a component.
(inspired by Luca Di Gaspero)

Extended functionality (0)
--------------------------

Under Windows, fonts are now also searched in the user/AppData/Local/Microsoft/Windows/Fonts
folder, as fonts are sometimes installed there as well.

Python in Excel functionality (0)
---------------------------------

In Python in Excel, line numbers are now completely suppressed in the trace.

The test for PythonInExcel has been changed (by testing whether __file__ is in globals())
to be compatible with the new runner functionality.

The file salabim.py now contains the line
module = salabim
, to make it compatible with Python in Excel, out of the box.

Bug fix (0)
-----------

A problem with activating a process in yieldless mode fixed.
(Bug reported by bonusguy)

Bug fix (1)
-----------

A bug in Component.cancel() prevented a process to stop correctly in yieldless mode. Fixed.
(Bug reported by Devin Kain)

Bug fix (2)
-----------

A bug in Component.passivate(), Component.standby(), Component.from_store() and Component.to_store()
in yieldless mode.
When called one of these methods were applied on a component that's not current (so not self), the
process of that component stopped incorrectly. E.g.
other_car.passivate()
Fixed.

Documententation updates (0)
----------------------------

The documentation (both html and pdf) have been updated considerably, mainly as a result of
the preparation of the printed user and reference manual.

Availability of printed user and reference manual (0)
-----------------------------------------------------

Now a printed manual is available from your local Amazon site in two formats:

* full colour premium paper hardcover (ISBN 9798867009403)
* full colour standard paper paperback (ISBN 9798865131472)

Please search for "salabim user and reference manual" on your local Amazon site and you can buy it directly there.

23.3.10

===========================

Added functionality (0)
-----------------------

Saving
an animated gif, png or webp file
a snapshot
under Python In Excel, now saves an encoded file to sim.pie_result().
The stored result contains the name of the file, so later decoding to a real file is possible.

Also, a file handler b64_file_handler is provided to allow writing to a file
in binary or text mode as an encoded file. This is used internally, but it can be used
by an application as well.

It is also possible to add text to the sim.pie_result() list without
affecting the stored file(s) information.

Note that for the decoding a VBA macro is required.

Changed functionality (0)
-------------------------

Under Python in Excel, blind_animation is enabled by default for a call to Environment().

Changed functionality (1)
-------------------------

If the trace had to show a line in the source of salabim (particularly in ComponentGenerator),
the line numbers were not always displayed correctly and were not very useful
for the trace anyway.
From now on, in that case, no line number will be shown.

Bug fix (0)
-----------

Label lines in AnimateMonitor / Monitor.animate() were obscured by the fillcolor.
From now on, the line around the frame will be shown over the label lines,
whereas the label lines will be shown over the filled rectangle.

Bug fix (1)
-----------

On Pythonista, the fallback font did not work properly as Pythonista does not support
file handles as the font parameter for PIL.ImageFont. Therefore, on this platform
salabim falls back on the standard Arial font.

Bug fix (2)
-----------

Pause/Resume an animation with <space> didn't work properly. Fixed.
(bug reported by Harald Mutzke)

Type annotation fix (0)
-----------------------

Fixed a wrong type annotation in AnimateSlider.
(flagged by Harald Mutzke)

PyPI/GitHub distribution change (0)
------------------=-----------------

On PyPI salabim now has a meaningful description.
GitHub also has an updated readme.

Page 5 of 28

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.