Incremental Build issue - always builds due to mismatched checksum

Hi all,

I’m new to PlatformIO and Python so be gentle with me.

I have an issue with an Arduino project whereby every build does a full build. I’ve tracked it down to:
with .platformio/penv/lib/python3.5/site-packages/platformio/…

  • commands/ calls clean_build_dir(build_dir, config)
  • run/ calculates and stores a checksum in buld/project.checksum. The checksum is calculated from the platformio version, the current config and the project source files. Unfortunately this is giving me a different checksum for every incremental build on my system - this is despite the fact that none of those things have changed.

The issue appears to be with project/ and for the checksum of the config. It uses

Unfortunately, config.to_json is non-deterministic in that the order of the config sections appears to be random.

This appears to be due to project/ which uses
return {s: self.items(s, as_dict=True) for s in self.sections()}
This iteration order appears to be undefined and I’m new to Python so cannot figure out how to fix it.

I did find, though, in [Functional Programming HOWTO — Python 3.11.1 documentation] :

Note that starting with Python 3.7, dictionary iteration order is guaranteed to be the same as the insertion order. In earlier versions, the behaviour was unspecified and could vary between implementations.

Given that I’m on 3.5.3 of Python I guess that is my problem. Can anyone recommend a code fix other than upgrading to the later python.

Many Thanks,

I’m using:
OS: Debian 9
Code: 1.39.2
platformio 4.1.0b4
Python 3.5.3

This is a bug and was fixed in the latest PIO Core 4.1 RC. The final release is coming today.

1 Like

Thank you. Its fantastic that PlatormIO is so well supported.