# Buggy code
def build_ephem_interpolant(body, period, t_span, rtol=1e-5):
    """Interpolates ephemerides data

    Parameters
    ----------
    body : Body
        Source body.
    period : ~astropy.units.Quantity
        Orbital period.
    t_span : list(~astropy.units.Quantity)
        Initial and final epochs.
    rtol : float, optional
        Relative tolerance. Controls the number of sampled data points,
        defaults to 1e-5.

    Returns
    -------
    intrp : ~scipy.interpolate.interpolate.interp1d
        Interpolated function.

    """
    h = (period * rtol).to(u.day).value
    t_span = (t_span[0].to(u.day).value, t_span[1].to(u.day).value + 0.01)
    t_values = np.linspace(*t_span, int((t_span[1] - t_span[0]) / h))
    r_values = np.zeros((t_values.shape[0], 3))

    for i, t in enumerate(t_values):
        epoch = Time(t, format="jd", scale="tdb")

        r = get_body_barycentric(body.name, epoch)
        r = (
            ICRS(x=r.x, y=r.y, z=r.z, representation_type=CartesianRepresentation)
            .transform_to(GCRS(obstime=epoch))
            .represent_as(CartesianRepresentation)
        )

        r_values[i] = r.xyz.to(u.km)

    t_values = ((t_values - t_span[0]) * u.day).to(u.s).value
    return interp1d(t_values, r_values, kind="cubic", axis=0, assume_sorted=True)


# Traceback (ModuleNotFoundError)
2021-02-09T22:42:25.5782954Z check run-test: commands[3] | python -m build .
2021-02-09T22:42:28.6022625Z Found existing installation: setuptools 49.2.1
2021-02-09T22:42:28.6436801Z Uninstalling setuptools-49.2.1:
2021-02-09T22:42:28.6526758Z   Successfully uninstalled setuptools-49.2.1
...
2021-02-09T22:42:35.0995738Z Collecting astroquery>=0.3.9
2021-02-09T22:42:35.1074040Z   Downloading astroquery-0.4.1.tar.gz (6.5 MB)
2021-02-09T22:42:35.6701112Z     ERROR: Command errored out with exit status 1:
2021-02-09T22:42:35.6703383Z      command: /tmp/build-env-260ocgnr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gcgcam16/astroquery/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gcgcam16/astroquery/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-3h_ptp3t
2021-02-09T22:42:35.6705974Z          cwd: /tmp/pip-install-gcgcam16/astroquery/
2021-02-09T22:42:35.6706521Z     Complete output (3 lines):
2021-02-09T22:42:35.6707238Z     Traceback (most recent call last):
2021-02-09T22:42:35.6707664Z       File "<string>", line 1, in <module>
2021-02-09T22:42:35.6708402Z     ModuleNotFoundError: No module named 'setuptools'

# Fixed code
def build_ephem_interpolant(body, period, t_span, rtol=1e-5):
    """Interpolates ephemerides data

    Parameters
    ----------
    body : Body
        Source body.
    period : ~astropy.units.Quantity
        Orbital period.
    t_span : list(~astropy.units.Quantity)
        Initial and final epochs.
    rtol : float, optional
        Relative tolerance. Controls the number of sampled data points,
        defaults to 1e-5.

    Returns
    -------
    intrp : ~scipy.interpolate.interpolate.interp1d
        Interpolated function.

    """
    h = (period * rtol).to(u.day).value
    t_span = (t_span[0].to(u.day).value, t_span[1].to(u.day).value + 0.01)
    t_values = np.linspace(*t_span, int((t_span[1] - t_span[0]) / h))  # type: ignore
    r_values = np.zeros((t_values.shape[0], 3))

    for i, t in enumerate(t_values):
        epoch = Time(t, format="jd", scale="tdb")

        r = get_body_barycentric(body.name, epoch)
        r = (
            ICRS(x=r.x, y=r.y, z=r.z, representation_type=CartesianRepresentation)
            .transform_to(GCRS(obstime=epoch))
            .represent_as(CartesianRepresentation)
        )

        r_values[i] = r.xyz.to(u.km)

    t_values = ((t_values - t_span[0]) * u.day).to(u.s).value
    return interp1d(t_values, r_values, kind="cubic", axis=0, assume_sorted=True)