PowerShell Short Scripts

When dealing with Python dependencies, it’s sometimes necessary to determine if a given project is using a given version of a library. Since our team is using Pipenv to manage our Python dependencies, it’s not very difficult to determine which version of a given library is in a given project, but what can be tricky is actually searching through the Pipfile.lock file to find what you’re looking for, and if you need to look at multiple packages, well, this could take a while.

Fortunately, we know that PowerShell can easily chew through JSON files and pick out values. Here’s how we can easily print out the versions of all of our default and development dependencies:

function Get-PythonEnvironment {
    $pipfile = Get-content .\Pipfile.lock | ConvertFrom-Json
    $default = $pipfile | Select-Object -ExpandProperty default
    $develop = $pipfile | Select-Object -ExpandProperty develop
    @($default,  $develop) | ForEach-Object {$_.PSObject.Properties `
        | ForEach-Object {$_ | Select-Object Name -ExpandProperty Value | Where-Object index -ne $null | Select-Object name, version}}
}

The output to this is similar to what you’d get from pip freeze except that only items appearing in the Pipfile.lock file will appear in this list. This can be helpful to quickly figure out if a new library was pulled in after locking a pipfile, for example.

2025

Making PowerShell “Posh”

Back in the days when DOS and Windows were separate programs, the default Command Prompt didn’t look exactly the way that it does now. I can’t recall if it w...

Back to Top ↑

2024

PowerShell Short Scripts

As a Data Engineer using Mirth Connect, it’s often tricky to review my team’s merge requests because the merge request document contains the XML representati...

PowerShell Short Scripts

When dealing with Python dependencies, it’s sometimes necessary to determine if a given project is using a given version of a library. Since our team is usin...

Storing dotfiles in GitHub Revisited

A while ago, I wrote about using a bare git repository to manage my dotfiles. That worked somewhat well, but it had some shortcomings. Since, I’ve started us...

Python Context Managers

One of my current projects involves some improvements to code that I wrote last year – specifically enhancing the “Patient Identity Fixer”, which is my pet p...

PowerShell for Data Transformation: JSON

My team at work has a custom FHIR resource that we work with often called an Operation Outcome. We generate one of these for nearly every record we process, ...

Back to Top ↑

2021

Raspberry Pi Zero W “Busy Light”

COVID-19 has us many of us working from home. My husband and I are both fortunate enough to be in this group. However, as a teacher, his schedule is very pre...

Back to Top ↑

2020

Raspberry Pi Setup Script

When I set up a Raspberry Pi, there are a few things that I have to do right out of the gate to make things easier on myself. They involve putting a few file...

Storing dotfiles in GitHub

While I don’t use Linux as my primary operating system, I do use it a lot both at home and at work. It can be frustrating to try to sync up configurations be...

Nitro Cold Brew at Home!

Anyone who knows my husband or me knows that we really like our cold brew, and they also know that we make our own at home. Nitro cold brew has become a bit ...

OpenVPN On Raspberry Pi

So you want to run an OpenVPN Server on a Raspberry Pi? I did too, but it wasn’t easy to figure out the first time. If you want to skip all of this and do it...

Back to Top ↑