Skip to content

Commit 1ee3732

Browse files
authored
Consistently use lowercase "pip" (#242)
Since the upstream name of the project is all lowercase. See: https://pip.pypa.io pypa/pip#7793
1 parent 1b30ed1 commit 1ee3732

9 files changed

+36
-36
lines changed

CHANGELOG.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Changed
1313

14-
- Stopped manually creating a `src` directory inside the Pip dependencies layer. Pip will create the directory itself if needed (when there are editable VCS dependencies). ([#228](https://github.com/heroku/buildpacks-python/pull/228))
14+
- Stopped manually creating a `src` directory inside the pip dependencies layer. pip will create the directory itself if needed (when there are editable VCS dependencies). ([#228](https://github.com/heroku/buildpacks-python/pull/228))
1515
- Stopped setting `CPATH` and `PKG_CONFIG_PATH` at launch time. ([#231](https://github.com/heroku/buildpacks-python/pull/231))
16-
- The `bin` directory in the Pip dependencies layer is now always added to `PATH` instead of only when an installed dependency has an entry point script. ([#232](https://github.com/heroku/buildpacks-python/pull/232))
17-
- The Pip cache layer is now exposed to Pip invocations in later buildpacks. ([#234](https://github.com/heroku/buildpacks-python/pull/234))
16+
- The `bin` directory in the pip dependencies layer is now always added to `PATH` instead of only when an installed dependency has an entry point script. ([#232](https://github.com/heroku/buildpacks-python/pull/232))
17+
- The pip cache layer is now exposed to pip invocations in later buildpacks. ([#234](https://github.com/heroku/buildpacks-python/pull/234))
1818

1919
## [0.12.1] - 2024-07-15
2020

src/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn on_determine_package_manager_error(error: DeterminePackageManagerError) {
7070
DeterminePackageManagerError::NoneFound => log_error(
7171
"No Python package manager files were found",
7272
indoc! {"
73-
A Pip requirements file was not found in your application's source code.
73+
A pip requirements file was not found in your application's source code.
7474
This file is required so that your application's dependencies can be installed.
7575
7676
Please add a file named exactly 'requirements.txt' to the root directory of your

src/layers/pip_cache.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use libcnb::Env;
1111
use libherokubuildpack::log::log_info;
1212
use serde::{Deserialize, Serialize};
1313

14-
/// Creates a build-only layer for Pip's cache of HTTP requests/downloads and built package wheels.
14+
/// Creates a build-only layer for pip's cache of HTTP requests/downloads and built package wheels.
1515
// See: https://pip.pypa.io/en/stable/topics/caching/
1616
pub(crate) fn prepare_pip_cache(
1717
context: &BuildContext<PythonBuildpack>,

src/layers/pip_dependencies.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ use libherokubuildpack::log::log_info;
99
use std::path::{Path, PathBuf};
1010
use std::process::Command;
1111

12-
/// Creates a layer containing the application's Python dependencies, installed using Pip.
12+
/// Creates a layer containing the application's Python dependencies, installed using pip.
1313
//
1414
// To do this we use `pip install --user` so that the dependencies are installed into the user
1515
// `site-packages` directory in this layer (set by `PYTHONUSERBASE`), rather than the system
1616
// `site-packages` subdirectory of the Python installation layer.
1717
//
18-
// Note: We can't instead use Pip's `--target` option along with `PYTHONPATH`, since:
18+
// Note: We can't instead use pip's `--target` option along with `PYTHONPATH`, since:
1919
// - Directories on `PYTHONPATH` take precedence over the Python stdlib (unlike the system or
2020
// user site-packages directories), which can cause hard to debug stdlib shadowing issues
2121
// if one of the app's transitive dependencies is an outdated stdlib backport package.
2222
// - `--target` has bugs, eg: <https://github.com/pypa/pip/issues/8799>
2323
//
2424
// This layer is not cached, since:
25-
// - Pip is a package installer rather than a project/environment manager, and so does not
25+
// - pip is a package installer rather than a project/environment manager, and so does not
2626
// deterministically manage installed Python packages. For example, if a package entry in
27-
// a requirements file is later removed, Pip will not uninstall the package. In addition,
27+
// a requirements file is later removed, pip will not uninstall the package. In addition,
2828
// there is no official lockfile support, so changes in transitive dependencies add yet
2929
// more opportunity for non-determinism between each install.
30-
// - The Pip HTTP/wheel cache is itself cached in a separate layer (exposed via `PIP_CACHE_DIR`),
30+
// - The pip HTTP/wheel cache is itself cached in a separate layer (exposed via `PIP_CACHE_DIR`),
3131
// which covers the most time consuming part of performing a pip install: downloading the
3232
// dependencies and then generating wheels for any packages that don't provide them.
3333
pub(crate) fn install_dependencies(
@@ -62,7 +62,7 @@ pub(crate) fn install_dependencies(
6262
"requirements.txt",
6363
// For VCS dependencies installed in editable mode, the repository clones must be
6464
// kept after installation, since their directories are added to the Python path
65-
// directly (via `.pth` files in `site-packages`). By default Pip will store the
65+
// directly (via `.pth` files in `site-packages`). By default pip will store the
6666
// repositories in the current working directory (the app dir), but we want them
6767
// in the dependencies layer instead.
6868
"--src",
@@ -103,7 +103,7 @@ fn generate_layer_env(layer_path: &Path) -> LayerEnv {
103103
)
104104
}
105105

106-
/// Errors that can occur when installing the project's dependencies into a layer using Pip.
106+
/// Errors that can occur when installing the project's dependencies into a layer using pip.
107107
#[derive(Debug)]
108108
pub(crate) enum PipDependenciesLayerError {
109109
PipInstallCommand(StreamedCommandError),

src/layers/python.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub(crate) fn install_python_and_packaging_tools(
126126
python_version.major, python_version.minor
127127
));
128128

129-
// Python bundles Pip within its standard library, which we can use to install our chosen
129+
// Python bundles pip within its standard library, which we can use to install our chosen
130130
// pip version from PyPI, saving us from having to download the usual pip bootstrap script.
131131
let bundled_pip_module_path =
132132
bundled_pip_module_path(&python_stdlib_dir).map_err(PythonLayerError::LocateBundledPip)?;
@@ -136,7 +136,7 @@ pub(crate) fn install_python_and_packaging_tools(
136136
.args([
137137
&bundled_pip_module_path.to_string_lossy(),
138138
"install",
139-
// There is no point using Pip's cache here, since the layer itself will be cached.
139+
// There is no point using pip's cache here, since the layer itself will be cached.
140140
"--no-cache-dir",
141141
"--no-input",
142142
"--quiet",
@@ -150,11 +150,11 @@ pub(crate) fn install_python_and_packaging_tools(
150150
)
151151
.map_err(PythonLayerError::BootstrapPipCommand)?;
152152

153-
// By default Pip installs into the system site-packages directory if it is writeable by the
153+
// By default pip installs into the system site-packages directory if it is writeable by the
154154
// current user. Whilst the buildpack's own `pip install` invocations always use `--user` to
155155
// ensure app dependencies are installed into the user site-packages, it's possible other
156156
// buildpacks or custom scripts may forget to do so. By making the system site-packages
157-
// directory read-only, Pip will automatically use user installs in such cases:
157+
// directory read-only, pip will automatically use user installs in such cases:
158158
// https://github.com/pypa/pip/blob/24.1.2/src/pip/_internal/commands/install.py#L662-L720
159159
let site_packages_dir = python_stdlib_dir.join("site-packages");
160160
fs::set_permissions(site_packages_dir, Permissions::from_mode(0o555))
@@ -276,7 +276,7 @@ fn generate_layer_env(layer_path: &Path, python_version: &PythonVersion) -> Laye
276276
"LANG",
277277
"C.UTF-8",
278278
)
279-
// We use a curated Pip version, so disable the update check to speed up Pip invocations,
279+
// We use a curated pip version, so disable the update check to speed up pip invocations,
280280
// reduce build log spam and prevent users from thinking they need to manually upgrade.
281281
// This uses an env var (rather than the `--disable-pip-version-check` arg) so that it also
282282
// takes effect for any pip invocations in later buildpacks or when debugging at run-time.
@@ -324,7 +324,7 @@ fn generate_layer_env(layer_path: &Path, python_version: &PythonVersion) -> Laye
324324
// By default, Python's cached bytecode files (`.pyc` files) embed the last-modified time of
325325
// their `.py` source file, so Python can determine when they need regenerating. This causes
326326
// `.pyc` files (and thus layer SHA256) to be non-deterministic in cases where the source
327-
// file's last-modified time can vary (such as for packages installed by Pip). In addition,
327+
// file's last-modified time can vary (such as for packages installed by pip). In addition,
328328
// when lifecycle exports layers it resets the timestamps on all files to a fixed value:
329329
// https://buildpacks.io/docs/features/reproducibility/#consequences-and-caveats
330330
//
@@ -351,13 +351,13 @@ fn generate_layer_env(layer_path: &Path, python_version: &PythonVersion) -> Laye
351351
// and not `.pyc` generation as part of Python importing a file during normal operation.
352352
//
353353
// We use the env var, since:
354-
// - Pip calls `compileall` itself after installing packages, and doesn't allow us to
354+
// - pip calls `compileall` itself after installing packages, and doesn't allow us to
355355
// customise the options passed to it, which would mean we'd have to pass `--no-compile`
356-
// to Pip followed by running `compileall` manually ourselves, meaning more complexity
356+
// to pip followed by running `compileall` manually ourselves, meaning more complexity
357357
// every time we (or a later buildpack) use `pip install`.
358358
// - When we add support for Poetry, we'll have to use an env var regardless, since Poetry
359-
// doesn't allow customising the options passed to its internal Pip invocations, so we'd
360-
// have no way of passing `--no-compile` to Pip.
359+
// doesn't allow customising the options passed to its internal pip invocations, so we'd
360+
// have no way of passing `--no-compile` to pip.
361361
.chainable_insert(
362362
Scope::Build,
363363
ModificationBehavior::Default,
@@ -372,18 +372,18 @@ fn generate_layer_env(layer_path: &Path, python_version: &PythonVersion) -> Laye
372372
)
373373
}
374374

375-
/// The path to the Pip module bundled in Python's standard library.
375+
/// The path to the pip module bundled in Python's standard library.
376376
fn bundled_pip_module_path(python_stdlib_dir: &Path) -> io::Result<PathBuf> {
377377
let bundled_wheels_dir = python_stdlib_dir.join("ensurepip/_bundled");
378378

379-
// The wheel filename includes the Pip version (for example `pip-XX.Y-py3-none-any.whl`),
379+
// The wheel filename includes the pip version (for example `pip-XX.Y-py3-none-any.whl`),
380380
// which varies from one Python release to the next (including between patch releases).
381381
// As such, we have to find the wheel based on the known filename prefix of `pip-`.
382382
for entry in fs::read_dir(bundled_wheels_dir)? {
383383
let entry = entry?;
384384
if entry.file_name().to_string_lossy().starts_with("pip-") {
385385
let pip_wheel_path = entry.path();
386-
// The Pip module exists inside the pip wheel (which is a zip file), however,
386+
// The pip module exists inside the pip wheel (which is a zip file), however,
387387
// Python can load it directly by appending the module name to the zip filename,
388388
// as though it were a path. For example: `pip-XX.Y-py3-none-any.whl/pip`
389389
let pip_module_path = pip_wheel_path.join("pip");

src/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl Buildpack for PythonBuildpack {
7575
// In the future support will be added for package managers other than pip.
7676
let dependencies_layer_dir = match package_manager {
7777
PackageManager::Pip => {
78-
log_header("Installing dependencies using Pip");
78+
log_header("Installing dependencies using pip");
7979
pip_cache::prepare_pip_cache(
8080
&context,
8181
&mut env,
@@ -112,7 +112,7 @@ pub(crate) enum BuildpackError {
112112
DjangoCollectstatic(DjangoCollectstaticError),
113113
/// IO errors when detecting whether Django is installed.
114114
DjangoDetection(io::Error),
115-
/// Errors installing the project's dependencies into a layer using Pip.
115+
/// Errors installing the project's dependencies into a layer using pip.
116116
PipDependenciesLayer(PipDependenciesLayerError),
117117
/// Errors installing Python and required packaging tools into a layer.
118118
PythonLayer(PythonLayerError),

tests/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn default_build_config(fixture_path: impl AsRef<Path>) -> BuildConfig {
3737
config.target_triple(target_triple);
3838

3939
// Ensure that potentially broken user-provided env vars don't take precedence over those set
40-
// by this buildpack and break running Python/Pip. Some of these are based on the env vars that
40+
// by this buildpack and break running Python/pip. Some of these are based on the env vars that
4141
// used to be set by `bin/release` by very old versions of the classic Python buildpack:
4242
// https://github.com/heroku/heroku-buildpack-python/blob/27abdfe7d7ad104dabceb45641415251e965671c/bin/release#L11-L18
4343
config.envs([

tests/package_manager_test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn no_package_manager_detected() {
1313
context.pack_stderr,
1414
indoc! {"
1515
[Error: No Python package manager files were found]
16-
A Pip requirements file was not found in your application's source code.
16+
A pip requirements file was not found in your application's source code.
1717
This file is required so that your application's dependencies can be installed.
1818
1919
Please add a file named exactly 'requirements.txt' to the root directory of your

tests/pip_test.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn pip_basic_install_and_cache_reuse() {
2727
Installing Python {DEFAULT_PYTHON_VERSION}
2828
Installing pip {pip_version}, setuptools {setuptools_version} and wheel {wheel_version}
2929
30-
[Installing dependencies using Pip]
30+
[Installing dependencies using pip]
3131
Running pip install
3232
Collecting typing-extensions==4.7.1 (from -r requirements.txt (line 2))
3333
Downloading typing_extensions-4.7.1-py3-none-any.whl.metadata (3.1 kB)
@@ -39,9 +39,9 @@ fn pip_basic_install_and_cache_reuse() {
3939

4040
// Check that:
4141
// - The correct env vars are set at run-time.
42-
// - Pip is available at run-time too (and not just during the build).
42+
// - pip is available at run-time too (and not just during the build).
4343
// - The correct versions of pip/setuptools/wheel were installed.
44-
// - Pip uses (via 'PYTHONUSERBASE') the user site-packages in the dependencies
44+
// - pip uses (via 'PYTHONUSERBASE') the user site-packages in the dependencies
4545
// layer, and so can find the typing-extensions package installed there.
4646
// - The "pip update available" warning is not shown (since it should be suppressed).
4747
// - The system site-packages directory is protected against running 'pip install'
@@ -91,7 +91,7 @@ fn pip_basic_install_and_cache_reuse() {
9191
Using cached Python {DEFAULT_PYTHON_VERSION}
9292
Using cached pip {pip_version}, setuptools {setuptools_version} and wheel {wheel_version}
9393
94-
[Installing dependencies using Pip]
94+
[Installing dependencies using pip]
9595
Using cached pip download/wheel cache
9696
Running pip install
9797
Collecting typing-extensions==4.7.1 (from -r requirements.txt (line 2))
@@ -141,7 +141,7 @@ fn pip_cache_invalidation_with_compatible_metadata() {
141141
Installing Python {DEFAULT_PYTHON_VERSION}
142142
Installing pip {pip_version}, setuptools {setuptools_version} and wheel {wheel_version}
143143
144-
[Installing dependencies using Pip]
144+
[Installing dependencies using pip]
145145
Discarding cached pip download/wheel cache
146146
Running pip install
147147
Collecting typing-extensions==4.7.1 (from -r requirements.txt (line 2))
@@ -195,7 +195,7 @@ fn pip_cache_invalidation_with_incompatible_metadata() {
195195
Installing Python {DEFAULT_PYTHON_VERSION}
196196
Installing pip {pip_version}, setuptools {setuptools_version} and wheel {wheel_version}
197197
198-
[Installing dependencies using Pip]
198+
[Installing dependencies using pip]
199199
Discarding cached pip download/wheel cache
200200
Running pip install
201201
Collecting typing-extensions==4.7.1 (from -r requirements.txt (line 2))
@@ -243,7 +243,7 @@ fn pip_install_error() {
243243
assert_contains!(
244244
context.pack_stdout,
245245
indoc! {"
246-
[Installing dependencies using Pip]
246+
[Installing dependencies using pip]
247247
Running pip install
248248
"}
249249
);

0 commit comments

Comments
 (0)