Releases: CorsoSource/metatools
Metatools bundle for Ignition - semaphore, macro, fixes, and more
This is a repacked and (more) up-to-date version of metatools for Ignition. This includes @semaphore
, macro-like function monitoring, bug fixes, and improvements to introspection. (Semaphore follows Python execution, not Java threads in this point release)
Plus this particular bundle has everything tab-indented and trailing whitespace removed, for in situ Ignition code editor convenience!
Crowbar session more interactive
This covers a few small tweaks that greatly improve hacking with crowbar
. Session variables are safer, and Java errors no longer break the little HTTP server that spun up.
Async improvements, memoize, simulators, runtime, sidecar, and crowbar.
This is a substantial update to the tools, adding in a few fun things:
New
- Simulators! The
shared.data.simulators
package now has two handy number maker things:drunk
to make wobbly lines, andprocess
to simulate machines. Theprocess
simulator is a state machine that evolves its own state based on values and triggers. Use constants, expressions, or even other simulator variables to trigger changing states. NOTE: This is built on the wonderful transitions library - check it out! DictPosingAsClass
- Turn a dictionary into something like a class! Can have fields predefined in__slots__
so that superfluous entries are ignored. Pretty similar in functionality to the new Py3kdataclass
.hotload
- Hot patch a zipped Python library right into memory. Forget to put something inpylib
? Want to load something at runtime? This also ensures that import mechanics work and fills in placeholder module references where needed (to ensure import machinery can chain in correctly).memoize_for_call_stack
- Cache results from a function but just for the duration of the thread that's executing it. This is handy for when you need to, say, grab data from a database and then do work on it - decorate a function with this, and the next call with the same arguments will immediately return the same results. Handy for when work must be done on the spot, but may be repeated multiple times before completion. Consider this a poor man's cache. (And super handy if you ever do alevenshtein
distance calc...)grep
- For easy paring down of the sometimes overwhelming amount of nonsense that is dumped by the pretty printer (and especially thepdir
functionality), pipe things right intogrep
anddirgrep
to filter for lines containing a given string or regex.runtime
- Initial functionality to allow runtime hotpatching and overrides for events and such. Override the classes and bolt things onto stuff like the menubar or buttons. Works on Swing components. More functionality to come as opportunities come up.snapshot
- Version Ignition! This is not the most up-to-date versioning tooling, but it's a good starting framework until the main tool is packed up. Convert Ignition stuff into YAML, thendiff
it - just like real code stuff. NOTE: Ignition still should be thought of as a binary system, not a text-based coding platform; keep binaries and code in parallel and orchestrate together.sidecar
- Spin up a simple REST service just to test against. Handy for making ad hoc webpages when tags change state.waitForConditionOrTimeout
- sleep until a condition is true, checking frequently untilrising_edge_function
isTrue
or the wait times out. Handy with@async
to wait for something to happen (but don't try to catch very fast events, though you probably could...)yaml
- Packed in here so it doesn't have to be inpylib
. Handy because it always forces the better block string format for any multi-line string, ensuring YAML generated is easy to diff.crowbar
- Spins up an interactive prompt that runs against the Gatewaycontext
. WARNING: DO NOT USE THIS. (But if you do play with it, it's super handy, lots of fun, and incredibly informative. Just make sure you back up your gateway and NEVER run on Production. Ever. Don't do it. No matter how cool it makes you look. Not even once.
Changes
- Easing is now at
shared.data.easing
- Expression is now at
shared.data.expression
(though has a stub atshared.tools.expression
for backward compatability) @async
decorator can now be provided akillSwitch
function that will murder the async thread if it ever becomesTrue
(as executed by the watchdog thread). Async threads can also be forced to (effectively) be singletons by settingensureOnlyOne=True
so that on start if there's another thread by the same name it'll quietly close without doing anything.
Fixes
- Debugger - Ignition 8 dropped support for the
[System]Client/System/FPMIVersion
tag leading to an embarassing break. Includes an example of how to control aTracer
from a tag instead of strictly the interactive REPL. ExtraGlobal
tweak fixes clearing scoped keys before trashing them.Logger
now better manages scope resolution, can introspect and react to logging during exception handling, and better handles when Vision and Perspective autoconfiguration gets confused / broken (in case heuristics fail or misunderstand where the script is run)getDesignerContext
now retrieves the context directly, if it can- Pretty printer now respects banned attributes in the (bizarrely) rare circumstances an attempt at introspection breaks the thread. Also pretty prints Java HashSet and HashMap objects as well as generators.
venv
boostraps ad hoc runtime Python modules with better placeholding with respect to module chaining.
Mistakes
- The
Antikythera
class should not be included. It's part of an aborted framework to get something like OpenCV bootstrapped into Ignition. It... sorta worked, but really isn't worth the trouble. Just run it like a reasonable setup, or hotload JARs, or really anything else. You can do some wild stuff with modules at runtime, butvenv
andhotload
is likely sufficient for the vast majority of cases.
Snapshot versioning will come at a later date with in-depth details on how to use and work repos and projects around Ignition's framework.
NOTE: this was saved from Ignition 8.1.10 and includes all the tools from Metatools.
Tracing debugger, expressions, thread states, and pretty formatting
This is a two part update.
A Jython debugger. This is a complete reimplementation of the built in Python Debugger, but upgraded, fixed, and revamped to take advantage of the more sophisticated class objects of Python 2.4+ as well as the multithreaded environment of Java. It's a massive, complicated beast with lots more documentation and details to follow later.
The metatools see an update to the pretty printer, with much more extensive formatting methods and the ability to take over the interactive prompt's replies via shared.tools.pretty.install()
- simply call that and all objects that would otherwise get printed via repr
now get the better formatting.
Dataset filtering and threads have more extensive tooling.
Expressions have been added to support the debugger's trap creation. These are halfway to compiled, and can be directly inspected, unlike compiled code.
NOTE: Debugger build artifacts are based on commit a2b358c
Watchdog async and recursive pretty printing
ExtraGlobal provides a way to share Python objects between submodules of Ignition. Use it to keep large, complicated or time consuming data structures fresh and in memory!
The async decorator now lets a timeout be applied to the threads. This ensures that the thread doesn't become a zombie.
Pretty printing is also much better at nesting datatypes and can list even private values in Java.
Initial Exchange release
This is the initial commit applied to Inductive Automation's Ignition Exchange.
The files can be downloaded here:
https://inductiveautomation.com/exchange/2008/overview