Today, at the suggestion of a college (Zachary Paden), I contemplated the idea of migrating my tests using python/monkeypatch to moto. Here I will share my journey and observations.
Continue reading “boto3 – From monkeypatch to moto”Category: IT
Information Technology
bookmark_borderMinimize the size of lambdas by deleting boto3 from the deployment package
Last April, I wrote a post about managing boto3 in deployed packages. (See Minimizing the size of lambdas by avoiding having boto3 and its stubs in the deployment package). This approach works when all dependencies can be set in the development section.
But, what about when dependencies are required in production? For example, we recently had to deploy a lambda that depends on awswrangler. So the technique suggested in the previous post did not work. Here I will cover a different approach that allows to remove boto3 from the package to be deployed in the example context. It is however less flexible and based on a specific technology: serverless.
Continue reading “Minimize the size of lambdas by deleting boto3 from the deployment package”bookmark_borderRecipe: Run a local copy of a WordPress site with Docker
I recently decided to publish my articles in French and in English. First, I had to find and test plugins in order to choose one. So I spent some time, more than I expected, to make it work locally through Docker. Since I encountered some pitfalls, I decided to share the recipe.
Continue reading “Recipe: Run a local copy of a WordPress site with Docker”bookmark_borderCreating a pydantic model for GIS polygons
In this article, I will explain how to create a pydantic model to validate and create polygons for GIS (geographic information systems).
Continue reading “Creating a pydantic model for GIS polygons”bookmark_borderHow to integrate mypy in existing projects
Here is simply how I went about integrating mypy into a few projects. This post assumes you are using git and have a test system in place.
Continue reading “How to integrate mypy in existing projects”bookmark_borderPython poetry: Explanations and tips
For those who are used to using a “basic” virtual environment with virtualenv, poetry can be confusing. Here are some clarifications and tips on using poetry.
Continue reading “Python poetry: Explanations and tips”bookmark_borderMinimizing the size of lambdas by avoiding having boto3 and its stubs in the deployment package
If you are having problems with AWS lambdas exceeding the 250MB limit, here is a tip that might help.
Continue reading “Minimizing the size of lambdas by avoiding having boto3 and its stubs in the deployment package”bookmark_borderUsing Selenium to Roll Out Changes to Gihub Settings
Your company is rolling out a new policy and need you to change settings across many repositories? That sounds like a very repetitive task that can be easily automated. I just did it with Selenium. Here is the recipe.
Continue reading “Using Selenium to Roll Out Changes to Gihub Settings”bookmark_borderPython Poetry Index Error – list index out of range
You run poetry and get this (undescriptive) error message.
[IndexError]
list index out of range
So far I’ve identified two things that you need to check.
- Credentials: If you are installing packages from a private repository, make sure poetry credentials are right.
- Presence of all required files in local packages: If you are installing a package from local files, make sure all files mentioned in the
packages
section of itspyproject.toml
file are present. (I mostly got this error while building on Docker when forgetting to add them all in theDockerfile
.
bookmark_borderpython poetry 1.0.0 private repo issue fix
On December 12th 2019, poetry v1.0.0 was released. With it, came a bad surprise for me: My CI/CD jobs as well as my Docker image builds started failing.
After investigating, I’ve found out that the password key/value was now missing from the .config/pypoetry/auth.toml
file. Digging some more, I’ve found out that poetry relies on a library called keyring to manage passwords.
Here is what I did to fix the problem.
First, I’ve noticed that poetry falls back to the previous method if keyring returns RuntimeError
when it is called. Nice. It turns out that keyring comes with a backend aptly named “fail” which does that whatever the call is. So, it’s only a matter of configuring it.
As the keyring documentation states it, run python -c "import keyring.util.platform_; print(keyring.util.platform_.config_root())"
to find where to put the configuration file. Then, in that directory, create keyringrc.cfg
and put the following content in it:
[backend]
default-keyring=keyring.backends.fail.Keyring
That’s it. Now you can call poetry config http-basic....
the same way you used to and the password will be stored in auth.toml
like before.