poetry.lock으로 설치하는 것과 pyproject.toml로 설치하는 것의 차이

The key difference between installing dependencies via poetry.lock and pyproject.toml lies in how the dependencies are resolved and the versions of the packages that are installed.


1. Installing via poetry.lock


2. Installing via pyproject.toml


Summary of Differences

Aspect poetry.lock pyproject.toml
Dependency Resolution None (uses locked versions) Resolves dependencies based on constraints
Reproducibility High (ensures identical versions) May vary (depends on available versions)
Speed Faster (no resolution step) Slower (due to dependency resolution)
Use Case Consistent environments (e.g., production) Updating or modifying dependencies
Output Installs from poetry.lock Updates poetry.lock with new resolutions

Best Practices

  1. For Development: Use pyproject.toml to modify and resolve dependencies during active development.
  2. For Production/CI/CD: Use poetry.lock to ensure consistent, predictable dependency versions across environments.

By leveraging these files appropriately, you can maintain flexibility in development while ensuring stability in production.