skip to content

Package Managers

Each ecosystem's own tool for reading a manifest, writing a lockfile and publishing to a registry, from npm and pip to Cargo and Bundler. Interviewers ask about the one your stack ships with.

on this pageshow

explore

questions

239 · 13 sections

With npm, why does `npm ci` in a CI job fail right after a teammate adds a dependency to `package.json`, and what fixes it?

level: juniorimportance: must knowfreq 40%
basics
~20 s

npm ci installs exactly what package-lock.json records and never writes it, so when package.json declares a dependency the lock lacks it exits with an out-of-sync error. Run npm install locally and commit the updated lock.

open as a page

In an npm project, what is the difference between `dependencies` and `devDependencies`, and what does `npm install --omit=dev` leave out?

level: juniorimportance: must knowfreq 42%
basics
~20 s

In package.json, dependencies are packages the code needs at runtime and install for anyone who installs the package; devDependencies are build and test tools. npm install --omit=dev keeps devDependencies off disk while still recording them in the lockfile.

open as a page

With npm, what does `npm publish` put into a package's tarball by default, and how do you see that file list before publishing?

level: juniorimportance: must knowfreq 24%
basics
~20 s

Without a files field, npm publish packs every file in the package folder except what .npmignore (or .gitignore, when there is no .npmignore) and npm's built-in ignores exclude. Run npm pack --dry-run to print the exact list first.

open as a page

In an npm project, how does `npm run build` run `vite build` when Vite is only a devDependency and not installed globally?

level: juniorimportance: must knowfreq 40%
basics
~20 s

npm links every command a dependency declares in its bin field into node_modules/.bin, and npm run adds that folder to the PATH it gives each script, so vite resolves to the project's own installed copy.

open as a page

In an npm project, what does the root package.json `workspaces` field declare, and what does one `npm install` at the root then produce?

level: juniorimportance: must knowfreq 32%
basics
~20 s

