Skip to content

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!

@rgaiacs
Copy link
Contributor

rgaiacs commented Aug 28, 2025

@manics do you want to press the green button?

@manics manics merged commit 664c272 into jupyterhub:main Aug 28, 2025
21 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in PR triage (experimental) Aug 28, 2025
@manics manics deleted the runtime-version-date branch August 28, 2025 12:35
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
None yet
Development

Successfully merging this pull request may close these issues.

3 participants