bookmark_borderMinimiser la taille de ses lambdas en évitant d’avoir boto3 et ses stubs dans le paquet à déployer

Si vous avez des problèmes de lambdas AWS qui excèdent la limite de 250Mo, voici une astuce qui pourrait vous aider.

Continue reading “Minimiser la taille de ses lambdas en évitant d’avoir boto3 et ses stubs dans le paquet à déployer”

bookmark_borderExplications et astuces d’utilisation de poetry

Pour ceux qui sont habitués à utiliser un environnement virtuel «de base» avec virtualenv, poetry peut être déroutant. Voici quelques éclaircissements et certains trucs avec l’utilisation de poetry.

Continue reading “Explications et astuces d’utilisation de poetry”

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.tomllike before.

bookmark_borderPython code formatters comparison: Black, autopep8 and YAPF

Following some discussions at work and the will of the team to adopt a python code formatter, I set out to explore some of them. No need to say, the contenders had to aim towards pep8 compliance. Here are my findings on three of them.
Continue reading “Python code formatters comparison: Black, autopep8 and YAPF”

bookmark_borderPython logging to stackdriver

I recently deployed a python application in google app engine / container engine. When I went to check the logs, everything was logged at the “ERROR” level even though my application uses python logging properly. As far as I know there are 2 ways to fix that:

  1. Use the stackdriver client, which requires an additional dependency and somewhat binds your program to google app engine.
  2. Format the logs in a way that stackdriver can parse them, which is easily configurable.

Continue reading “Python logging to stackdriver”

bookmark_borderRecipe: Testing multiple python versions with pyenv and tox

If you develop a ton of python applications and you need to test under a lot of different versions, and by a lot I mean overlapping major/minor versions (like 3.5.3 and 3.5.4), then a good option is to use pyenv. Along with tox, you can easily test your application against various major/minor versions.

Here is how to do it.
Continue reading “Recipe: Testing multiple python versions with pyenv and tox”

bookmark_borderRecipe: Google App Engine, Cloud SQL and sqlalchemy

Here is a recipe on how I made those thing work together both on a linux development environment and in production. The important thing to remember is: just like recipes for brownies, there are other recipes to achieve the same thing.

The following steps assume you have a Google cloud account with the proper permissions.

Continue reading “Recipe: Google App Engine, Cloud SQL and sqlalchemy”

bookmark_borderLecture: Machine Learning in Action

Après un peu plus de 3 années passées chez Datacratic, il était grand temps que je m’intéresse davantage à l’apprentissage machine. C’est le livre Machine Learning in Action que j’ai choisi pour me lancer.

Continue reading “Lecture: Machine Learning in Action”






Machine Learning in Action Book Cover




Machine Learning in Action





Peter Harrington





Computers




Manning Publications




2011-12




354



Provides information on the concepts of machine theory, covering such topics as statistical data processing, data visualization, and forecasting.

bookmark_borderC++ / Python Wrapping and system_signal_exception

 

While working on a C++ program that made use of a Python wrapped library to start a subprocess, when the subprocess crashed I got a boost::detail::system_signal_exception at the C++ level even though the executing context was still on the python layer. How is that possible?

Continue reading “C++ / Python Wrapping and system_signal_exception”