The root workspaces field lists the folders or globs, such as packages/*, that hold sibling packages. One root npm install symlinks each into the root node_modules by name, hoists shared dependencies there and writes a single root package-lock.json.

open as a page

With Bundler, why can a bare `rake test` load different gem versions than `bundle exec rake test`, and what does `bundle exec` change?

level: juniorimportance: must knowfreq 76%
basics
~20 s

A bare rake starts through RubyGems, which activates the newest installed rake, not the one Gemfile.lock pins. bundle exec runs Bundler.setup first, so the command sees only the locked versions and only the bundle's gems.

open as a page

In a Gemfile, what versions does `gem "rack", "~> 3.1"` accept, and how do `"~> 3.1.4"`, `">= 3.1"` and a bare `"3.1.4"` differ?

level: juniorimportance: must knowfreq 72%
basics
~20 s

In a Gemfile, ~> 3.1 is the pessimistic operator: at least 3.1 and below 4.0. ~> 3.1.4 allows 3.1.4 up to below 3.2, >= 3.1 has no upper bound at all, and a bare "3.1.4" means exactly = 3.1.4.

open as a page

With Bundler, what is the difference between `bundle install` and `bundle update` when a committed Gemfile.lock already exists?

level: juniorimportance: must knowfreq 74%
basics
~20 s

bundle install installs exactly the versions Gemfile.lock records and re-resolves only gems whose Gemfile entry changed. bundle update deliberately unlocks the named gems, or every gem with --all, and moves them to the newest versions the Gemfile allows.

open as a page

In Ruby with Bundler, what is the difference between `require "bundler/setup"` and `Bundler.require`, and how do group arguments change each?

level: middleimportance: must knowfreq 55%
basics
~20 s

require "bundler/setup" calls Bundler.setup, which puts the locked gems of all installed groups on the load path but loads none. Bundler.require runs setup and then requires every gem of the named groups, :default when called without arguments.

open as a page

In a Gemfile, what does putting gems inside `group :test do ... end` declare, and what does `require: false` on a gem change?

level: middleimportance: must knowfreq 58%
basics
~20 s

A group labels gems (ungrouped ones are in :default) so installs and Bundler.setup can include or skip them, yet every group still resolves into one Gemfile.lock. require: false keeps the gem installed and loadable but stops Bundler.require from requiring it automatically.

open as a page

In RubyGems 4, what do gem install, gem list, gem update and gem uninstall do, and does gem update remove the older version?

level: juniorimportance: must knowfreq 62%
basics
~20 s

gem install puts a gem and its runtime dependencies into GEM_HOME, gem list shows installed versions, gem update adds the newest version beside the old one, and gem uninstall removes a version. Only gem cleanup or uninstall deletes old versions.

open as a page

In RubyGems, what is a .gemspec file, which fields must it set, and what does gem build produce from it?

level: juniorimportance: must knowfreq 52%
basics
~10 s

A .gemspec is Ruby code that builds a Gem::Specification: name, version, summary, authors, files, require_paths and dependencies. gem build validates it and packages the listed files into name-version.gem, the file gem push uploads.

open as a page

In RubyGems, what is the difference between GEM_HOME and GEM_PATH, and where does gem install --user-install put gems?

level: middleimportance: must knowfreq 45%
basics
~10 s

GEM_HOME is the single directory gem install writes into; GEM_PATH is the list of directories RubyGems searches for installed gems, and GEM_HOME is always part of it. --user-install writes to Gem.user_dir, such as ~/.gem/ruby/4.0.0.

open as a page

In a RubyGems gemspec, what is the difference between add_dependency and add_development_dependency, and what goes wrong if you mix them up?

level: middleimportance: must knowfreq 55%
basics
~20 s

add_dependency declares a runtime dependency, installed and activated with your gem. add_development_dependency declares a tool needed only to work on the gem; gem install skips it unless --development is given, and it is never activated.

open as a page

When you publish version 1.0 of a gem with gem push, how do RubyGems API keys, MFA and --otp work, and which gemspec metadata hardens the release?

level: seniorimportance: must knowfreq 42%
basics
~20 s

gem push uploads a built .gem using an API key from gem signin or GEM_HOST_API_KEY. With MFA enabled, the server demands a one-time code passed via --otp or GEM_HOST_OTP_CODE. Metadata rubygems_mfa_required and allowed_push_host harden pushes.

open as a page

With RVM, what do `rvm install 4.0.7`, `rvm use 4.0.7` and `rvm use 4.0.7 --default` each do, and which one survives a new terminal?

level: juniorimportance: should knowfreq 32%
basics
~20 s

rvm install downloads a prebuilt Ruby or compiles one into ~/.rvm/rubies; rvm use switches only the current shell by rewriting PATH and the gem variables; adding --default also records it as the default alias that every new shell loads.

open as a page

Why did many Ruby teams move from RVM to rbenv, and what exactly changes for a project when they do?

level: middleimportance: should knowfreq 30%
basics
~20 s

RVM hooks cd, sources shell code into every session, manages gemsets and system packages, and last tagged 1.29.12 in 2021; rbenv just selects a Ruby and leaves gems to Bundler. Migrating keeps .ruby-version and drops .rvmrc, .ruby-gemset and RVM.

open as a page

On an inherited server set up with RVM gemsets, a cron job running `cd /srv/billing && bundle exec rake invoices:send` uses the wrong Ruby, though it works over SSH; why, and how do you fix it?

level: seniorimportance: should knowfreq 20%
basics
~20 s

RVM's selection is environment state set by a shell function your SSH login shell sources; cron's minimal shell never loads it, so no cd hook and no gemset. Use RVM wrappers, rvm in DIR do, or rvm cron setup.

open as a page

In RVM, what is a gemset, how do `rvm use 4.0.7@billing --create` and the `@global` gemset work together, and where do new gems go?

level: middleimportance: nice to knowfreq 22%
basics
~20 s

A gemset is a named gem directory attached to one installed Ruby. rvm use 4.0.7@billing --create creates and selects ~/.rvm/gems/ruby-4.0.7@billing; new gems install there, while gems in that Ruby's @global gemset stay visible to it.

open as a page

When you `cd` into a project, how does RVM choose the Ruby and gemset, and why must a `.rvmrc` be trusted first?

level: middleimportance: nice to knowfreq 14%
basics
~20 s

RVM's cd hook walks up from the new directory and loads the first project file it finds, with .rvmrc checked before .ruby-version. A .rvmrc is shell code sourced into your shell, so RVM asks before running it; .ruby-version is plain data.

open as a page

With rbenv, how do you install a new Ruby version and pin it for one project, and what does each command write to disk?

level: juniorimportance: must knowfreq 70%
basics
~10 s

Run rbenv install 4.0.7 (supplied by the ruby-build plugin) to build Ruby into ~/.rbenv/versions/4.0.7, then rbenv local 4.0.7 in the project to write .ruby-version; rbenv global writes the machine default to ~/.rbenv/version.

open as a page

How do rbenv shims route a ruby or bundle call to the right Ruby version, and when must you run rbenv rehash?

level: middleimportance: must knowfreq 55%
basics
~10 s

rbenv puts ~/.rbenv/shims first on PATH; each shim is a small script that runs rbenv exec, which resolves the selected version and execs that version's executable. rbenv rehash regenerates shims when new executables appear.

open as a page

In what order does rbenv decide which Ruby version is active, and how do rbenv shell, local and global map onto that order?

level: middleimportance: should knowfreq 50%
basics
~20 s

rbenv takes RBENV_VERSION first (set by rbenv shell), then the nearest .ruby-version found walking up from the current directory (written by rbenv local), then ~/.rbenv/version (written by rbenv global), and otherwise uses the system Ruby.

open as a page

Why is rbenv called the lighter alternative to RVM, and how do you isolate gems per project when rbenv has no gemsets?

level: middleimportance: should knowfreq 40%
basics
~20 s

rbenv only prepends a shims directory to PATH and resolves the version on each command, without wrapping cd or loading heavy shell functions. It has no gemsets: each installed Ruby has its own gem directory, and Bundler's lockfile isolates each project.

open as a page

A project's .ruby-version pins 4.0.7 under rbenv, yet a newly opened terminal runs the system Ruby there; how do you diagnose and fix it?

level: seniorimportance: should knowfreq 35%
basics
~20 s

Check that ~/.rbenv/shims comes first on PATH with type -a ruby; usually the rbenv init line sits in a startup file that shell never reads, or a later PATH edit wins. Then run rbenv version to spot a stray RBENV_VERSION.

open as a page

In a composer.json, how do you configure psr-4 autoloading for your own code, and what does requiring vendor/autoload.php give you?

level: juniorimportance: must knowfreq 62%
basics
~20 s

Map a namespace prefix to a directory under autoload.psr-4, for example "App\": "src/", then require vendor/autoload.php once at the entry point. That file registers Composer's class loader for your code and every dependency, and includes any files entries.

open as a page

In Composer, what is the difference between composer install and composer update, and which one should a deploy run?

level: juniorimportance: must knowfreq 75%
basics
~10 s

composer install installs the exact versions in composer.lock; composer update re-resolves composer.json's constraints, rewrites composer.lock with the newest allowed versions, then installs. Deploys and CI run install, production with --no-dev; developers run update deliberately.

open as a page

In a composer.json, what is the difference between require and require-dev, and when are require-dev packages not installed?

level: juniorimportance: must knowfreq 70%
basics
~20 s

require lists packages the code needs at runtime, installed everywhere and passed on to the package's consumers. require-dev lists test and tooling packages; it is root-only, so a dependency's dev list is never installed, and --no-dev builds skip it.

open as a page

In Composer, what does composer dump-autoload -o change about how classes are found, and why is it for production rather than development?

level: middleimportance: must knowfreq 55%
basics
~20 s

dump-autoload -o scans PSR-4 and PSR-0 directories and writes every class into the classmap, so known classes resolve by array lookup, not a filesystem check. It suits production, where code changes only at deploy, not development.

open as a page

In a composer.json constraint, how does ^1.2 differ from ~1.2, and how do ^1.2.3, ~1.2.3 and ^0.3 behave?

level: middleimportance: must knowfreq 65%
basics
~10 s

In Composer, ^1.2 and ~1.2 are the same range, >=1.2.0 <2.0.0. They differ with three parts: ~1.2.3 means >=1.2.3 <1.3.0 while ^1.2.3 means >=1.2.3 <2.0.0. For 0.x, ^0.3 means >=0.3.0 <0.4.0.

open as a page

What is Packagist, and what does publishing a first PHP library to it involve?

level: juniorimportance: must knowfreq 55%
basics
~20 s

Packagist is the public package registry Composer queries by default. To publish, push a repository with a valid composer.json named vendor/name, submit its URL on Packagist, and tag releases; Packagist reads versions from tags and branches.

open as a page

You pushed tag v1.3.0 of a PHP library on Packagist, but consumers' composer update does not offer 1.3.0; what do you check?

level: middleimportance: should knowfreq 30%
basics
~20 s

First check whether Packagist re-read the repository, usually a missing hook. Then check whether the tag was skipped for an invalid name, a mismatched version key or missing composer.json. Last, check the consumer's constraint, stability settings and repository order.

open as a page

How does Packagist turn a Git repository's tags and branches into Composer versions such as 1.2.0, 2.x-dev and dev-main?

level: middleimportance: should knowfreq 40%
basics
~20 s

Each valid tag becomes a release version, compared without its leading v, with any -beta or -RC suffix setting stability. Each branch becomes a dev version: 2.x becomes 2.x-dev, other names become dev-name, and extra.branch-alias can map dev-main to 1.0.x-dev.

open as a page

On Packagist, how do you retire a PHP package by marking it abandoned with a replacement, and what do consumers' Composer runs then show?

level: seniorimportance: should knowfreq 25%
basics
~10 s

Mark the package abandoned, optionally naming a replacement package, rather than deleting it. Existing versions keep installing, but Composer warns that the package is abandoned and suggests the replacement, and composer audit reports it.

open as a page

Packagist.org serves only public packages; how should a team distribute private PHP packages to its own projects instead?

level: seniorimportance: should knowfreq 32%
basics
~20 s

Keep private packages off Packagist.org and serve them from a private repository: individual vcs entries for a few packages, a static registry built with Satis, or a hosted private registry. Credentials go in auth.json or environment variables.

open as a page

With Cargo, what do `cargo build`, `cargo run` and `--release` each do, and where does each one leave the compiled binary?

level: juniorimportance: must knowfreq 62%
basics
~10 s

cargo build compiles the package with the dev profile into target/debug; cargo run does the same build and then executes the binary; --release switches either command to the optimized release profile and target/release.

open as a page

In a Cargo.toml, which versions may Cargo select for `serde = "1.0.200"`, and why does that line count as a caret requirement?

level: juniorimportance: must knowfreq 74%
basics
~10 s

A bare version in Cargo is a caret requirement, so serde = "1.0.200" means >=1.0.200, <2.0.0. Cargo may pick any release in that range, normally the newest, and records its pick in Cargo.lock.

open as a page

In a Rust project's CI job, what do `cargo fmt --check` and `cargo clippy` each verify, and what makes each step fail?

level: juniorimportance: must knowfreq 55%
basics
~20 s

cargo fmt --check runs rustfmt without rewriting files and fails when any file would change. cargo clippy type-checks the crate and runs Clippy's lints; it fails on deny-level lints, while plain warnings pass unless CI promotes them to errors.

open as a page

In a Cargo.toml [package] table, what do name, version, edition, rust-version and license do, and which key is actually required?

level: juniorimportance: must knowfreq 70%
basics
~20 s

Only name is required: it names the package and its default targets. version defaults to 0.0.0, a missing edition falls back to 2015 with a warning, rust-version is the oldest supported toolchain, and license is metadata a registry needs.

open as a page

In Cargo, what changes when you run `cargo build --release` instead of `cargo build`, and which profile settings cause it?

level: juniorimportance: must knowfreq 75%
basics
~20 s

Plain cargo build uses the dev profile: opt-level 0, full debug info, debug assertions and overflow checks on, incremental. The --release flag selects the release profile: opt-level 3, no debug info, both checks off, so builds are slower and binaries faster.

open as a page

With the .NET 10 SDK, what do dotnet build, dotnet run and dotnet publish each produce, and which configuration does each use by default?

level: juniorimportance: must knowfreq 72%
basics
~20 s

dotnet build compiles into bin/Debug/net10.0, dotnet run builds and then launches the app (also Debug), and dotnet publish writes the deployable set to a publish folder using Release by default for net8.0 and later projects.

open as a page

What is the difference between the .NET SDK and the .NET runtime, and what do dotnet --info, --list-sdks and --list-runtimes show?

level: juniorimportance: must knowfreq 55%
basics
~20 s

The .NET SDK is the toolchain (dotnet CLI, MSBuild, compilers, NuGet, templates) used to build apps; the runtime only runs them. dotnet --list-sdks and --list-runtimes print what is installed, and dotnet --info prints both plus the SDK selected for the current folder.

open as a page

With the .NET 10 SDK, how do global tools, tool-path tools and local tools differ in where they install and how you invoke them?

level: juniorimportance: must knowfreq 52%
basics
~20 s

A .NET tool is a console app shipped as a NuGet package; -g installs it per user into ~/.dotnet/tools on PATH, --tool-path into a folder you choose, and a local install records it in a repository's tool manifest, invoked through dotnet.

open as a page

With the .NET 10 SDK, how do dotnet publish -r, --self-contained, PublishSingleFile and PublishReadyToRun change what you ship for a command-line tool?

level: middleimportance: must knowfreq 60%
basics
~10 s

-r picks the target OS and CPU, --self-contained bundles the .NET runtime, PublishSingleFile packs the app into one executable, and PublishReadyToRun precompiles assemblies for faster startup; on net8.0+ a runtime identifier alone stays framework-dependent.

open as a page

How does global.json select the .NET SDK for a repository, and what happens with version 10.0.100 and no rollForward when only 10.0.400 is installed?

level: middleimportance: must knowfreq 50%
basics
~20 s

global.json pins the SDK with sdk.version, and without rollForward the policy is patch: use that version or a later patch in the same feature band. With 10.0.100 requested and only 10.0.400 installed, no 10.0.1xx SDK exists, so SDK resolution fails.

open as a page

With the .NET 10 SDK, what does dotnet pack produce for a class library, and what do PackageId, Version, Authors and IsPackable default to?

level: juniorimportance: must knowfreq 52%
basics
~20 s

dotnet pack builds the project in Release and writes <PackageId>.<version>.nupkg to bin/Release. PackageId defaults to the assembly name, the version to Version (1.0.0 unless set), Authors to the assembly name, and IsPackable is true except for test projects.

open as a page

In a .NET project file, what does <PackageReference Include="Serilog" Version="4.4.0" /> ask NuGet for, and how do [4.4.0], [4.0,5.0) and 4.* change it?

level: juniorimportance: must knowfreq 68%
basics
~20 s

A bare Version="4.4.0" means 4.4.0 or higher, and NuGet restores the lowest version that satisfies it. [4.4.0] pins exactly, [4.0,5.0) bounds the range and still takes its lowest member, and 4.* floats to the highest 4.x.

open as a page

With the .NET 10 SDK, what does dotnet restore produce, where do the restored packages land, and when would you run dotnet nuget locals?

level: juniorimportance: must knowfreq 60%
basics
~20 s

dotnet restore resolves the project's package graph, extracts each package once into the global packages folder (~/.nuget/packages by default) and writes obj/project.assets.json for the build. dotnet nuget locals lists or clears that folder and NuGet's other caches.

open as a page

With the .NET CLI, how do you publish with dotnet nuget push, and what can you do once a nuget.org release is broken?

level: middleimportance: must knowfreq 46%
basics
~20 s

dotnet nuget push <file>.nupkg --source <feed> --api-key <key> uploads the package; a version can be pushed only once. nuget.org does not delete packages: you unlist the broken version, which hides it from search but keeps exact-version restores working, and ship a fixed version.

open as a page

In NuGet's Central Package Management, how would you move the 25 projects of an accounting suite onto one Directory.Packages.props, and which errors catch leftovers?

level: middleimportance: must knowfreq 55%
basics
~20 s

Add a Directory.Packages.props at the repository root with ManagePackageVersionsCentrally set to true and one PackageVersion per package, then strip Version from every PackageReference. Restore raises NU1008 for a leftover Version and NU1010 for a reference without a PackageVersion.

open as a page

In Conan 2, what does conan install produce for a conanfile.txt listing fmt and zlib with the CMakeDeps and CMakeToolchain generators?

level: juniorimportance: must knowfreq 62%
basics
~10 s

It resolves the dependency graph, puts matching fmt and zlib binaries in the local cache and writes CMake input files: a config package per dependency, conan_toolchain.cmake and CMakePresets.json. It never compiles your own project.

open as a page

In Conan 2, how does a requirement like zlib/[>=1.3 <2] resolve, and what do the ~ and ^ range operators mean?

level: middleimportance: must knowfreq 50%
basics
~20 s

A bracketed range resolves to the newest matching version, taken from the local cache if one matches there, otherwise from the first remote with a match. ~1.3 means >=1.3 <1.4, ^1.3 means >=1.3 <2, and pre-releases are skipped unless requested.

open as a page

In Conan 2, what do --build=missing, --build=never, --build="*" and a --build pattern each tell conan install to do?

level: middleimportance: must knowfreq 55%
basics
~20 s

Without --build, conan install never compiles a dependency and fails on a missing binary. --build=missing builds only packages with no usable binary, --build="*" rebuilds everything, a pattern rebuilds matching packages, and --build=never forbids building outright.

open as a page

In Conan 2, how do settings, options and conf differ, and which of them change a package's package_id?

level: middleimportance: must knowfreq 58%
basics
~20 s

Settings are project-wide values such as compiler and build_type; options are per-package switches such as shared; conf configures Conan and its tools. Settings and options a recipe declares enter its package_id, while conf stays out unless tools.info.package_id:confs lists it.

open as a page

In Conan 2, how do CMakeDeps, CMakeToolchain and the generated conan-release preset hand fmt and zlib to a CMake project?

level: middleimportance: must knowfreq 55%
basics
~10 s

CMakeDeps writes a config package per dependency declaring targets such as fmt::fmt; CMakeToolchain writes conan_toolchain.cmake and a conan-release preset that loads it and sets CMAKE_BUILD_TYPE, so plain find_package and target_link_libraries work.

open as a page

How do you make a CMake project consume vcpkg dependencies, and what does pointing CMAKE_TOOLCHAIN_FILE at vcpkg.cmake do during configure?

level: juniorimportance: must knowfreq 55%
basics
~10 s

Set CMAKE_TOOLCHAIN_FILE to <vcpkg root>/scripts/buildsystems/vcpkg.cmake on the first configure. During project() it runs vcpkg install for the vcpkg.json, then adds the installed tree to CMake's search paths so find_package finds the libraries.

open as a page

In vcpkg, what is the difference between manifest mode and classic mode, and what does a project's vcpkg.json declare?

level: juniorimportance: must knowfreq 50%
basics
~20 s

Manifest mode reads the project's vcpkg.json, which lists its dependencies, features and version pins, and installs them into a per-project vcpkg_installed directory. Classic mode installs packages named on the command line into one tree shared by the whole vcpkg instance.

open as a page

In a vcpkg.json, what does the builtin-baseline field pin, and how does it give every developer and CI agent the same library versions?

level: middleimportance: must knowfreq 45%
basics
~20 s

builtin-baseline is a commit SHA of the vcpkg registry repository. vcpkg reads versions/baseline.json at that commit and uses each port's version there as its minimum, so every machine resolves the same versions whatever its local vcpkg checkout contains.

open as a page

In vcpkg, what does a triplet such as x64-windows or arm64-osx define, and which triplet is used when none is given?

level: juniorimportance: should knowfreq 45%
basics
~20 s

A triplet is a named CMake file that sets the target architecture, system and library and CRT linkage for every port built with it. Without --triplet or VCPKG_DEFAULT_TRIPLET, vcpkg targets the host triplet detected from the machine, such as arm64-osx on arm64 Macs.

open as a page

In a CMake build using vcpkg.cmake, how is VCPKG_TARGET_TRIPLET chosen, and why must it and the other VCPKG_ settings be fixed before project()?

level: middleimportance: should knowfreq 35%
basics
~20 s

vcpkg.cmake uses VCPKG_TARGET_TRIPLET if set; otherwise it builds a name like x64-windows or arm64-osx from the generator platform, processor and system. It reads every VCPKG_ setting inside the first project(), so they must be set earlier, and a changed triplet needs a fresh cache.

open as a page

When you add a Swift package to an iOS app in Xcode, what do you choose, and why can an import still fail?

level: juniorimportance: must knowfreq 70%
basics
~20 s

You give Xcode the package's repository URL and a version requirement, then choose which library products to link into which targets. Declaring the package links nothing: importing a module that no linked product brings in fails with No such module.

open as a page

In a Swift package, what does the `// swift-tools-version:` line in Package.swift control, and what goes wrong when it is set too low or too high?

level: juniorimportance: must knowfreq 58%
basics
~20 s

The swift-tools-version comment in Package.swift names the oldest Swift toolchain that can build the package and picks the PackageDescription API the manifest compiles against: too low hides newer manifest APIs, too high locks out older toolchains.

open as a page

What does Swift Package Manager record in Package.resolved, and why does an app commit it while a library's copy is ignored by its clients?

level: juniorimportance: must knowfreq 70%
basics
~20 s

Package.resolved records what resolution chose: for every package in the graph, transitive ones included, its identity, location, commit and, where one applies, version or branch. SwiftPM honours it only for the top-level package, so apps commit it and libraries cannot pin clients.

open as a page

In a Package.swift manifest, which versions does `.package(url:from:)` let SwiftPM choose, and when would you write `exact:`, `branch:` or `revision:` instead?

level: juniorimportance: must knowfreq 72%
basics
~20 s

from: "1.2.3" lets SwiftPM pick any tagged release from 1.2.3 up to, but not including, 2.0.0. exact: allows one release, branch: follows a branch and revision: freezes one commit; the last two leave versioning behind.

open as a page

In a Swift package manifest, how do targets map to modules, and what does a library product expose to the packages that depend on it?

level: middleimportance: must knowfreq 62%
basics
~20 s

Each SwiftPM target builds one module, by default from Sources/<TargetName>. A library product is the outward-facing unit: it vends the public API of the targets it lists, and other packages depend on products, never on bare targets.

open as a page