Dominique Dumont: Drawbacks of using Cookiecutter with Cruft
Hi
Cookiecutter is a tool for building coding project templates. It s often used to provide a scaffolding to build lots of similar project. I ve seen it used to create Symfony projects and several cloud infrastructures deployed with Terraform. This tool was useful to accelerate the creation of new projects.
Since these templates were bound to evolve, the teams providing these template relied on cruft to update the code provided by the template in their user s code. In other words, they wanted their users to apply a diff of the template modification to their code.
At the beginning, all was fine. But problems began to appear during the lifetime of these projects.
What went wrong ?
In both cases, we had the following scenario:
Note that code conflicts seen with cruft are similar to git merge conflicts, but harder to resolve because, unlike with a git merge, there s no common ancestor, so 3-way merges are not possible.
From an organisation point of view, the main problem is the ambiguous ownership of the functionalities brought by template code: who own this code ? The provider team who writes the template or the user team who owns the repository of the code generated from the template ? Conflicts are bound to happen.
Possible solutions to get out of this tar pit:
Since these templates were bound to evolve, the teams providing these template relied on cruft to update the code provided by the template in their user s code. In other words, they wanted their users to apply a diff of the template modification to their code.
At the beginning, all was fine. But problems began to appear during the lifetime of these projects.
What went wrong ?
In both cases, we had the following scenario:
- user team:
creates new project with cookiecutter template
makes modification on their code, including on code provided by template
- meanwhile, provider team:
makes modifications to cookiecutter template
releases new template version
asks his users to update code brought by template using cruft
- user team then:
runs cruft to update template code
discovers a lot of code conflicts (similar to git merge conflicts)
often rolls back cruft update and gives up on template update
Note that code conflicts seen with cruft are similar to git merge conflicts, but harder to resolve because, unlike with a git merge, there s no common ancestor, so 3-way merges are not possible.
From an organisation point of view, the main problem is the ambiguous ownership of the functionalities brought by template code: who own this code ? The provider team who writes the template or the user team who owns the repository of the code generated from the template ? Conflicts are bound to happen.
Possible solutions to get out of this tar pit:
- Assume that template are one shot. Template update are not practical in the long run.
- Make sure that template are as thin as possible. They should contain minimal logic.
- Move most if not all logic in separate libraries or scripts that are owned by provider team. This way update coming from provider team can be managed like external dependencies by upgrading the version of a dependency.









. I guess that, in the cron job, just checking the list of PV to snapshot was enough to exhaust our API quota.
Azure
I was puzzled
.
I looked for similar problems in
I was flabbergasted
by this parameter: why is CSI file driver able to use 2 APIs ? Why is one on them so limited ? And more importantly, why is the limited API the default one ?
Anyway, setting
But not the snaphot issue
. Amongst the 80 PV, I still had 2 snaphots failing.
Fortunately, the error was mentioned in the description of the failed snapshots: we had too many (200) snapshots for these shared volumes.
What ??
All these snapshots were cleaned up last week.
I then tried to delete these snaphots through azure console. But the console failed to delete these snapshot due to API throttling. Looks like Azure console is not using the right API.
Anyway, I went back to the solution explained in my previous blog, I listed all snapshots with
. What a mess.
Anyway, I ve cleaned up again these bogus snapshot
, and now, snaphot creation is working fine
.
For now.
All the best.
A few ago I may have accidentally bought a
Dear Debian community,
this is bits from DPL for January.
Sovereign Tech Agency
I was recently pointed to Technologies and Projects supported by the
Quick to deploy which is what I was after. My new 5m of coax with a choke fitted attached to the radio and we were off to the races - A convenient thing of beauty when it s up:
I ve made a single guy with a sotabeams
For many years I wished I had a setup that would allow me to work (that is, code) productively outside in the bright sun. It s winter right now, but when its summer again it s always a bit. this weekend I got closer to that goal.
TL;DR: Using
Passively lit coding





Internationalization support in Picolibc
There are two major internationalization APIs in the C library:
locales and iconv. Iconv is an isolated component which only performs
charset conversion in ways that don't interact with anything else in
the library. Locales affect pretty much every API that deals with
strings and covers charset conversion along with a huge range of
localized information from character classification to formatting of
time, money, people's names, addresses and even standard paper sizes.
Picolibc inherits it's implementation of both of these from
newlib. Given that embedded applications rarely need advanced
functionality from either these APIs, I hadn't spent much time
exploring this space.
Newlib locale code
When run on Cygwin, Newlib's locale support is quite complete as it
leverages the underlying Windows locale support. Without Windows
support, everything aside from charset conversion and character
classification data is stubbed out at the bottom of the stack. Because
the implementation can support full locale functionality, the
implementation is designed for that, with large data structures and
lots of code.
Charset conversion and character classification data for locales is
all built-in; none of that can be loaded at runtime. There is support
for all of the ISO-8859 charsets, three JIS variants, a bunch of
Windows code pages and a few other single-byte encodings.
One oddity in this code is that when using a JIS locale, wide
characters are stored in EUC-JP rather than Unicode. Every other
locale uses Unicode. This means APIs like wctype are implemented by
mapping the JIS-encoded character to Unicode and then using the
underlying Unicode character classification tables. One consequence of
this is that there isn't any Unicode to JIS mapping provided as it
isn't necessary.
When testing the charset conversion and Unicode character
classification data, I found numerous minor errors and a couple of
pretty significant ones. The JIS conversion code had the most serious
issue I found; most of the conversions are in a 2d array which is
manually indexed with the wrong value for the length of each row. This
led to nearly every translated value being incorrect.
The charset conversion tables and Unicode classification data are now
generated using python charset support and the standard Unicode data
files. In addition, tests have been added which compare Picolibc to
the system C library for every supported charset.
Newlib iconv code
The iconv charset support is completely separate from the locale
charset support with a much wider range of supported targets. It also
supports loading charset data from files at runtime, which reduces the
size of application images.
Because the iconv and locale implementations are completely separate,
the charset support isn't the same. Iconv supports a lot more
charsets, but it doesn't support all of those available to
locales. For example, Iconv has Big5 support which locale
lacks. Conversely, locale has Shift-JIS support which iconv does not.
There's also a difference in how charset names are mapped in the two
APIs. The locale code has a small fixed set of aliases, which doesn't
include things like US-ASCII or ANSI X3.4. In contrast, the iconv
code has an extensive database of charset aliases which are compiled
into the library.
Picolibc has a few tests for the iconv API which verify charset names
and perform some translations. Without an external reference, it's
hard to know if the results are correct.
POSIX vs C internationalization
In addition to including the iconv API, POSIX extends locale support
in a couple of ways:
With all the recent buzz about
The fourteenth release of the