Like Docker, but for Squeak. You know, for kids.

Related tags

Miscellaneoussqueaker
Overview

Squeaker

Like Docker, but for Smalltalk images. You know, for kids.

It's a small program that helps in automated derivation of configured Smalltalk images from some fixed base image and a collection of Smalltalk commands. It's about 500 lines of Python, so far.

  • Squeakerfile.st is like Dockerfile, except it contains locations to fetch images from plus Smalltalk expressions to derive new images.

  • squeaker build is like docker build. It manages a cache (in $XDG_CACHE_HOME/squeaker, usually $HOME/.cache/squeaker on Unix) of downloaded artifacts, derived images, and the stages in each derivation.

  • squeaker run is like docker run. It starts a previously-downloaded or -derived image in a temporary directory. (Future: support persistent image instances, like docker does! Easy enough.)

  • squeaker gc is like docker system prune, roughly. It cleans out the Squeaker cache directory, treating tags as GC roots.

Installation

Install Python 3.x (I used 3.9 to build it), making sure python3 is on the PATH.

Make sure squeaker is on the PATH, too.

Usage

You can type "squeaker --help" and "squeaker subcommand --help" for terse usage information.

Downloading and customising images

The Squeakerfile.st specifying a build is written using !-delimited chunk format (see also here and below). A chunk starting with from: specifies either

  • A URL, if the argument to from: is a Smalltalk string literal, e.g.

    from: 'http://files.squeak.org/6.0alpha/Squeak6.0alpha-20582-64bit/Squeak6.0alpha-20582-64bit.zip'
    

    The URL must point to a ZIP file containing at least one *.image file and a matching *.changes file.

  • A tag, previously defined using squeaker build -t ..., if the argument to from is a quoted Smalltalk symbol literal, e.g.

    from: #'myimage'
    

Other chunks are snippets of Smalltalk to execute to configure the image, deriving another image. Chunks are applied in sequence. Squeaker caches intermediaries, like Docker does, to avoid repeated work.

Let's work with the following Squeakerfile.st:

from: 'http://files.squeak.org/6.0alpha/Squeak6.0alpha-20582-64bit/Squeak6.0alpha-20582-64bit.zip'!

World submorphs
    select: [:m |
        (m isKindOf: PreferenceWizardMorph) or:
            [m isSystemWindow and: [m label beginsWith: 'Welcome to Squeak']]]
    thenDo: [:m | m delete].
!

"Apply my preferences!!"
CommunityTheme createDark apply.
Model useColorfulWindows: true.
[Preferences setDemoFonts] valueSupplyingAnswer: true.
Cursor useBiggerCursors: true.
Preferences enable: #mouseOverForKeyboardFocus.
TextEditor autoEnclose: false.
Model windowActiveOnFirstClick: true.
!

MCMcmUpdater default doUpdate: false.
!

Metacello new configuration: 'FFI'; load.
Installer ss project: 'OSProcess'; install: 'OSProcess'.
!

Use squeaker build to build it. Here, I will tag the final image as myimage:

>asColorizedSmalltalk80Text (TextStyler is Undeclared) ========== Update completed: 20582 -> 20678 ========== INFO:root: execution: 22.103 seconds INFO:root: 57047392/57047392 (100%) archiving: squeak.image INFO:root: 20540949/20540949 (100%) archiving: squeak.changes INFO:root: archiving: 2.135 seconds INFO:root: 57047392/57047392 (100%) extracting: squeak.image INFO:root: 20540949/20540949 (100%) extracting: squeak.changes INFO:root: --- 9e4bcce29c3dba7dd48e INFO:root:Running: Metacello new configuration: 'FFI'; load. Installer ss project: 'OSProcess'; install: 'OSProcess'. ⋮ (output from Metacello and OSProcess installation elided) ⋮ loaded INFO:root: execution: 45.081 seconds INFO:root: 69034504/69034504 (100%) archiving: squeak.image INFO:root: 24673049/24673049 (100%) archiving: squeak.changes INFO:root: archiving: 2.535 seconds INFO:root:Tagging 4c8767963a0bc6ce727b as 'myimage' 4c8767963a0bc6ce727bbbdb787e7a51c36fe27fff53dfcd4e84a8f4ad13872c858e4351262ba00d8d649bf474e28e515816a0774a8a30fc4c88039985e6b4b6 $ ">
$ squeaker build -t myimage -f Squeakerfile.st .
INFO:root:Downloading http://files.squeak.org/6.0alpha/Squeak6.0alpha-20582-64bit/Squeak6.0alpha-20582-64bit.zip
INFO:root:  20519402/20519402 (100%) http://files.squeak.org/6.0alpha/Squeak6.0alpha-20582-64bit/Squeak6.0alpha-20582-64bit.zip
INFO:root:  51209408/51209408 (100%) extracting: Squeak6.0alpha-20582-64bit.image
INFO:root:  20374964/20374964 (100%) extracting: Squeak6.0alpha-20582-64bit.changes
INFO:root: --- 2d3e365261fa70f3ae6b
INFO:root:Running:
    World submorphs
    	select: [:m |
    		(m isKindOf: PreferenceWizardMorph) or:
    			[m isSystemWindow and: [m label beginsWith: 'Welcome to Squeak']]]
    	thenDo: [:m | m delete].
