Library
Библиотека
A software library is reusable code that a program can use to do a job, such as reading a file or resizing an image. Instead of building that feature from scratch, the program uses the functions or other tools the library provides.
What a library gives you
Suppose your program needs to read a CSV file. Splitting each line at every comma sounds easy until a quoted field contains a comma of its own. A CSV library handles those formatting rules, leaving your code to decide what to do with the rows. That division of responsibility is the point of a library: it solves a reusable problem without having to know the rules of your particular application.
How your code uses it
A library exposes a public API: the functions, types, or other pieces of code it intends callers to use. The API contract includes behavior, not just names. For example, check whether a function returns an empty result or raises an exception when no data is available. If you rely on an undocumented helper, a routine update may break your code even when the public API hasn't changed.
A standard library normally comes with the language's runtime or toolchain. For third-party libraries, you typically declare a project dependency and let a package manager install it. A package is a unit of distribution, not necessarily a library: it might ship reusable code, a command-line tool, or both. Installing a package makes its contents available; importing a module in Python lets your code refer to that module.
Example: reading CSV in Python
import csv
lines = ['name,city', '"Lee, Sam",Boston']
row = next(csv.DictReader(lines))
print(row['name']) # Lee, Sam
The standard library's csv module recognizes that the comma in Lee, Sam belongs inside the field. DictReader uses the first row as column names. Neither step tells you whether Boston is a city your application serves; that check belongs in your own code.
Library or framework?
With a library, your application usually decides when to call it. A framework typically runs part of the application and calls your code at defined points. For example, a web framework receives a request, matches its route, and calls your handler. One callback doesn't turn a library into a framework: look at who controls the application's overall flow.
What comes up in interviews
Expect to explain why you'd add a dependency rather than implement a feature yourself. Compare the edge cases the library already handles with the cost of carrying it: supported platforms, license, maintenance, and extra dependencies. Be ready to explain how you'd upgrade it, too. Read the release notes for breaking changes and test the application behavior that depends on the library, not just whether the import still works.