Problems with reticulate package during R package development after upgrading to R version 3.6

I have been working on an R package using R version 3.4, but I recently upgraded my R version to 3.6 and updated all the packages that I had in 3.4. Because of this upgrade I now have a problem building up my package environment. Specifically it's something to do with the reticulate package.

I'm getting a warning about a syntax error in my python file, which I suspect it has to do with type hints in function definitions in python. This how my "instrument_data_file_parsing.py" line 24 looks like
image

I don't get the same problem when I source the python file directly from a regular R script.

library(reticulate)
# I can change the python executable with use_python()
py_file <- "instrument_data_file_parsing.py"
source_python(py_file)

It seems that on building my R package the reticulate package is calling an older version of python or something. But I don't really know how to change this. This is my first time writing a package. Can somebody please point me in the right direction?