Package & Dependency Management
Fall 2024
1
Outline
2
Outline
3
What do we mean by Dependency Management?
Your thoughts here…
4
What happened in the LeftPad Debacle?
Your thoughts here…
What happened in the Everything Debacle?
Your thoughts here…
What are the trade-offs associated with relying on dependencies?
Pros of packages:
Pros of doing it yourself:
7
What should you consider before adding a new dependency to your software project?
8
Stuff that can go wrong…
9
Some dependencies we will be using…
10
Layers of Dependencies
Systems dependency managers manage programs for a single host machine.
What are some examples of systems dependency managers?
11
Outline
12
Why might we need more fine-grained dependency management tools?
As a programmer who writes software, a global, system-level dependency management tool might not be enough! Why?
13
JavaScript Dependency Management
Make sure Node.js is installed…
$ npm init
$ npm install react react-dom
$ npm install prettier --save-dev
Python Dependency Management
Python Dependency Management: Poetry
$ pip install poetry
$ poetry init
$ poetry search request
$ poetry add request
$ poetry install
$ poetry run [whatever]
Common Features of a Good Package Manager
Poetry and NPM provide:
Docker: Cool Stuff
With Docker, you can install containerized versions of new libraries, languages, etc. without having to worry about software incompatibilities with your existing OS / software libraries.
DEMO
Outline
19
Docker Experiments
Please try the following (make sure that Docker is running):
docker run -it python:2.7
docker run -it python:latest
docker run -it node:latest
What happened?
20
Docker Experiments
Try running some local files with various versions of Python and Node:
hello.py
def main():
print("hello world")
if __name__ == "__main__":
main()
hello.js
console.log("hello world!")
21
Docker Experiments
docker run python:latest python hello.py
docker run node:latest python hello.js
Amazing!! Now delete all of the containers you just made. You could do this via the Docker UI, but try doing it via the command line
22
Outline
23
Lab 5: Practice Using Package Managers
On Thursday, you will be doing a short-ish lab to explore some dependencies using three different package managers:
See you Thursday!
24