python
Author

George Girton

Published

June 1, 2022

Sad Python Girls Origin Story

https://twitter.com/sadpythongirls

(not to be confused with @sadpythonnft) So from listening to this cheery podcast, I found out that pyodide is definitely still around. Also, the sad girl with the cats says she learned from a guy named Brett that when you use the python print statement, you can add something to the end of it. I knew that from reading “Creative Coding in Python,” which I checked out of the library, but then I did check it out, and …

Code
    print(42, end='!')
42!

Sure enough!

So!

The first thing I learned was you have to call batect like this (this is even after marking it with chmod +x batect):

./batect

because otherwise it doesn’t recognize the command.

So then, it DOES download the jar and says “No task name provided, …”

etce etc etc

Ok, BUild and Test Environment As Code Tool (bateact)

https://svenbalnojan.medium.com/batect-build-and-test-environments-as-code-with-a-python-sample-project-47903d7cded8

So, now we have defined our batect.yml and we try to run the thing:

 ./batect --list-tasks

But in the example, it says ‘Invalid option’-’. because they must have ben using something that changes dash-dash to long-dash, and never bothered to proofread it. Not at minimum viable python, dear reader!

WE know, and we get the listing:

Utility tasks:
- shell: Install deps; Start a shell in the development environment.

SO, now we try

./batect shell

AAND!:

Batect can collect anonymous environment, usage and performance information.
This information does not include personal or sensitive information, and is used only to help improve Batect.
More information is available at https://batect.dev/privacy, including details of what information is collected and a formal privacy policy.

Is it OK for Batect to collect this information? (Y/n)

We say yes.

In red:

Docker is not installed, not running or not compatible with Batect: Cannot connect to '/var/run/docker.sock': No such file or directory

You think we’re sitting around runnin’ Docker all the time? We are not!

open -a Docker

Opportunity is presented to updat docker! Accepted!

Must enter password for helpers.

The new `docker sbom` CLI command displays the SBOM (Software Bill Of Materials) of any Docker image. 

A new docker command, yeah!

finally, again

./batect shell

And it is doing its docker magicks

And we can start python and print 42 in the repl, in the docker containershell. but.

Reading this, I can see a tough road ahead for this example >>>Now at first, I thought I could get the virtual environment out of the container, but for some obvious reasons, this is not gonna work. First, because virtual environments don’t work that way, second because the Python binaries are of course operating system dependent, and third because even with installing only non-binaries, I ran into trouble. So if you want to use the build & test environment to develop as well, you’ll either have to connect your IDE to the docker interpreter which for instance Atom + remote kernel or PyCharm Pro can do or simply use the Pipfile.lock to create your local environment.<<<

— all photos Copyright © 2022-2024 George D Girton all rights reserved