thomaspaulin.me

Latest Posts

How can I run commands using poetry in one virtualenv from another virtualenv?

Via Shell Poetry uses the environment variable “VIRTUAL_ENV” for determining the activate virtual environment in many cases, this means if you delete this environment variable when running subprocesses you can load new virtual environments. Consider the following directory structure: . ├── app │ ├── poetry.lock │ └── pyproject.toml ├── main.py ├── poetry.lock └── pyproject.toml If you run poetry shell then poetry env info you’ll see the root level virtual environment is used.

How many S3 buckets can I have per account?

By default AWS accounts can have up to 100 per account, but I’ve seen situations when running AWS CDK where I temporarily hit 101 buckets and receive an error in my terminal.

What happens if I deploy an AWS Code Pipeline via AWS CDK, but I already have 100 S3 buckets in my account?

When creating AWS Code Pipelines using AWS CDK an intermediate S3 bucket is created. This bucket holds the pipeline artifacts such as AWS Lambda code, or CloudFormation templates. This means that you need room in your AWS account to create a new S3 bucket if you’re deploying your pipeline (You may created 100 S3 buckets per-account by default). If you’re already at this limit the AWS CDK CLI will give you an error like the below:

How to write a Python Lambda function in AWS CDK (without Docker)

Most of the time you when you write Python code for AWS Lambda Functions you’ll include external dependencies such as boto3. There are two approaches you can take to including those dependencies. You create a Docker-based function and run pip install or otherwise within the image build process. You create a zip file containing your code and the appropriate vendor code e.g. you bundle your virtualenv’s site-packages folder and configure your PYTHONPATH as appropriate.

What is the ISO country code for Kosovo/other unrecognised countries?

The short answer: UNK for Kosovo travel documents, but a code prefixed with “X” in general terms. The long answer: ISO 3166-1 alpha-2 and ISO 3166-1 alpha-3 define the two and three-letter codes for countries, respectively, but some unrecognised countries such as Kosovo have no such code. Because ISO-3166 reserves the “X” prefix for user-assigned codes it is often used where an alpha-2 or alpha-3 value is missing. Note that some “X” prefixed codes are in use by travel document specifications, where Kosovo uses UNK, and NATO.

Testing logic reliant upon "compile-time" calls to os.getenv with default values

In Python we can initialise variables at the top-level in the following way: is_production = True I recently ran into a quirk of this behaviour when trying to mock the return value of os.getenv which had a default value. I was trying to parse a boolean value from an environment variable whose default value was evaluated as follows: is_production = os.getenv("IS_PRODUCTION", "true").upper() == "TRUE" I mocked os.getenv using monkeypatch as recommended by pytest only to discover that using importing at the top-level was insufficient.

Rocket Engine or Rocket Motor? Which is correct?

Historically the word “motor” was used when referring to solid fueled rockets, and “engines” for liquid fueled. Unfortunately, this rule breaks down for hybrid rockets where the fuel can be solid, or the oxidiser can be solid. That being said, most refer to hybrid rockets as motors. These days the two words are used interchangeably. For example, the Wikipedia page for ullage motors uses a combination of “motor” and “engine”.

The Role Of Ullage Rockets in Restarting a Primary Rocket Engine

This is a Saturn V. You probably recognise it, and its engines, but do you recognise these? The Saturn V’s S-IVB stage with its ullage rockets highlighted They are ullage rockets1. While unknown to many, they are crucial to the success of a mission. The term “ullage” is one that comes from wine making where it refers to the empty space of a container. The ullage of a beer barrel

Oxygen Need Not Be Present

Why Rockets Don’t Need Oxygen As many articles and videos throughout the internet explain, a rocket moves in accordance with Newton’s third law of motion by ejecting matter, in one direction so that the reaction force produces motion in the opposite. The object of a rocket motor is to provide thrust, it does this by ejecting a stream of (usually hot) gas at high velocity. Liquid bipropellant engines combine a fuel with an oxidiser in either a solid or liquid form, then combust the mixture to produce gases.

View All 11 Posts