Skip to content

Move runtime.txt parsing into base class #1428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

manics
Copy link
Member

@manics manics commented Jun 24, 2025

There's a discussion somewhere (I can't remember where) about using https://github.com/astrofrog/pypi-timemachine or similar so Python packages can be installed as if pip were run in the past, similar to R. If we do this we should define the cutoff date for Python in the same way as for R, which is to use runtime.txt.

Something to consider is we haven't formally defined what runtime.txt contains.

Our docs state it should be one of:

  • name-version-yyyy-mm-dd: (r-<RVERSION>-<YYYY>-<MM>-<DD>)
  • name-version: (python-x.y)
    Have ``python-x.y`` in ``runtime.txt`` to run the repository with Python version x.y.
    See our `Python2 example repository <https://github.com/binder-examples/python2_runtime/blob/HEAD/runtime.txt>`_.
    Have ``r-<RVERSION>-<YYYY>-<MM>-<DD>`` in ``runtime.txt`` to run the repository with R version RVERSION and libraries from a YYYY-MM-DD snapshot of `Posit Package Manager <https://packagemanager.posit.co/client/#/repos/2/overview>`__.
    RVERSION can be set to 3.4, 3.5, 3.6, or to patch releases for the 3.5 and 3.6 series.
    If you do not specify a version, the latest release will be used (currently R 3.6).
    See our `R example repository <https://github.com/binder-examples/r/blob/HEAD/runtime.txt>`_.

Our tests say it can also be:

This PR handles all three formats. I've made a breaking change and redefined the existing .runtime property instead of creating a new one to avoid leaving an unused .runtime property that may cause confusion in the future.

Copy link
Contributor

@rgaiacs rgaiacs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. A small change in docs/source/changelog.md is needed.

@@ -1,5 +1,10 @@
# Changelog

## Unreleased breaking changes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this will require a rebase given that we made a release in August 2025, see https://github.com/jupyterhub/repo2docker/releases/tag/2025.08.0.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changelog wasn't updated for that release, I've added to reminder to fix that
#1449

except FileNotFoundError:
return self._runtime

name = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only support Python and R. I prefer to validate name against a list.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered that, but it breaks the abstraction where subclasses are responsible for calling and validating .runtime. runtime.txt is only parsed if the property is accessed, so we can't guarantee any validation.

Copy link
Member

@minrk minrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buildpack maintenance Under the hood fixes and improvements
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

3 participants