It is not currently possible to use objects directly in Code Workspaces. User may import datasets that back objects using the Data menu within a workspace.
Yes, PySpark is available for use in Code Workspaces, but note that it will not leverage a distributed Spark infrastructure since Code Workspaces currently run on a single node. We recommend Foundry applications like Pipeline Builder and Code Repositories if you want to leverage a Spark infrastructure.
To install PySpark in your JupyterLab® Notebook, go to the Packages tab, and search and install openjdk
(from Conda) and pyspark
(from PyPI).
Code Workspaces currently supports JupyterLab® and RStudio® Workbench.
Due to security reasons, the following Python packages are not supported:
Contact your Palantir representative if you have any concerns about the packages above.
Yes, you can make API calls in Code Workspaces after defining network policies in the Settings menu. Note that the external API must be registered as an approved Network Egress policy in Control Panel.
The Code Repositories application receives code from associated Code Workspaces in an IPython format, which renders the code at a cell-by-cell level in JSON format.
Yes; see the documentation on importing packages. If your package is hosted on an organizational Conda/PyPI/CRAN channel, it is possible for Foundry to proxy the channel and make it available to your projects. Contact your Palantir representative for more information.
To import libraries into your Code Workspace, use the Packages tab located in the left panel of your workspace.
Yes, you can edit code directly in Code Repositories when the code originates in Code Workspaces. Once committed, you can use the Sync or Reset changes functionality in the Code Workspace to pick up the remote changes in the Workspace.
Conceptually, you can think of Code Repositories as the version control manager for Code Workspaces, handling pull requests, conflict resolution, and administration, while code development can occur in Code Workspaces.
For security purposes, users are isolated when working in JupyterLab® or RStudio®. This means each user accessing the same Code Workspace will have their own environment. Collaboration happens through git workflows: if you wish to make your latest code available to colleagues, select Sync Changes to synchronize your changes with the backing code repository and the changes will become available to your colleagues when they select Sync or Reset changes. When multiple users work on the same workspace, we recommend they work on independent branches.
Note that we ignore some files by default using .gitignore
to ensure that no data is synchronized with the git repository, and to limit the size of the git repository. We also remove all outputs from JupyterLab® .ipynb
files.
Yes. By default, Code Workspaces only pre-installs the requirements to render common R Markdown files (as defined in TinyTex-1 ↗), but you can install other LaTeX packages on your own:
.tds.zip
file from CTAN ↗.my_latex_packages
..Rprofile
, and update it to also extract the files to the correct location. You will need to replace my_latex_packages
with your dataset alias in the below snippet:library(foundry)
my_latex_packages_files <- datasets.list_files("my_latex_packages")
my_latex_packages_local_files <- datasets.download_files("my_latex_packages", my_latex_packages_files)
texmflocal <- system("kpsewhich --var-value TEXMFLOCAL", intern = TRUE)
sapply(my_latex_packages_local_files, function(tds_file) { unzip(tds_file, exdir = texmflocal) })
headers-include:
- \usepackage{my_package}
Yes.
my_fonts
.my_fonts
with your dataset alias in the below snippet:my_fonts_files <- datasets.list_files("my_fonts")
my_fonts_local_files <- datasets.download_files("my_fonts", my_fonts_files)
dir.create("fonts")
file.copy(unlist(my_fonts_local_files), "fonts")
/home/user/repo/fonts
directory so they can be used in your HTML or PDF outputs following the R Markdown recommendations.To change the font for HTML, set the font-family
in a custom CSS ↗.
To change the font for PDFs, you can load the font in LaTeX with \newfontfamily
using custom LaTeX code ↗ in the preamble.
You can leverage the %%keep_alive
cell magic to prevent Code Workspaces from pausing a Jupyter® notebook while the code in the cell is running.
Copied!1 2 3
%%keep_alive long_running_process()
This will keep the cell alive for up to 24 hours while the cell code is running. If your browser tab is closed or left idle for too long, JupyterLab® will stop displaying and persisting the cell's output. If you would like to view the cell's output later, you may use the %%capture
cell magic to store the output in a variable:
Copied!1 2 3 4
%%keep_alive %%capture cell_output long_running_process()
In a different cell, write the output of the above variable to a file so it can be viewed later:
Copied!1 2 3
with open('cell_output.txt', 'w+') as f: f.write(cell_output.stdout) f.write(cell_output.stderr)
The IDE native file downloads are disabled in the Palantir platform to ensure that download restrictions configured by administrators are enforced.
In order to download files, write the files back to a Foundry dataset. To do so, in the Code Workspaces sidebar, navigate to the Data tab, then Write data to new dataset, and enter a name for the new dataset. After confirming the alias for the dataset, select Non-tabular dataset as dataset type, enter the location of the files or directory you wish to upload and run the generated code snippet.
Once the files have been uploaded to the Foundry dataset, you can navigate to the dataset preview by selecting on the dataset link and download the files from there. Remember that your administrator may require a justification before exporting data from the platform or limit the amount of data exported.
RStudio® and Shiny® are trademarks of Posit™.
Jupyter®, JupyterLab®, and the Jupyter® logos are trademarks or registered trademarks of NumFOCUS.
All third-party trademarks (including logos and icons) referenced remain the property of their respective owners. No affiliation or endorsement is implied.