Package & Dependency Management
Fall 2026
1
Outline
2
Outline
3
Warmup Problem: Anagram Detector
An anagram is a word or phrase formed by rearranging the letters of another word or phrase, using all the original letters exactly once.
Warmup Problem: Anagram Detector
Make a folder in your csci338 folder called lecture06. Create a file called anagrams.py and implement this function in Python:�
def are_anagrams(a: str, b: str) -> bool:
pass
assert are_anagrams("listen", "silent") is True
assert are_anagrams("hello", "world") is False
Outline
6
What did you think of Docker?
Images, Containers, and Volumes
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.
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?
10
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!")
11
Docker Experiments
docker run python:latest python hello.py
docker run node:latest node hello.js
What did that do? Why didn’t it work?
12
Docker Experiments
docker run --rm -v "$PWD":/app -w /app python:latest python hello.py
docker run --rm -v "$PWD":/app -w /app node:latest node hello.js
-v "$PWD":/app → make your current host folder visible as /app in the container
-w /app → run from /app
python hello.py → execute the file there
13
Docker Experiments
Now delete the containers and images that were just created.
14
What if you wanted to try out Rust?
Outline
16
What do we mean by Dependency Management?
17
What happened in the LeftPad Debacle?
Scene 1: Tiny package, huge dependency chain
Scene 2: A naming dispute
Scene 3: The developer removes his packages
What happened in the LeftPad Debacle?
Scene 4: npm restores left-pad
Scene 5: npm changes the rules
Big idea
A tiny piece of software can become critical infrastructure when enough other software depends on it.
What happened in the Everything Debacle?
What are the trade-offs associated with relying on dependencies?
What are dependencies good?
What are the downsides?:
22
What should you consider before adding a new dependency to your software project?
23
Stuff that can go wrong…
24
Some dependencies we will be using…
This week: Python & JavaScript dependencies – how do we manage those!? Examples:
25
Layers of Dependencies
Systems dependency managers manage programs for a single host machine.
What are some examples of systems dependency managers?
26
Outline
27
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?
28
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:
Lab 5: Practice Using Package Managers
On Thursday, you will be doing a lab to explore some dependencies using three different package managers:
See you Thursday!
33
Outline
34
Keep working on Lab 4