Skip to content

Commit cd2c12f

Browse files
author
Alex Armstrong
committed
Prose description of lock file operations
1 parent 185b382 commit cd2c12f

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

package-structure-code/declare-dependencies.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,19 @@ for up-to-date formatting info on `pylock.toml`
532532
### How to work with lock files?
533533

534534
Lock files are not written by hand. Package managers and IDEs provide tools
535-
to create, update, and reformat lock files as needed. Below are common package
536-
manager CLI workflows for lock files:
535+
to create, update, and reformat lock files as needed.
536+
537+
1) **Create** - Package managers often do this automatically though it can be
538+
done manually. For example, calling `uv add numpy` will automatically create a
539+
`uv.lock` file, setup the environment, and install numpy.
540+
2) **Update** - This is not done automatically by package managers.
541+
Maintainers can choose to do this manually or setup their own automated
542+
workflow. Updates can be for specific packages or all dependencies.
543+
3) **Reformat** - Package managers currently use native formats (e.g.
544+
uv uses `uv.lock`) and provide tools for converting into `pylock.toml` and other
545+
formats (e.g. `requirements.txt`) when needed
546+
547+
Below are common package manager CLI workflows for lock files:
537548

538549
::::{tab-set}
539550

@@ -544,6 +555,7 @@ manager CLI workflows for lock files:
544555
545556
# Update uv.lock
546557
> uv lock --upgrade
558+
> uv lock --upgrade-package pandas
547559
548560
# Install packages into environment based on uv.lock
549561
> uv sync
@@ -562,6 +574,7 @@ See [official docs](https://docs.astral.sh/uv/concepts/projects/sync/) for more
562574
563575
# Update poetry.lock
564576
> poetry update
577+
> poetry update pandas numpy
565578
566579
# Install packages into environment based on poetry.lock
567580
> poetry sync

0 commit comments

Comments
 (0)