-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pip): prevent conflict if setuptools is runtime dependency
- Loading branch information
Showing
6 changed files
with
131 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
modules/dream2nix/pip/tests/packages/can-handle-setuptools-runtime-dep/default.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# An example package with dependencies defined via pyproject.toml | ||
{ | ||
config, | ||
lib, | ||
dream2nix, | ||
... | ||
}: let | ||
pyproject = lib.importTOML (config.mkDerivation.src + /pyproject.toml); | ||
in { | ||
imports = [ | ||
dream2nix.modules.dream2nix.pip | ||
]; | ||
|
||
deps = {nixpkgs, ...}: { | ||
python = nixpkgs.python310; | ||
}; | ||
|
||
inherit (pyproject.project) name version; | ||
|
||
mkDerivation = { | ||
src = ./.; | ||
propagatedBuildInputs = [ | ||
config.pip.drvs.setuptools.public | ||
]; | ||
}; | ||
|
||
buildPythonPackage = { | ||
format = lib.mkForce "pyproject"; | ||
pythonImportsCheck = [ | ||
"my_tool" | ||
]; | ||
}; | ||
|
||
pip = { | ||
pypiSnapshotDate = "2023-08-27"; | ||
requirementsList = | ||
pyproject.build-system.requires | ||
or [] | ||
++ pyproject.project.dependencies; | ||
flattenDependencies = true; | ||
}; | ||
} |
32 changes: 32 additions & 0 deletions
32
modules/dream2nix/pip/tests/packages/can-handle-setuptools-runtime-dep/flake.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
description = "My flake with dream2nix packages"; | ||
|
||
inputs = { | ||
dream2nix.url = "github:nix-community/dream2nix"; | ||
nixpkgs.follows = "dream2nix/nixpkgs"; | ||
}; | ||
|
||
outputs = inputs @ { | ||
self, | ||
dream2nix, | ||
nixpkgs, | ||
... | ||
}: let | ||
system = "x86_64-linux"; | ||
in { | ||
# All packages defined in ./packages/<name> are automatically added to the flake outputs | ||
# e.g., 'packages/hello/default.nix' becomes '.#packages.hello' | ||
packages.${system}.default = dream2nix.lib.evalModules { | ||
packageSets.nixpkgs = inputs.dream2nix.inputs.nixpkgs.legacyPackages.${system}; | ||
modules = [ | ||
./default.nix | ||
{ | ||
paths.projectRoot = ./.; | ||
# can be changed to ".git" or "flake.nix" to get rid of .project-root | ||
paths.projectRootFile = "flake.nix"; | ||
paths.package = ./.; | ||
} | ||
]; | ||
}; | ||
}; | ||
} |
27 changes: 27 additions & 0 deletions
27
modules/dream2nix/pip/tests/packages/can-handle-setuptools-runtime-dep/lock.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"fetchPipMetadata": { | ||
"sources": { | ||
"setuptools": { | ||
"sha256": "3d8083eed2d13afc9426f227b24fd1659489ec107c0e86cec2ffdde5c92e790b", | ||
"type": "url", | ||
"url": "https://files.pythonhosted.org/packages/4f/ab/0bcfebdfc3bfa8554b2b2c97a555569c4c1ebc74ea288741ea8326c51906/setuptools-68.1.2-py3-none-any.whl", | ||
"version": "68.1.2" | ||
}, | ||
"zope-event": { | ||
"sha256": "2832e95014f4db26c47a13fdaef84cef2f4df37e66b59d8f1f4a8f319a632c26", | ||
"type": "url", | ||
"url": "https://files.pythonhosted.org/packages/fe/42/f8dbc2b9ad59e927940325a22d6d3931d630c3644dae7e2369ef5d9ba230/zope.event-5.0-py3-none-any.whl", | ||
"version": "5.0" | ||
} | ||
}, | ||
"targets": { | ||
"default": { | ||
"setuptools": [], | ||
"zope-event": [ | ||
"setuptools" | ||
] | ||
} | ||
} | ||
}, | ||
"invalidationHash": "a28486f07b358a61417372651204d501d66b8e54addea5c6a66fa306a5074d6f" | ||
} |
9 changes: 9 additions & 0 deletions
9
modules/dream2nix/pip/tests/packages/can-handle-setuptools-runtime-dep/my_tool/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import zope.event | ||
|
||
|
||
def main(): | ||
print("Hello World!") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
16 changes: 16 additions & 0 deletions
16
modules/dream2nix/pip/tests/packages/can-handle-setuptools-runtime-dep/pyproject.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[build-system] | ||
requires = [ "setuptools" ] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "my-tool" | ||
description = "my tool" | ||
version = "1.0.0" | ||
dependencies = [ | ||
# This depends on setuptools at runtime | ||
# It must not lead to a conflict with the nixpkgs setuptools | ||
"zope-event" | ||
] | ||
|
||
[project.scripts] | ||
my-tool = "my_tool:main" |