INFO:root:    execution: 0.249 seconds
INFO:root:  58630352/58630352 (100%) archiving: squeak.image
INFO:root:  20376501/20376501 (100%) archiving: squeak.changes
INFO:root:    archiving: 2.182 seconds
INFO:root:  58630352/58630352 (100%) extracting: squeak.image
INFO:root:  20376501/20376501 (100%) extracting: squeak.changes
INFO:root: --- a65c4397156194b571d7
INFO:root:Running:
    "Tony's preferences!"
    CommunityTheme createDark apply.
    Model useColorfulWindows: true.
    [Preferences setDemoFonts] valueSupplyingAnswer: true.
    Cursor useBiggerCursors: true.
    Preferences enable: #mouseOverForKeyboardFocus.
    TextEditor autoEnclose: false.
    Model windowActiveOnFirstClick: true.
INFO:root:    execution: 0.619 seconds
INFO:root:  62905552/62905552 (100%) archiving: squeak.image
INFO:root:  20378159/20378159 (100%) archiving: squeak.changes
INFO:root:    archiving: 2.289 seconds
INFO:root:  62905552/62905552 (100%) extracting: squeak.image
INFO:root:  20378159/20378159 (100%) extracting: squeak.changes
INFO:root: --- e80909c4f1f2f14324b2
INFO:root:Running:
    MCMcmUpdater default doUpdate: false.

MethodNode>>asColorizedSmalltalk80Text (TextStyler is Undeclared) 
==========  Update completed:  20582 -> 20678 ==========
INFO:root:    execution: 22.103 seconds
INFO:root:  57047392/57047392 (100%) archiving: squeak.image
INFO:root:  20540949/20540949 (100%) archiving: squeak.changes
INFO:root:    archiving: 2.135 seconds
INFO:root:  57047392/57047392 (100%) extracting: squeak.image
INFO:root:  20540949/20540949 (100%) extracting: squeak.changes
INFO:root: --- 9e4bcce29c3dba7dd48e
INFO:root:Running:
    Metacello new configuration: 'FFI'; load.
    Installer ss project: 'OSProcess'; install: 'OSProcess'.
 ⋮
 (output from Metacello and OSProcess installation elided)
 ⋮
loaded
INFO:root:    execution: 45.081 seconds
INFO:root:  69034504/69034504 (100%) archiving: squeak.image
INFO:root:  24673049/24673049 (100%) archiving: squeak.changes
INFO:root:    archiving: 2.535 seconds
INFO:root:Tagging 4c8767963a0bc6ce727b as 'myimage'
4c8767963a0bc6ce727bbbdb787e7a51c36fe27fff53dfcd4e84a8f4ad13872c858e4351262ba00d8d649bf474e28e515816a0774a8a30fc4c88039985e6b4b6

$

Running images

Now I can get a transient, disposable image in a temporary directory which will be deleted when the VM process terminates, by running

$ squeaker run myimage
INFO:root:Image: 4c8767963a0bc6ce727bbbdb787e7a51c36fe27fff53dfcd4e84a8f4ad13872c858e4351262ba00d8d649bf474e28e515816a0774a8a30fc4c88039985e6b4b6
INFO:root:  69034504/69034504 (100%) extracting: squeak.image
INFO:root:  24673049/24673049 (100%) extracting: squeak.changes

Screenshot of the running myimage

If I want to keep this image, I have to take care to Save as... to some other directory!

Garbage collection

During development, and after a bit of normal usage, you'll find you have a lot of unwanted intermediary images saved in the cache. You can discard those not reachable from some tag using squeaker gc.

Use squeaker gc --dry-run to get a description of what will be deleted, without deleting anything.

You can also get a picture of the (live) contents of your cache by running the Graphviz dot tool over the output of the squeaker dot command.

Here's the kind of thing it looks like:

Example graph drawn by Graphviz dot

Chunk format

"Chunk" format (1, 2) is an old, old Smalltalkism. It's a binary file, using byte 0x21 (!) as delimiter. Exclamation points are doubled to escape them: so the chunk containing the text Hello! How are you? is written

Hello!! How are you?!

The final ! terminates the chunk; the embedded !! decodes to a single !.

License and Copyright

