CloudFlare Pages... support standard runtime.txt files in Python monorepo?

I am trying to use a monorepo (to keep code DRY) that I use both on Heroku for a Python background worker task, but where the frontend is on CloudFlare Pages (using a custom build script).

The problem is, CloudFlare Pages seems to have copied the Netlify build platform parser, which incorrectly parses ‘runtime.txt’ file contents. This is a Python-specific file format invented by Heroku, which accepts the Python runtime in format like:

python-X.Y or
python-X.Y.Z (e.g. python-3.7.11)

However, the CloudFlare Pages build environment expects a format like:

X.Y

Where the “python-” string is removed and no minor revisions are supported.

This means I cannot use my monorepo for both services, and have to fork them to have one for Heroku where the file says basically “python-3.7.11” and the CloudFlare Pages version says “3.7”

This seems silly since runtime.txt is a Heroku-invented concept.

I cannot find that the CloudFlare Pages build system is open source. Am I wrong?
If it isn’t, is there any way the CloudFlare Pages build system could support the Heroku format so customers like me can keep their code DRY and not maintain edits in two otherwise-identical repos?

Thanks.

Hey, this is not something I am familiar with but I do see it mentioned a few months ago in the Discord. I will poke the team about it and see if there are any updates there.

I recommend joining the Discord, it’s a great place to ask and find answers to these kind of questions! You can join here: Cloudflare Workers

1 Like