Skip to content

Commit

Permalink
Use pip-compile for pyproject.toml
Browse files Browse the repository at this point in the history
pyproject.toml is a standard Python file which is not specific to
poetry. By using pip-compile instead of poetry, we can support any
Python build backend.
  • Loading branch information
kylewillmon committed May 5, 2023
1 parent 03f161b commit e8b78a0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 30 deletions.
13 changes: 4 additions & 9 deletions lockfile/src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ use anyhow::{anyhow, Context};
#[cfg(feature = "generator")]
use lockfile_generator::pip::Pip as PipGenerator;
#[cfg(feature = "generator")]
use lockfile_generator::poetry::Poetry as PoetryGenerator;
#[cfg(feature = "generator")]
use lockfile_generator::python_requirements::PythonRequirements as PythonRequirementsGenerator;
#[cfg(feature = "generator")]
use lockfile_generator::Generator;
Expand Down Expand Up @@ -43,6 +41,7 @@ impl Parse for PyRequirements {

fn is_path_manifest(&self, path: &Path) -> bool {
path.file_name() == Some(OsStr::new("requirements.in"))
|| path.file_name() == Some(OsStr::new("pyproject.toml"))
|| path.file_name() == Some(OsStr::new("setup.cfg"))
|| path.file_name() == Some(OsStr::new("setup.py"))
|| self.is_path_lockfile(path)
Expand Down Expand Up @@ -147,13 +146,9 @@ impl Parse for Poetry {
path.file_name() == Some(OsStr::new("poetry.lock"))
}

fn is_path_manifest(&self, path: &Path) -> bool {
path.file_name() == Some(OsStr::new("pyproject.toml"))
}

#[cfg(feature = "generator")]
fn generator(&self) -> Option<&'static dyn Generator> {
Some(&PoetryGenerator)
fn is_path_manifest(&self, _path: &Path) -> bool {
// `pyproject.toml` is handled by PyRequirements parser
false
}
}

Expand Down
1 change: 0 additions & 1 deletion lockfile_generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pub mod gradle;
pub mod maven;
pub mod npm;
pub mod pip;
pub mod poetry;
pub mod python_requirements;
pub mod yarn;

Expand Down
20 changes: 0 additions & 20 deletions lockfile_generator/src/poetry.rs

This file was deleted.

0 comments on commit e8b78a0

Please sign in to comment.