diff --git a/content/resources/presentations/2024-07-10-Python_Packaging/index.md b/content/resources/presentations/2024-07-10-Python_Packaging/index.md new file mode 100644 index 00000000000..18cc434f414 --- /dev/null +++ b/content/resources/presentations/2024-07-10-Python_Packaging/index.md @@ -0,0 +1,48 @@ +--- +title: "Packaging Python CLIs and GUIs for air-gapped computers" + +summary: "A lightning talk about how to package Python applications for air-gapped computers" + +# Talk start and end times. +# End time can optionally be hidden by prefixing the line with `#`. +date: "2024-07-10" +# date_end: "2030-06-01T15:00:00Z" +all_day: false + +# Schedule page publish date (NOT talk date). +publishDate: "2024-07-09" + +authors: [reto] +tags: [] + +# Is this a featured talk? (true/false) +featured: false + +#image: +# caption: 'Image credit: [**Unsplash**](https://unsplash.com/photos/bzdhc5b3Bxs)' +# focal_point: Right + +links: +# url_pdf: "files/presentations/2020-10-27-NuGrid/iniabu-slides.pdf" +url_slides: "files/presentations/2024-07-10_Python_Packaging/python_packaging.html" + +# Markdown Slides (optional). +# Associate this talk with Markdown slides. +# Simply enter your slide deck's filename without extension. +# E.g. `slides = "example-slides"` references `content/slides/example-slides.md`. +# Otherwise, set `slides = ""`. +slides: "" + +# Projects (optional). +# Associate this post with one or more of your projects. +# Simply enter your project's folder or file name without extension. +# E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`. +# Otherwise, set `projects = []`. +# projects: +# - internal-project + +# Enable math on this page? +math: true +--- + +Python is an amazing language when it comes to rapidly developing instrument control or data evaluation programs. However, when you want to package your program such that it can run on an air-gapped computer, the situation becomes a bit more tricky. In this very brief talk I give an overview of what tools are available and talk in more detail about [PyApp](https://ofek.dev/pyapp) and [box](https://box.rtfd.io), two tools that might can help with these tasks. diff --git a/static/files/presentations/2024-07-10_Python_Packaging/graphics/boxes.jpg b/static/files/presentations/2024-07-10_Python_Packaging/graphics/boxes.jpg new file mode 100644 index 00000000000..a4e3d7bc276 Binary files /dev/null and b/static/files/presentations/2024-07-10_Python_Packaging/graphics/boxes.jpg differ diff --git a/static/files/presentations/2024-07-10_Python_Packaging/graphics/elliot-wilkinson-ZcRYzw3UCvY-unsplash.jpg b/static/files/presentations/2024-07-10_Python_Packaging/graphics/elliot-wilkinson-ZcRYzw3UCvY-unsplash.jpg new file mode 100644 index 00000000000..5fdfa3e8fad Binary files /dev/null and b/static/files/presentations/2024-07-10_Python_Packaging/graphics/elliot-wilkinson-ZcRYzw3UCvY-unsplash.jpg differ diff --git a/static/files/presentations/2024-07-10_Python_Packaging/graphics/lion_narrower.jpg b/static/files/presentations/2024-07-10_Python_Packaging/graphics/lion_narrower.jpg new file mode 100644 index 00000000000..eae9b67e195 Binary files /dev/null and b/static/files/presentations/2024-07-10_Python_Packaging/graphics/lion_narrower.jpg differ diff --git a/static/files/presentations/2024-07-10_Python_Packaging/graphics/questions.jpg b/static/files/presentations/2024-07-10_Python_Packaging/graphics/questions.jpg new file mode 100644 index 00000000000..b5feed2e344 Binary files /dev/null and b/static/files/presentations/2024-07-10_Python_Packaging/graphics/questions.jpg differ diff --git a/static/files/presentations/2024-07-10_Python_Packaging/python_packaging.html b/static/files/presentations/2024-07-10_Python_Packaging/python_packaging.html new file mode 100644 index 00000000000..2e4d7bf5241 --- /dev/null +++ b/static/files/presentations/2024-07-10_Python_Packaging/python_packaging.html @@ -0,0 +1,155 @@ +Packaging Python CLIs and GUIs for air-gapped computers
+

Packaging Python CLIs and GUIs for air-gapped computers

+

Reto Trappitsch
+July 10, 2024

+
Python Packaging | Reto Trappitsch | July 10, 2024
+
+
+

Why should we care?

+
    +
  • Home-built instruments require home-built software
  • +
  • Python has a great ecosystem +
      +
    • Instrument control
    • +
    • Data analysis
    • +
    +
  • +
  • But: Instrument computers are often air-gapped to run outdated software
  • +
  • We can't just pip install dependencies!
  • +
+
Python Packaging | Reto Trappitsch | July 10, 2024
+
+
+

The human aspect

+
    +
  • Yes, dependency installation can be done offline but it's tricky
  • +
  • Updates require lots of manual work
  • +
  • The user needs to understand the python issues in detail
  • +
  • Overall, it's just not a good situation
    +

  • +
+
Photo by Elliot Wilkinson on Unsplash
+
Python Packaging | Reto Trappitsch | July 10, 2024
+
+
+

Some possible solutions

+
    +
  • PyInstaller: +
      +
    • Works well, but can be tricky
    • +
    +
  • +
  • py2exe: +
      +
    • Windows only (so no!)
    • +
    +
  • +
  • PyOxidizer: + +
  • +
  • fbs - a wrapper around PyInstaller: +
      +
    • Not open source
    • +
    • Works well for GUIs, creates installers
    • +
    • Is it still maintained?
    • +
    +
  • +
+
Python Packaging | Reto Trappitsch | July 10, 2024
+
+
+

PyApp - A new solution to an old problem

+
    +
  • A wrapper for python packages that bootstrap themselves at runtime
  • +
  • Package a project locally or directly from PyPi
  • +
  • Uses indygreg's highly-reproducable builds for standalone python
  • +
  • Example: Python project manager hatch is packaged via PyApp (both developped by Ofek Lev)
  • +
+

center

+
Python Packaging | Reto Trappitsch | July 10, 2024
+
+
+

And what does the user see?

+

center

+
Python Packaging | Reto Trappitsch | July 10, 2024
+
+
+

But you mentioned air-gapped machine in the title!

+
    +
  • We can provide a standalone python build with all dependencies pre-installed!
  • +
  • PyApp environment variables allow us to skip installation via pip upon first run
  • +
  • Thus, no internet connection is required for the user!
  • +
  • My own notes on this: this GitHub gist
  • +
+
Python Packaging | Reto Trappitsch | July 10, 2024
+
+
+

boxing your apps

+
    +
  • Configure your app inside pyproject.toml
  • +
  • Environment agnostic
  • +
  • Package with PyApp for CLIs or GUIs
  • +
  • Create installers for Linux, Windows, and MacOS
  • +
  • Runs on GitHub actions
  • +
  • NOT production ready!
  • +
+
Python Packaging | Reto Trappitsch | July 10, 2024
+
+
+

Questions?

+
    +
  • Where can I try all of this? + +
  • +
  • You forgot [insert alternative here]! +
      +
    • Not actually a question ;)
    • +
    • Please let me know though!
    • +
    +
  • +
  • Where can I find all the links and slides? + +
  • +
  • Can I test this? Yes please!
  • +
  • Can I help? Yes please, let's talk!
  • +
+
Python Packaging | Reto Trappitsch | July 10, 2024
+
+
\ No newline at end of file