This content is also available at learn.palantir.com ↗ and is presented here for accessibility purposes.
Up to this point, we’ve been taking for granted that we can simply import Python libraries for use in our code-based data transformations. You imported the shutil
↗ package for use in passengers_raw.py
, for example.
Let’s start with a review of how Foundry constitutes your Python repository environment these packages available followed by a brief exercise in viewing available packages. As you’ll see in the prescribed reading below, you can view a listing of all direct and transitively available Python packages using a cURL command against the Foundry Artifacts endpoint. The task will walk you through searching for packages by name in the Code Repositories UI.
The following readings are critical to understanding how packages are made available in your environment. Read them before continuing.
Master
called yourName/feature/tutorial_using_libraries (e.g., jmeier/feature/tutorial_using_libraries).passenger_flight_alerts_preprocessed.py
transform file.import theano
.ModuleNotFoundError
, indicating that Theano is not installed in your repository.passenger_flight_alerts_preprocessed.py
file and notice that the red underline is gone (though it now has a green one telling you the library is imported but not referenced — a much more manageable issue).meta.yml
file is the metadata file responsible for building the Conda recipe ↗ for your environment./transforms-python/conda_recipe/meta.yml
. Notice that the theano package now appears under the run section near the bottom of the file.Adding libraries provides you with more code options, but it also introduces additional overhead to the CI check process. Be judicious in your use of packages, and be aware that some of the popular packages such as pandas and numpy are already installed via the repository’s Python library.