(MIT.)

Copyright 2021 Tony Garnock-Jones [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Owner
Tony Garnock-Jones
Tony Garnock-Jones
Simple card retirement plugin for Anki

Anki Retirement Addon Allow users to suspend, tag, delete, or move cards that reach a specific retirement interval Supports Anki version 2.1.45 Licens

3 Dec 23, 2022
A novel dual model approach for categorization of unbalanced skin lesion image classes (Presented technical paper 📃)

A novel dual model approach for categorization of unbalanced skin lesion image classes (Presented technical paper 📃)

1 Jan 19, 2022
0CD - BinaryNinja plugin to introduce some quality of life utilities for obsessive compulsive CTF enthusiasts

0CD Author: b0bb Quality of life utilities for obsessive compulsive CTF enthusia

12 Sep 14, 2022
VCC-Generator is a python script that generate VCC for testing purposes only

VCC-Generator is a python script that generate VCC for testing purposes only

Spider Anongreyhat 10 Oct 23, 2022
Robotic hamster to give you financial advice

hampp Robotic hamster to give you financial advice. I am not liable for any advice that the hamster gives. Follow at your own peril. Description Hampp

1 Nov 17, 2021
Passenger Car Unit (PCU) Calculator

This is a streamlit web application which can be used to calculate Passenger Car Unit (PCU) values for a selected road section.

Dineth Dhananjaya 1 Apr 26, 2022
Penelope Shell Handler

penelope Penelope is an advanced shell handler. Its main aim is to replace netcat as shell catcher during exploiting RCE vulnerabilities. It works on

293 Dec 30, 2022
Ml-design-patterns - Source code accompanying O'Reilly book: Machine Learning Design Patterns

This is not an official Google product ml-design-patterns Source code accompanying O'Reilly book: Title: Machine Learning Design Patterns Authors: Val

Google Cloud Platform 1.5k Jan 05, 2023
Margin Calculator - Personally tailored investment tool

Margin Calculator - Personally tailored investment tool

1 Jul 19, 2022
switching computer? changing your setup? You need to automate the download of your current setup? This is the right tool for you :incoming_envelope:

🔮 setup_shift(SS.py) switching computer? changing your setup? You need to automate the download of your current setup? This is the right tool for you

Mohamed Elfaleh 15 Aug 26, 2022
Python calculator made with tkinter package

Python-Calculator Python calculator made with tkinter package. works both on Visual Studio Code Or Any Other Ide Or You Just Copy paste The Same Thing

Pro_Gamer_711 1 Nov 11, 2021
Snek-test - An operating system kernel made in python and assembly

pythonOS An operating system kernel made in python and assembly Wait what? It us

TechStudent10 2 Jan 25, 2022
Make pack up python files easier.

python-easy-pack make pack up python files easier. 目前只提供了中文环境 如何使用? 将index.py复制到你的项目文件夹,或者把.py文件拷贝到这个文件夹。 打开你的cmd或者powershell 切换到程序所在目录,输入python index

2 Dec 15, 2021
An kind of operating system portal to a variety of apps with pure python

pyos An kind of operating system portal to a variety of apps. Installation Run this on your terminal: git clone https://github.com/arjunj132/pyos.git

1 Jan 22, 2022
Dyson Sphere Program Blueprint Toolkit

dspbptk This is dspbptk, the Dyson Sphere Program Blueprint toolkit. Dyson Sphere Program is an amazing factory-building game by the incredibly talent

Johannes Bauer 22 Nov 15, 2022
Camera track the tip of a pen to use as a drawing tablet

cablet Camera track the tip of a pen to use as a drawing tablet Setup You will need: Writing utensil with a colored tip (preferably blue or green) Bac

14 Feb 20, 2022
List of Linux Tools I put on almost every linux / Debian host

Linux-Tools List of Linux Tools I put on almost every Linux / Debian host Installed: geany -- GUI editor/ notepad++ like chkservice -- TUI Linux ser

Stew Alexander 20 Jan 02, 2023
Mpis-ex7 - Implementation of tasks 1, 2, 3 for Metody Probabilistyczne i Statystyka Lista 7

Implementations of task 1, 2 and 3 from here Author: Maciej Bazela Index: 261743 Each task was implemented in Python 3. I've used Cython to speed up e

Maciej Bazela 1 Feb 27, 2022
Minos-python - A framework which helps you create reactive microservices in Python

minos-python Summary [TODO] Packages minos-microservice-aggregate minos-microser

Minos Framework 380 Jan 04, 2023
A simple program which gets a file(CSV/Excel) with tasks and creates different variants

TestMakerProject A simple program which gets a file(CSV/Excel) with tasks and creates different variants The main program is QTengine.py You only have

George 3 Nov 18, 2021