├── doc ├── .gitignore ├── src │ ├── lib │ ├── FAQ.md │ ├── SUMMARY.md │ ├── basic.md │ ├── introduction.md │ └── HACKING.md ├── dev │ ├── update_highlight.sh │ └── highlightjs.nix ├── book.toml └── default.nix ├── templates └── app │ ├── src │ └── app │ │ └── __init__.py │ ├── README.md │ ├── pyproject.toml │ ├── pdm.lock │ └── flake.nix ├── tests ├── nested │ ├── a │ │ ├── src │ │ │ └── a │ │ │ │ └── __init__.py │ │ ├── tests │ │ │ └── __init__.py │ │ ├── README.md │ │ ├── pyproject.toml │ │ ├── pdm.lock │ │ └── .gitignore │ ├── b │ │ ├── src │ │ │ └── b │ │ │ │ └── __init__.py │ │ ├── tests │ │ │ └── __init__.py │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── .gitignore │ ├── c-editable │ │ ├── tests │ │ │ └── __init__.py │ │ ├── README.md │ │ ├── src │ │ │ └── example_package │ │ │ │ └── __init__.py │ │ ├── pyproject.toml │ │ └── .gitignore │ └── default.nix ├── trivial │ ├── README.md │ ├── pyproject.toml │ ├── default.nix │ └── pdm.lock ├── nested-poetry │ ├── a │ │ ├── src │ │ │ └── a │ │ │ │ └── __init__.py │ │ ├── tests │ │ │ └── __init__.py │ │ ├── README.md │ │ ├── pyproject.toml │ │ ├── pdm.lock │ │ └── .gitignore │ ├── b │ │ ├── src │ │ │ └── b │ │ │ │ └── __init__.py │ │ ├── tests │ │ │ └── __init__.py │ │ ├── README.md │ │ ├── pyproject.toml │ │ ├── _ │ │ └── .gitignore │ └── default.nix ├── nested-setuptools │ ├── a │ │ ├── src │ │ │ └── a │ │ │ │ └── __init__.py │ │ ├── tests │ │ │ └── __init__.py │ │ ├── README.md │ │ ├── pdm.lock │ │ ├── pyproject.toml │ │ └── .gitignore │ ├── b │ │ ├── src │ │ │ └── b │ │ │ │ └── __init__.py │ │ ├── tests │ │ │ └── __init__.py │ │ ├── README.md │ │ ├── setup.py │ │ ├── default.nix │ │ └── .gitignore │ └── default.nix └── default.nix ├── .envrc ├── README.md ├── .gitignore ├── lib ├── fixtures │ ├── kitchen-sink │ │ ├── a │ │ │ ├── tests │ │ │ │ └── __init__.py │ │ │ ├── README.md │ │ │ ├── src │ │ │ │ └── example_package │ │ │ │ │ └── __init__.py │ │ │ ├── pyproject.toml │ │ │ ├── .gitignore │ │ │ └── pdm.lock │ │ ├── b │ │ │ ├── tests │ │ │ │ └── __init__.py │ │ │ ├── README.md │ │ │ ├── src │ │ │ │ └── example_package │ │ │ │ │ └── __init__.py │ │ │ ├── pyproject.toml │ │ │ ├── pdm.lock │ │ │ └── .gitignore │ │ ├── c-editable │ │ │ ├── tests │ │ │ │ └── __init__.py │ │ │ ├── README.md │ │ │ ├── src │ │ │ │ └── example_package │ │ │ │ │ └── __init__.py │ │ │ ├── pyproject.toml │ │ │ └── .gitignore │ │ └── attrs-23.1.0.tar.gz │ ├── trivial │ │ ├── README.md │ │ ├── src │ │ │ └── trivial │ │ │ │ └── __init__.py │ │ ├── pyproject.toml │ │ └── pdm.lock │ └── with-marker │ │ ├── README.md │ │ ├── src │ │ └── with_marker │ │ │ └── __init__.py │ │ ├── pyproject.toml │ │ └── pdm.lock ├── default.nix ├── overlays.nix ├── test.nix ├── editable.nix ├── test_overlays.nix ├── test_editable.nix ├── test_lock.nix └── lock.nix ├── TODO.org ├── Procfile ├── dev └── treefmt.nix ├── .github └── workflows │ └── nix-github-actions.yml ├── flake.nix └── flake.lock /doc/.gitignore: -------------------------------------------------------------------------------- 1 | book 2 | -------------------------------------------------------------------------------- /doc/src/lib: -------------------------------------------------------------------------------- 1 | ../../lib -------------------------------------------------------------------------------- /doc/src/FAQ.md: -------------------------------------------------------------------------------- 1 | # FAQ 2 | -------------------------------------------------------------------------------- /templates/app/src/app/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/nested/a/src/a/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/nested/a/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/nested/b/src/b/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/nested/b/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | use flake 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Status: Not maintained. 2 | -------------------------------------------------------------------------------- /tests/trivial/README.md: -------------------------------------------------------------------------------- 1 | Hello! 2 | -------------------------------------------------------------------------------- /tests/nested-poetry/a/src/a/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/nested-poetry/a/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/nested-poetry/b/src/b/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/nested-poetry/b/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/nested-setuptools/a/src/a/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/nested-setuptools/a/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/nested-setuptools/b/src/b/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/nested-setuptools/b/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/nested/c-editable/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .venv 2 | .pdm-python 3 | .direnv 4 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/a/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/b/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/fixtures/trivial/README.md: -------------------------------------------------------------------------------- 1 | # trivial 2 | -------------------------------------------------------------------------------- /lib/fixtures/trivial/src/trivial/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/fixtures/with-marker/README.md: -------------------------------------------------------------------------------- 1 | # trivial 2 | -------------------------------------------------------------------------------- /tests/nested/a/README.md: -------------------------------------------------------------------------------- 1 | # example-package 2 | -------------------------------------------------------------------------------- /tests/nested/b/README.md: -------------------------------------------------------------------------------- 1 | # example-package 2 | -------------------------------------------------------------------------------- /lib/fixtures/with-marker/src/with_marker/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /templates/app/README.md: -------------------------------------------------------------------------------- 1 | # Example pdm2nix app 2 | -------------------------------------------------------------------------------- /tests/nested-poetry/a/README.md: -------------------------------------------------------------------------------- 1 | # example-package 2 | -------------------------------------------------------------------------------- /tests/nested-poetry/b/README.md: -------------------------------------------------------------------------------- 1 | # example-package 2 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/c-editable/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/nested-setuptools/a/README.md: -------------------------------------------------------------------------------- 1 | # example-package 2 | -------------------------------------------------------------------------------- /tests/nested-setuptools/b/README.md: -------------------------------------------------------------------------------- 1 | # example-package 2 | -------------------------------------------------------------------------------- /tests/nested/c-editable/README.md: -------------------------------------------------------------------------------- 1 | # example-package 2 | -------------------------------------------------------------------------------- /tests/nested/c-editable/src/example_package/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/a/README.md: -------------------------------------------------------------------------------- 1 | # example-package 2 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/a/src/example_package/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/b/README.md: -------------------------------------------------------------------------------- 1 | # example-package 2 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/b/src/example_package/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/c-editable/README.md: -------------------------------------------------------------------------------- 1 | # example-package 2 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/c-editable/src/example_package/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /TODO.org: -------------------------------------------------------------------------------- 1 | * test preferWheel & preferWheels 2 | * test static_urls 3 | * editable 4 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | nix-unit: reflex -r '\.(nix)$' -- nix-unit --quiet --flake '.#libTests' 2 | doc: bash -c 'cd doc && mdbook serve' 3 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/attrs-23.1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adisbladis/pdm2nix/HEAD/lib/fixtures/kitchen-sink/attrs-23.1.0.tar.gz -------------------------------------------------------------------------------- /tests/nested-setuptools/b/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | 3 | setup( 4 | name="b", 5 | version="0.1.0", 6 | packages=find_packages(), 7 | ) 8 | -------------------------------------------------------------------------------- /doc/dev/update_highlight.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | result=$(nix-build --no-out-link ./highlightjs.nix) 4 | cp -f "$result"/highlight.min.js ../theme/highlight.js 5 | -------------------------------------------------------------------------------- /tests/nested-setuptools/b/default.nix: -------------------------------------------------------------------------------- 1 | { buildPythonPackage }: 2 | 3 | buildPythonPackage { 4 | pname = "b"; 5 | version = "0.1.0"; 6 | src = ./.; 7 | format = "setuptools"; 8 | } 9 | -------------------------------------------------------------------------------- /doc/src/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Contents 2 | 3 | - [Introduction](./introduction.md) 4 | 5 | # Usage 6 | 7 | - [Basic usage](./basic.md) 8 | 9 | # Meta 10 | 11 | - [FAQ](./FAQ.md) 12 | 13 | # Reference 14 | 15 | - [Lock](./lib/lock.nix) 16 | 17 | # Contributing 18 | 19 | - [Hacking](./HACKING.md) 20 | -------------------------------------------------------------------------------- /lib/fixtures/trivial/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "" 3 | version = "" 4 | description = "" 5 | authors = [ 6 | {name = "", email = ""}, 7 | ] 8 | dependencies = [ 9 | "arpeggio>=2.0.2", 10 | ] 11 | requires-python = ">=3.11" 12 | readme = "README.md" 13 | license = {text = "MIT"} 14 | -------------------------------------------------------------------------------- /lib/fixtures/with-marker/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "with_marker" 3 | version = "" 4 | description = "" 5 | authors = [ 6 | {name = "", email = ""}, 7 | ] 8 | dependencies = [ 9 | "pytest>=8.3.2" 10 | ] 11 | requires-python = ">=3.11" 12 | readme = "README.md" 13 | license = {text = "MIT"} 14 | -------------------------------------------------------------------------------- /tests/nested/c-editable/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "c" 3 | version = "0.1.0" 4 | description = "Dummy project depended on in editable mode by a" 5 | authors = [ 6 | {name = "adisbladis", email = "adisbladis@gmail.com"}, 7 | ] 8 | requires-python = ">=3.11" 9 | readme = "README.md" 10 | license = {text = "MIT"} 11 | -------------------------------------------------------------------------------- /lib/default.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , pyproject-nix 3 | , 4 | }: 5 | let 6 | inherit (builtins) mapAttrs; 7 | inherit (lib) fix; 8 | in 9 | fix (self: 10 | mapAttrs (_: path: import path ({ inherit lib pyproject-nix; } // self)) { 11 | editable = ./editable.nix; 12 | overlays = ./overlays.nix; 13 | lock = ./lock.nix; 14 | }) 15 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/c-editable/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "c" 3 | version = "0.1.0" 4 | description = "Dummy project depended on in editable mode by a" 5 | authors = [ 6 | {name = "adisbladis", email = "adisbladis@gmail.com"}, 7 | ] 8 | requires-python = ">=3.11" 9 | readme = "README.md" 10 | license = {text = "MIT"} 11 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/b/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "b" 3 | version = "0.1.0" 4 | description = "Dummy project depended on by a" 5 | authors = [ 6 | {name = "adisbladis", email = "adisbladis@gmail.com"}, 7 | ] 8 | dependencies = [ 9 | "certifi", 10 | ] 11 | requires-python = ">=3.11" 12 | readme = "README.md" 13 | license = {text = "MIT"} 14 | -------------------------------------------------------------------------------- /tests/nested-setuptools/a/pdm.lock: -------------------------------------------------------------------------------- 1 | # This file is @generated by PDM. 2 | # It is not intended for manual editing. 3 | 4 | [metadata] 5 | groups = ["default"] 6 | strategy = ["cross_platform"] 7 | lock_version = "4.4" 8 | content_hash = "sha256:a2610f14c9e96b7b44e1aae19596c06ae8905c3ff0beec4d2bf734cd55cb3d9b" 9 | 10 | [[package]] 11 | name = "b" 12 | version = "0.1.0" 13 | path = "../b" 14 | summary = "" 15 | -------------------------------------------------------------------------------- /templates/app/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "app" 3 | version = "0.1.0" 4 | description = "example app using pdm2nix" 5 | authors = [ 6 | {name = "", email = ""}, 7 | ] 8 | dependencies = [ 9 | "arpeggio>=2.0.2", 10 | ] 11 | requires-python = ">=3.11" 12 | readme = "README.md" 13 | license = {text = "MIT"} 14 | 15 | [build-system] 16 | requires = ["pdm-backend"] 17 | build-backend = "pdm.backend" 18 | -------------------------------------------------------------------------------- /tests/nested-poetry/b/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "b" 3 | version = "0.1.0" 4 | description = "Dummy project depended on by a" 5 | authors = ["adisbladis "] 6 | readme = "README.md" 7 | 8 | [tool.poetry.dependencies] 9 | python = "^3.11" 10 | certifi = "^2023.7.22" 11 | 12 | 13 | [build-system] 14 | requires = ["poetry-core"] 15 | build-backend = "poetry.core.masonry.api" 16 | -------------------------------------------------------------------------------- /tests/trivial/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "trivial" 3 | version = "0.1.0" 4 | description = "Demo project" 5 | authors = [ 6 | {name = "adisbladis", email = "adisbladis@gmail.com"}, 7 | ] 8 | dependencies = [ 9 | "requests" 10 | ] 11 | requires-python = ">=3.11" 12 | readme = "README.md" 13 | license = {text = "MIT"} 14 | 15 | [build-system] 16 | requires = ["pdm-backend"] 17 | build-backend = "pdm.backend" 18 | -------------------------------------------------------------------------------- /tests/nested-poetry/b/_: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "b" 3 | version = "0.1.0" 4 | description = "Dummy project depended on by a" 5 | authors = [ 6 | {name = "adisbladis", email = "adisbladis@gmail.com"}, 7 | ] 8 | dependencies = [ 9 | "certifi", 10 | ] 11 | requires-python = ">=3.11" 12 | readme = "README.md" 13 | license = {text = "MIT"} 14 | 15 | [build-system] 16 | requires = ["pdm-backend"] 17 | build-backend = "pdm.backend" 18 | -------------------------------------------------------------------------------- /tests/nested/b/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "b" 3 | version = "0.1.0" 4 | description = "Dummy project depended on by a" 5 | authors = [ 6 | {name = "adisbladis", email = "adisbladis@gmail.com"}, 7 | ] 8 | dependencies = [ 9 | "certifi", 10 | ] 11 | requires-python = ">=3.11" 12 | readme = "README.md" 13 | license = {text = "MIT"} 14 | 15 | [build-system] 16 | requires = ["pdm-backend"] 17 | build-backend = "pdm.backend" 18 | -------------------------------------------------------------------------------- /tests/nested-poetry/a/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "a" 3 | version = "0.1.0" 4 | description = "Simple project A" 5 | authors = [ 6 | {name = "adisbladis", email = "adisbladis@gmail.com"}, 7 | ] 8 | dependencies = [ 9 | # Local dependency (path) 10 | "b @ file:///${PROJECT_ROOT}/../b", 11 | ] 12 | requires-python = ">=3.11" 13 | readme = "README.md" 14 | license = {text = "MIT"} 15 | 16 | [build-system] 17 | requires = ["pdm-backend"] 18 | build-backend = "pdm.backend" 19 | -------------------------------------------------------------------------------- /tests/nested-setuptools/a/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "a" 3 | version = "0.1.0" 4 | description = "Simple project A" 5 | authors = [ 6 | {name = "adisbladis", email = "adisbladis@gmail.com"}, 7 | ] 8 | dependencies = [ 9 | # Local dependency (path) 10 | "b @ file:///${PROJECT_ROOT}/../b", 11 | ] 12 | requires-python = ">=3.11" 13 | readme = "README.md" 14 | license = {text = "MIT"} 15 | 16 | [build-system] 17 | requires = ["pdm-backend"] 18 | build-backend = "pdm.backend" 19 | -------------------------------------------------------------------------------- /doc/src/basic.md: -------------------------------------------------------------------------------- 1 | # Basic usage 2 | 3 | This basic example builds upon concepts from [pyproject.nix](https://nix-community.github.io/pyproject.nix/). 4 | To understand this example first make sure you understand the [pyproject.toml example](https://nix-community.github.io/pyproject.nix/use-cases/pyproject.html). 5 | 6 | ## flake.nix 7 | 8 | ```nix 9 | {{#include ../../templates/app/flake.nix}} 10 | ``` 11 | 12 | ## pyproject.toml 13 | 14 | ```nix 15 | {{#include ../../templates/app/pyproject.toml}} 16 | ``` 17 | -------------------------------------------------------------------------------- /dev/treefmt.nix: -------------------------------------------------------------------------------- 1 | _: { 2 | # Used to find the project root 3 | projectRootFile = "flake.lock"; 4 | 5 | # JS/doc 6 | programs.prettier.enable = true; 7 | settings.formatter.prettier.excludes = [ "highlight.js" ]; 8 | 9 | # Shell 10 | programs.shellcheck.enable = true; 11 | 12 | # Nix 13 | programs.deadnix.enable = true; 14 | programs.statix.enable = true; 15 | programs.nixpkgs-fmt.enable = true; 16 | 17 | # Python 18 | programs.black.enable = true; 19 | programs.ruff.enable = true; 20 | } 21 | -------------------------------------------------------------------------------- /doc/book.toml: -------------------------------------------------------------------------------- 1 | [book] 2 | authors = ["adisbladis"] 3 | language = "en" 4 | multilingual = false 5 | src = "src" 6 | title = "pdm2nix" 7 | 8 | [preprocessor.nixdoc] 9 | command = "mdbook-nixdoc" 10 | 11 | [preprocessor.open-on-gh] 12 | command = "mdbook-open-on-gh" 13 | renderer = ["html"] 14 | 15 | [output.html] 16 | git-repository-url = "https://github.com/adisbladis/pdm2nix" 17 | git-branch = "master" 18 | open-on-text = """ 19 |
20 | Found an issue? [Edit this page on GitHub.] 21 | """ 22 | -------------------------------------------------------------------------------- /doc/src/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | ## What is `pdm2nix` 4 | 5 | `pdm2nix` takes a [PDM](https://pdm-project.org/) project as parsed by [pyproject.nix](https://nix-community.github.io/pyproject.nix) and generates a Python packages overlay. 6 | 7 | The generated overlay can be plugged in to a [nixpkgs](https://github.com/nixos/nixpkgs) Python derivation to manage whole Nix Python package sets using PDM. 8 | 9 | To use `pdm2nix` you first need to understand [pyproject.nix](https://nix-community.github.io/pyproject.nix/). 10 | -------------------------------------------------------------------------------- /tests/nested-setuptools/default.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , pyproject-nix 3 | , pdm2nix 4 | , python3 5 | , overrides 6 | }: 7 | let 8 | project = pyproject-nix.lib.project.loadPDMPyproject { 9 | projectRoot = ./a; 10 | }; 11 | 12 | python = python3.override { 13 | self = python; 14 | packageOverrides = lib.composeManyExtensions [ 15 | (pdm2nix.lib.lock.mkOverlay { inherit project; preferWheels = false; }) 16 | overrides 17 | ]; 18 | }; 19 | 20 | in 21 | python.pkgs.buildPythonPackage ( 22 | project.renderers.buildPythonPackage { inherit python; } 23 | ) 24 | -------------------------------------------------------------------------------- /tests/nested/default.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , pyproject-nix 3 | , pdm2nix 4 | , python3 5 | , overrides 6 | }: 7 | let 8 | project = pyproject-nix.lib.project.loadPDMPyproject { 9 | projectRoot = ./a; 10 | }; 11 | 12 | python = python3.override { 13 | self = python; 14 | packageOverrides = lib.composeManyExtensions [ 15 | (pdm2nix.lib.lock.mkOverlay { inherit project; preferWheels = false; }) 16 | overrides 17 | ]; 18 | }; 19 | 20 | in 21 | python.withPackages ( 22 | project.renderers.withPackages { 23 | inherit python; 24 | extras = [ "dev" ]; 25 | } 26 | ) 27 | -------------------------------------------------------------------------------- /tests/nested-poetry/default.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , pyproject-nix 3 | , pdm2nix 4 | , python3 5 | , overrides 6 | }: 7 | let 8 | project = pyproject-nix.lib.project.loadPDMPyproject { 9 | projectRoot = ./a; 10 | }; 11 | 12 | python = python3.override { 13 | self = python; 14 | packageOverrides = lib.composeManyExtensions [ 15 | (pdm2nix.lib.lock.mkOverlay { inherit project; preferWheels = false; }) 16 | overrides 17 | ]; 18 | }; 19 | 20 | in 21 | python.pkgs.buildPythonPackage ( 22 | project.renderers.buildPythonPackage { inherit python; } // { 23 | src = ./a; 24 | } 25 | ) 26 | -------------------------------------------------------------------------------- /tests/nested/a/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "a" 3 | version = "0.1.0" 4 | description = "Simple project A" 5 | authors = [ 6 | {name = "adisbladis", email = "adisbladis@gmail.com"}, 7 | ] 8 | dependencies = [ 9 | # Local dependency (path) 10 | "b @ file:///${PROJECT_ROOT}/../b", 11 | ] 12 | requires-python = ">=3.11" 13 | readme = "README.md" 14 | license = {text = "MIT"} 15 | 16 | [build-system] 17 | requires = ["pdm-backend"] 18 | build-backend = "pdm.backend" 19 | 20 | # Editable dependencies are always in the dev group. 21 | [tool.pdm.dev-dependencies] 22 | dev = [ 23 | "-e file:///${PROJECT_ROOT}/../c-editable#egg=c", 24 | ] 25 | -------------------------------------------------------------------------------- /templates/app/pdm.lock: -------------------------------------------------------------------------------- 1 | # This file is @generated by PDM. 2 | # It is not intended for manual editing. 3 | 4 | [metadata] 5 | groups = ["default"] 6 | strategy = ["cross_platform"] 7 | lock_version = "4.4" 8 | content_hash = "sha256:05425a198cd837275efb71f3a3f5045821589612b04b3c0cd527e64de8baf669" 9 | 10 | [[package]] 11 | name = "arpeggio" 12 | version = "2.0.2" 13 | summary = "Packrat parser interpreter" 14 | requires_python = ">=3.7" 15 | files = [ 16 | {file = "Arpeggio-2.0.2-py2.py3-none-any.whl", hash = "sha256:f7c8ae4f4056a89e020c24c7202ac8df3e2bc84e416746f20b0da35bb1de0250"}, 17 | {file = "Arpeggio-2.0.2.tar.gz", hash = "sha256:c790b2b06e226d2dd468e4fbfb5b7f506cec66416031fde1441cf1de2a0ba700"}, 18 | ] 19 | -------------------------------------------------------------------------------- /lib/fixtures/trivial/pdm.lock: -------------------------------------------------------------------------------- 1 | # This file is @generated by PDM. 2 | # It is not intended for manual editing. 3 | 4 | [metadata] 5 | groups = ["default"] 6 | strategy = ["cross_platform"] 7 | lock_version = "4.4" 8 | content_hash = "sha256:05425a198cd837275efb71f3a3f5045821589612b04b3c0cd527e64de8baf669" 9 | 10 | [[package]] 11 | name = "arpeggio" 12 | version = "2.0.2" 13 | summary = "Packrat parser interpreter" 14 | requires_python = ">=3.7" 15 | files = [ 16 | {file = "Arpeggio-2.0.2-py2.py3-none-any.whl", hash = "sha256:f7c8ae4f4056a89e020c24c7202ac8df3e2bc84e416746f20b0da35bb1de0250"}, 17 | {file = "Arpeggio-2.0.2.tar.gz", hash = "sha256:c790b2b06e226d2dd468e4fbfb5b7f506cec66416031fde1441cf1de2a0ba700"}, 18 | ] 19 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/b/pdm.lock: -------------------------------------------------------------------------------- 1 | # This file is @generated by PDM. 2 | # It is not intended for manual editing. 3 | 4 | [metadata] 5 | groups = ["default"] 6 | strategy = ["cross_platform"] 7 | lock_version = "4.4" 8 | content_hash = "sha256:4bee5bc8caebb8fd26f334c372e394098390ceaaaa59e90e523de92b9308efc9" 9 | 10 | [[package]] 11 | name = "certifi" 12 | version = "2023.7.22" 13 | requires_python = ">=3.6" 14 | summary = "Python package for providing Mozilla's CA Bundle." 15 | files = [ 16 | {file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"}, 17 | {file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, 18 | ] 19 | -------------------------------------------------------------------------------- /doc/default.nix: -------------------------------------------------------------------------------- 1 | { stdenv 2 | , nixdoc 3 | , self 4 | , mdbook 5 | , mdbook-nixdoc 6 | , mdbook-open-on-gh 7 | , git 8 | }: 9 | 10 | stdenv.mkDerivation { 11 | pname = "pdm2nix-docs-html"; 12 | version = "0.1"; 13 | src = self; 14 | sourceRoot = "source/doc"; 15 | nativeBuildInputs = [ 16 | nixdoc 17 | mdbook 18 | mdbook-open-on-gh 19 | mdbook-nixdoc 20 | git 21 | ]; 22 | 23 | dontConfigure = true; 24 | dontFixup = true; 25 | 26 | env.RUST_BACKTRACE = 1; 27 | 28 | buildPhase = '' 29 | runHook preBuild 30 | chmod +w ../ && mkdir ../.git # Trick open-on-gh to find the git root 31 | mdbook build 32 | runHook postBuild 33 | ''; 34 | 35 | installPhase = '' 36 | runHook preInstall 37 | mv book $out 38 | runHook postInstall 39 | ''; 40 | } 41 | -------------------------------------------------------------------------------- /lib/overlays.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | let 3 | inherit (builtins) hasAttr; 4 | in 5 | lib.fix (self: { 6 | /* 7 | Return overlay `a` with `b` applied, but only with intersecting keys. 8 | 9 | Example: 10 | intersect (final: prev: { foo = 1; }) (final: prev: { foo = 1; bar = 2; }) 11 | */ 12 | intersect = 13 | # Overlay a 14 | a: 15 | # Overlay b 16 | b: (final: prev: 17 | let 18 | aApplied = a final prev; 19 | in 20 | (lib.composeExtensions a (self.filter (name: _: hasAttr name aApplied) b)) final prev); 21 | 22 | /* 23 | Return overlay filtered by predicate. 24 | 25 | Example: 26 | filter (name: overriden: name == "requests") (self: super: { }) 27 | */ 28 | filter = pred: overlay: (self: super: lib.filterAttrs pred (overlay self super)); 29 | }) 30 | -------------------------------------------------------------------------------- /tests/nested-poetry/a/pdm.lock: -------------------------------------------------------------------------------- 1 | # This file is @generated by PDM. 2 | # It is not intended for manual editing. 3 | 4 | [metadata] 5 | groups = ["default"] 6 | strategy = ["cross_platform"] 7 | lock_version = "4.4" 8 | content_hash = "sha256:a2610f14c9e96b7b44e1aae19596c06ae8905c3ff0beec4d2bf734cd55cb3d9b" 9 | 10 | [[package]] 11 | name = "b" 12 | version = "0.1.0" 13 | requires_python = ">=3.11,<4.0" 14 | path = "../b" 15 | summary = "Dummy project depended on by a" 16 | dependencies = [ 17 | "certifi<2024.0.0,>=2023.7.22", 18 | ] 19 | 20 | [[package]] 21 | name = "certifi" 22 | version = "2023.7.22" 23 | requires_python = ">=3.6" 24 | summary = "Python package for providing Mozilla's CA Bundle." 25 | files = [ 26 | {file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"}, 27 | {file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, 28 | ] 29 | -------------------------------------------------------------------------------- /lib/test.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , pdm2nix 3 | , pkgs 4 | , pyproject-nix 5 | }: 6 | let 7 | inherit (builtins) mapAttrs substring stringLength length attrNames; 8 | inherit (lib) mapAttrs' toUpper; 9 | 10 | capitalise = s: toUpper (substring 0 1 s) + (substring 1 (stringLength s) s); 11 | 12 | callTest = path: import path (pdm2nix // { inherit pkgs lib pyproject-nix; }); 13 | in 14 | lib.fix (self: { 15 | editable = callTest ./test_editable.nix; 16 | overlays = callTest ./test_overlays.nix; 17 | lock = callTest ./test_lock.nix; 18 | 19 | # Yo dawg, I heard you like tests... 20 | # 21 | # Check that all exported modules are covered by a test suite with at least one test. 22 | coverage = 23 | mapAttrs 24 | (moduleName: 25 | mapAttrs' (sym: _: { 26 | name = "test" + capitalise sym; 27 | value = { 28 | expected = true; 29 | expr = self ? ${moduleName}.${sym} && length (attrNames self.${moduleName}.${sym}) >= 1; 30 | }; 31 | })) 32 | pdm2nix; 33 | }) 34 | -------------------------------------------------------------------------------- /tests/nested/a/pdm.lock: -------------------------------------------------------------------------------- 1 | # This file is @generated by PDM. 2 | # It is not intended for manual editing. 3 | 4 | [metadata] 5 | groups = ["default", "dev"] 6 | strategy = ["cross_platform"] 7 | lock_version = "4.4" 8 | content_hash = "sha256:7fb1ab4bf0b5690eb52dfa33af4e5ed30d37b3eec1a387aa8ad8060a9bc10bc3" 9 | 10 | [[package]] 11 | name = "b" 12 | version = "0.1.0" 13 | requires_python = ">=3.11" 14 | path = "../b" 15 | summary = "Dummy project depended on by a" 16 | dependencies = [ 17 | "certifi", 18 | ] 19 | 20 | [[package]] 21 | name = "c" 22 | version = "0.1.0" 23 | requires_python = ">=3.11" 24 | editable = true 25 | path = "../c-editable" 26 | summary = "Dummy project depended on in editable mode by a" 27 | 28 | [[package]] 29 | name = "certifi" 30 | version = "2023.7.22" 31 | requires_python = ">=3.6" 32 | summary = "Python package for providing Mozilla's CA Bundle." 33 | files = [ 34 | {file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"}, 35 | {file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, 36 | ] 37 | -------------------------------------------------------------------------------- /doc/dev/highlightjs.nix: -------------------------------------------------------------------------------- 1 | # Highlightjs updater expression 2 | # This is used to build our custom highlight.js module 3 | let 4 | flake = builtins.getFlake (builtins.toString ../../.); 5 | 6 | pkgs = flake.inputs.nixpkgs.legacyPackages.${builtins.currentSystem}; 7 | 8 | src = pkgs.fetchFromGitHub { 9 | owner = "highlightjs"; 10 | repo = "highlight.js"; 11 | rev = "10.7.3"; 12 | hash = "sha256-6IW8WFlWdb0txEQxYvrLcAxMx/F5qGpxwUbWpTloFaY="; 13 | }; 14 | 15 | npmlock2nix = pkgs.callPackage 16 | (pkgs.fetchFromGitHub { 17 | owner = "nix-community"; 18 | repo = "npmlock2nix"; 19 | rev = "9197bbf397d76059a76310523d45df10d2e4ca81"; 20 | sha256 = "sha256-sJM82Sj8yfQYs9axEmGZ9Evzdv/kDcI9sddqJ45frrU="; 21 | }) 22 | { }; 23 | 24 | 25 | in 26 | npmlock2nix.v2.build { 27 | inherit src; 28 | inherit (pkgs) nodejs; 29 | nativeBuildInputs = [ pkgs.git ]; 30 | installPhase = '' 31 | cp -r build $out 32 | ''; 33 | buildCommands = [ 34 | "git init" 35 | "git config user.email \"you@example.com\"" 36 | "git config user.name \"Your Name\"" 37 | "git add $(ls | grep -v node_modules | grep -v extra)" 38 | "git commit -m 'Dummy commit'" 39 | "node tools/build.js" 40 | ]; 41 | } 42 | -------------------------------------------------------------------------------- /tests/default.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , pyproject-nix 3 | , pdm2nix 4 | , pkgs 5 | }: 6 | let 7 | callTest = path: args: import path (args // { 8 | python3 = args.python3 or pkgs.python3; 9 | inherit lib pyproject-nix pdm2nix overrides; 10 | }); 11 | 12 | # A small set of overrides for packages used in tests. 13 | overrides = final: prev: { 14 | certifi = prev.certifi.overridePythonAttrs (old: { 15 | nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ final.setuptools ]; 16 | }); 17 | 18 | idna = prev.idna.overridePythonAttrs (old: { 19 | nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ final.flit-core ]; 20 | }); 21 | 22 | urllib3 = prev.urllib3.overridePythonAttrs (old: { 23 | nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ final.hatchling ]; 24 | }); 25 | 26 | charset-normalizer = prev.charset-normalizer.overridePythonAttrs (old: { 27 | nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ final.setuptools ]; 28 | }); 29 | 30 | requests = prev.requests.overridePythonAttrs (old: { 31 | nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ final.setuptools ]; 32 | }); 33 | }; 34 | 35 | in 36 | # Call all test cases from ./* 37 | lib.mapAttrs 38 | (name: _: callTest (./. + "/${name}") { }) 39 | (lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./.)) 40 | -------------------------------------------------------------------------------- /tests/trivial/default.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , pyproject-nix 3 | , pdm2nix 4 | , python3 5 | # You should use overrides from poetry2nix, but to keep the test small 6 | # We opt to bundle a small set in the tests to keep the dependencies as small as possible. 7 | , overrides 8 | }: 9 | let 10 | # Use project abstraction from pyproject.nix 11 | project = pyproject-nix.lib.project.loadPDMPyproject { 12 | # Load pyproject.toml/pdm.lock relative to project root. 13 | # This will also be used to set `src` for the renderer. 14 | projectRoot = ./.; 15 | }; 16 | 17 | # Manage overlays 18 | overlay = 19 | let 20 | # Create overlay using pdm2nix 21 | overlay' = pdm2nix.lib.lock.mkOverlay { inherit project; preferWheels = false; }; 22 | in 23 | # Apply some build system fixes. 24 | lib.composeExtensions overlay' overrides; 25 | 26 | # Create an overriden interpreter 27 | python = python3.override { 28 | # Note the self argument. 29 | # It's important so the interpreter/set is internally consistent. 30 | self = python; 31 | # Pass composed Python overlay to the interpreter 32 | packageOverrides = overlay; 33 | }; 34 | 35 | in 36 | # Call buildPythonPackage from the Python set 37 | python.pkgs.buildPythonPackage ( 38 | # Render a buildPythonPackage attrset with our overriden interpreter 39 | project.renderers.buildPythonPackage { inherit python; } 40 | ) 41 | -------------------------------------------------------------------------------- /lib/editable.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: 2 | 3 | { 4 | /* 5 | Make an editable package `pname` pointing to `path`. 6 | 7 | Note: To use this function `callPackage` it first, then call it with it's parameters. 8 | */ 9 | mkEditablePackage = 10 | { python 11 | , runCommand 12 | , toPythonModule 13 | }: 14 | { pname 15 | , version 16 | , summary ? "Editable package ${pname}" 17 | , path 18 | , entrypoints ? { } 19 | }: 20 | toPythonModule (runCommand "${pname}-${version}" 21 | { 22 | inherit pname version; 23 | } '' 24 | mkdir -p "$out/${python.sitePackages}" 25 | cd "$out/${python.sitePackages}" 26 | 27 | # See https://docs.python.org/3.8/library/site.html for info on such .pth files 28 | # These add another site package path for each line 29 | echo '${toString path}' > ${pname}-editable.pth 30 | 31 | # Create a very simple egg so pkg_resources can find this package 32 | # See https://setuptools.readthedocs.io/en/latest/formats.html for more info on the egg format 33 | mkdir "${pname}.egg-info" 34 | cd "${pname}.egg-info" 35 | 36 | # Just enough standard PKG-INFO fields for an editable installation 37 | cat > PKG-INFO < entry_points.txt < basic-editable.pth\n\n# Create a very simple egg so pkg_resources can find this package\n# See https://setuptools.readthedocs.io/en/latest/formats.html for more info on the egg format\nmkdir \"basic.egg-info\"\ncd \"basic.egg-info\"\n\n# Just enough standard PKG-INFO fields for an editable installation\ncat > PKG-INFO < basic-editable.pth\n\n# Create a very simple egg so pkg_resources can find this package\n# See https://setuptools.readthedocs.io/en/latest/formats.html for more info on the egg format\nmkdir \"basic.egg-info\"\ncd \"basic.egg-info\"\n\n# Just enough standard PKG-INFO fields for an editable installation\ncat > PKG-INFO < entry_points.txt <> "$GITHUB_OUTPUT" 29 | 30 | nix-build: 31 | needs: nix-matrix 32 | runs-on: ${{ matrix.os }} 33 | strategy: 34 | matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}} 35 | steps: 36 | - uses: actions/checkout@v4 37 | - uses: cachix/install-nix-action@v23 38 | with: 39 | github_access_token: ${{ secrets.GITHUB_TOKEN }} 40 | - uses: cachix/cachix-action@v12 41 | with: 42 | name: adisbladis 43 | authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" 44 | - run: nix build -L ".#${{ matrix.attr }}" 45 | 46 | nix-unit: 47 | runs-on: ubuntu-latest 48 | steps: 49 | - uses: actions/checkout@v4 50 | - uses: cachix/install-nix-action@v23 51 | with: 52 | github_access_token: ${{ secrets.GITHUB_TOKEN }} 53 | - uses: cachix/cachix-action@v12 54 | with: 55 | name: adisbladis 56 | authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" 57 | - name: Build shell 58 | run: nix develop -c true 59 | - name: Run tests 60 | run: nix develop -c nix-unit --flake .#libTests 61 | 62 | collect: 63 | runs-on: ubuntu-latest 64 | needs: 65 | - nix-unit 66 | - nix-build 67 | steps: 68 | - run: true 69 | 70 | deploy-pages: 71 | if: github.ref == 'refs/heads/master' 72 | runs-on: ubuntu-latest 73 | needs: collect 74 | steps: 75 | - uses: actions/checkout@v4 76 | - uses: cachix/install-nix-action@v23 77 | with: 78 | github_access_token: ${{ secrets.GITHUB_TOKEN }} 79 | - uses: cachix/cachix-action@v12 80 | with: 81 | name: adisbladis 82 | authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" 83 | - name: Run build 84 | run: nix build -L .#doc 85 | - name: Deploy 86 | uses: peaceiris/actions-gh-pages@v3 87 | with: 88 | github_token: ${{ secrets.GITHUB_TOKEN }} 89 | publish_dir: ./result 90 | force_orphan: true 91 | -------------------------------------------------------------------------------- /lib/fixtures/with-marker/pdm.lock: -------------------------------------------------------------------------------- 1 | # This file is @generated by PDM. 2 | # It is not intended for manual editing. 3 | 4 | [metadata] 5 | groups = ["default"] 6 | strategy = ["cross_platform", "inherit_metadata"] 7 | lock_version = "4.4.1" 8 | content_hash = "sha256:1a9fe36dffe30f34b79bf7c8adff368b8333ec0eab6667d76319a751d2abb604" 9 | 10 | [[package]] 11 | name = "colorama" 12 | version = "0.4.6" 13 | requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" 14 | summary = "Cross-platform colored terminal text." 15 | groups = ["default"] 16 | marker = "sys_platform == \"win32\"" 17 | files = [ 18 | {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, 19 | {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, 20 | ] 21 | 22 | [[package]] 23 | name = "iniconfig" 24 | version = "2.0.0" 25 | requires_python = ">=3.7" 26 | summary = "brain-dead simple config-ini parsing" 27 | groups = ["default"] 28 | files = [ 29 | {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, 30 | {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, 31 | ] 32 | 33 | [[package]] 34 | name = "packaging" 35 | version = "24.1" 36 | requires_python = ">=3.8" 37 | summary = "Core utilities for Python packages" 38 | groups = ["default"] 39 | files = [ 40 | {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, 41 | {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, 42 | ] 43 | 44 | [[package]] 45 | name = "pluggy" 46 | version = "1.5.0" 47 | requires_python = ">=3.8" 48 | summary = "plugin and hook calling mechanisms for python" 49 | groups = ["default"] 50 | files = [ 51 | {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, 52 | {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, 53 | ] 54 | 55 | [[package]] 56 | name = "pytest" 57 | version = "8.3.2" 58 | requires_python = ">=3.8" 59 | summary = "pytest: simple powerful testing with Python" 60 | groups = ["default"] 61 | dependencies = [ 62 | "colorama; sys_platform == \"win32\"", 63 | "iniconfig", 64 | "packaging", 65 | "pluggy<2,>=1.5", 66 | ] 67 | files = [ 68 | {file = "pytest-8.3.2-py3-none-any.whl", hash = "sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5"}, 69 | {file = "pytest-8.3.2.tar.gz", hash = "sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce"}, 70 | ] 71 | -------------------------------------------------------------------------------- /templates/app/flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "A basic flake using pdm2nix"; 3 | 4 | inputs.pyproject-nix.url = "github:nix-community/pyproject.nix"; 5 | inputs.pyproject-nix.inputs.nixpkgs.follows = "nixpkgs"; 6 | 7 | inputs.pdm2nix.url = "github:adisbladis/pdm2nix"; 8 | inputs.pdm2nix.inputs.pyproject-nix.follows = "pyproject-nix"; 9 | inputs.pdm2nix.inputs.nixpkgs.follows = "nixpkgs"; 10 | 11 | outputs = { nixpkgs, pyproject-nix, pdm2nix, ... }: 12 | let 13 | inherit (nixpkgs) lib; 14 | 15 | # Use project abstraction from pyproject.nix 16 | project = pyproject-nix.lib.project.loadPDMPyproject { 17 | projectRoot = ./.; 18 | }; 19 | 20 | # Manage overlays 21 | overlay = 22 | let 23 | # Create overlay using pdm2nix 24 | overlay' = pdm2nix.lib.lock.mkOverlay { 25 | inherit project; 26 | 27 | # Use sdists over binary wheels. 28 | # 29 | # Sdists are less likely to "just work" because of the metadata missing from pdm.lock. 30 | # Binary wheels are more likely to, but may still require overrides for library dependencies. 31 | preferWheels = false; 32 | }; 33 | 34 | # Pdm2nix can only work with what it has, and pdm.lock is missing essential metadata to perform some builds. 35 | # Some notable metadata missing is: 36 | # - PEP-517 build-systems 37 | # - Native dependencies 38 | # - Non-python dependencies 39 | # 40 | # The poetry2nix project has existing overlays you can use that fixes a lot of common issues, but you might 41 | # need to supplement your own. 42 | # 43 | # See https://nixos.org/manual/nixpkgs/stable/#python section on overriding Python packages. 44 | overrides = final: prev: { 45 | arpeggio = prev.arpeggio.overridePythonAttrs (oldAttrs: { 46 | nativeBuildInputs = oldAttrs.nativeBuildInputs or [ ] ++ [ final.setuptools ]; 47 | }); 48 | }; 49 | in 50 | lib.composeExtensions overlay' overrides; 51 | 52 | # This example is only using x86_64-linux 53 | pkgs = nixpkgs.legacyPackages.x86_64-linux; 54 | 55 | # Create an overriden interpreter 56 | python = pkgs.python3.override { 57 | # Note the self argument. 58 | # It's important so the interpreter/set is internally consistent. 59 | self = python; 60 | # Pass composed Python overlay to the interpreter 61 | packageOverrides = overlay; 62 | }; 63 | 64 | in 65 | { 66 | devShells.x86_64-linux.default = 67 | let 68 | # Render a withPackages function with our overriden interpreter 69 | arg = project.renderers.withPackages { inherit python; }; 70 | # And pass it to the interpreter function withPackages 71 | pythonEnv = python.withPackages arg; 72 | in 73 | pkgs.mkShell { 74 | packages = [ pythonEnv ]; 75 | }; 76 | 77 | packages.x86_64-linux.default = 78 | let 79 | # Render a buildPythonPackage attrset with our overriden interpreter 80 | attrs = project.renderers.buildPythonPackage { inherit python; }; 81 | in 82 | # Call buildPythonPackage from the Python set 83 | python.pkgs.buildPythonPackage attrs; 84 | }; 85 | } 86 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs = { 3 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; 4 | 5 | flake-parts.url = "github:hercules-ci/flake-parts"; 6 | flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; 7 | 8 | treefmt-nix.url = "github:numtide/treefmt-nix"; 9 | treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; 10 | 11 | nix-github-actions.url = "github:nix-community/nix-github-actions"; 12 | nix-github-actions.inputs.nixpkgs.follows = "nixpkgs"; 13 | 14 | nixdoc.url = "github:nix-community/nixdoc"; 15 | nixdoc.inputs.nixpkgs.follows = "nixpkgs"; 16 | 17 | pyproject-nix.url = "github:adisbladis/pyproject.nix"; 18 | pyproject-nix.inputs.nixpkgs.follows = "nixpkgs"; 19 | 20 | mdbook-nixdoc.url = "github:adisbladis/mdbook-nixdoc"; 21 | mdbook-nixdoc.inputs.nixpkgs.follows = "nixpkgs"; 22 | }; 23 | 24 | outputs = 25 | { self 26 | , nixpkgs 27 | , nix-github-actions 28 | , flake-parts 29 | , treefmt-nix 30 | , nixdoc 31 | , pyproject-nix 32 | , ... 33 | }@inputs: 34 | let 35 | inherit (nixpkgs) lib; 36 | in 37 | flake-parts.lib.mkFlake { inherit inputs; } { 38 | systems = [ 39 | "x86_64-linux" 40 | "aarch64-linux" 41 | "x86_64-darwin" 42 | "aarch64-darwin" 43 | ]; 44 | 45 | imports = [ treefmt-nix.flakeModule ]; 46 | 47 | flake.githubActions = nix-github-actions.lib.mkGithubMatrix { 48 | checks = { 49 | inherit (self.checks) x86_64-linux; 50 | }; 51 | }; 52 | 53 | flake.lib = import ./lib { 54 | inherit pyproject-nix; 55 | inherit lib; 56 | }; 57 | 58 | flake.templates = 59 | let 60 | root = ./templates; 61 | dirs = lib.attrNames (lib.filterAttrs (_: type: type == "directory") (builtins.readDir root)); 62 | in 63 | lib.listToAttrs ( 64 | map 65 | ( 66 | dir: 67 | let 68 | path = root + "/${dir}"; 69 | template = import (path + "/flake.nix"); 70 | in 71 | lib.nameValuePair dir { 72 | inherit path; 73 | inherit (template) description; 74 | } 75 | ) 76 | dirs 77 | ); 78 | 79 | # Expose unit tests for external discovery 80 | flake.libTests = import ./lib/test.nix { 81 | inherit lib pyproject-nix; 82 | pdm2nix = self.lib; 83 | pkgs = nixpkgs.legacyPackages.x86_64-linux; 84 | }; 85 | 86 | perSystem = 87 | { pkgs, system, ... }: 88 | { 89 | treefmt.imports = [ ./dev/treefmt.nix ]; 90 | 91 | checks = 92 | builtins.removeAttrs self.packages.${system} [ "default" ] 93 | // (import ./tests { 94 | inherit lib pyproject-nix pkgs; 95 | pdm2nix = self; 96 | }); 97 | 98 | devShells.default = pkgs.mkShell { 99 | packages = [ 100 | pkgs.hivemind 101 | pkgs.mdbook 102 | pkgs.reflex 103 | pkgs.nix-unit 104 | inputs.mdbook-nixdoc.packages.${system}.default 105 | pkgs.pdm 106 | pkgs.mercurial 107 | ] ++ self.packages.${system}.doc.nativeBuildInputs; 108 | }; 109 | 110 | packages.doc = pkgs.callPackage ./doc { 111 | inherit self; 112 | nixdoc = nixdoc.packages.${system}.default; 113 | mdbook-nixdoc = inputs.mdbook-nixdoc.packages.${system}.default; 114 | }; 115 | }; 116 | }; 117 | } 118 | -------------------------------------------------------------------------------- /tests/nested/a/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm-project.org/#use-with-ide 110 | .pdm.toml 111 | .pdm-python 112 | .pdm-build/ 113 | 114 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 115 | __pypackages__/ 116 | 117 | # Celery stuff 118 | celerybeat-schedule 119 | celerybeat.pid 120 | 121 | # SageMath parsed files 122 | *.sage.py 123 | 124 | # Environments 125 | .env 126 | .venv 127 | env/ 128 | venv/ 129 | ENV/ 130 | env.bak/ 131 | venv.bak/ 132 | 133 | # Spyder project settings 134 | .spyderproject 135 | .spyproject 136 | 137 | # Rope project settings 138 | .ropeproject 139 | 140 | # mkdocs documentation 141 | /site 142 | 143 | # mypy 144 | .mypy_cache/ 145 | .dmypy.json 146 | dmypy.json 147 | 148 | # Pyre type checker 149 | .pyre/ 150 | 151 | # pytype static type analyzer 152 | .pytype/ 153 | 154 | # Cython debug symbols 155 | cython_debug/ 156 | 157 | # PyCharm 158 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 159 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 160 | # and can be added to the global gitignore or merged into this file. For a more nuclear 161 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 162 | #.idea/ 163 | -------------------------------------------------------------------------------- /tests/nested/b/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm-project.org/#use-with-ide 110 | .pdm.toml 111 | .pdm-python 112 | .pdm-build/ 113 | 114 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 115 | __pypackages__/ 116 | 117 | # Celery stuff 118 | celerybeat-schedule 119 | celerybeat.pid 120 | 121 | # SageMath parsed files 122 | *.sage.py 123 | 124 | # Environments 125 | .env 126 | .venv 127 | env/ 128 | venv/ 129 | ENV/ 130 | env.bak/ 131 | venv.bak/ 132 | 133 | # Spyder project settings 134 | .spyderproject 135 | .spyproject 136 | 137 | # Rope project settings 138 | .ropeproject 139 | 140 | # mkdocs documentation 141 | /site 142 | 143 | # mypy 144 | .mypy_cache/ 145 | .dmypy.json 146 | dmypy.json 147 | 148 | # Pyre type checker 149 | .pyre/ 150 | 151 | # pytype static type analyzer 152 | .pytype/ 153 | 154 | # Cython debug symbols 155 | cython_debug/ 156 | 157 | # PyCharm 158 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 159 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 160 | # and can be added to the global gitignore or merged into this file. For a more nuclear 161 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 162 | #.idea/ 163 | -------------------------------------------------------------------------------- /tests/nested-poetry/a/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm-project.org/#use-with-ide 110 | .pdm.toml 111 | .pdm-python 112 | .pdm-build/ 113 | 114 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 115 | __pypackages__/ 116 | 117 | # Celery stuff 118 | celerybeat-schedule 119 | celerybeat.pid 120 | 121 | # SageMath parsed files 122 | *.sage.py 123 | 124 | # Environments 125 | .env 126 | .venv 127 | env/ 128 | venv/ 129 | ENV/ 130 | env.bak/ 131 | venv.bak/ 132 | 133 | # Spyder project settings 134 | .spyderproject 135 | .spyproject 136 | 137 | # Rope project settings 138 | .ropeproject 139 | 140 | # mkdocs documentation 141 | /site 142 | 143 | # mypy 144 | .mypy_cache/ 145 | .dmypy.json 146 | dmypy.json 147 | 148 | # Pyre type checker 149 | .pyre/ 150 | 151 | # pytype static type analyzer 152 | .pytype/ 153 | 154 | # Cython debug symbols 155 | cython_debug/ 156 | 157 | # PyCharm 158 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 159 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 160 | # and can be added to the global gitignore or merged into this file. For a more nuclear 161 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 162 | #.idea/ 163 | -------------------------------------------------------------------------------- /tests/nested-poetry/b/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm-project.org/#use-with-ide 110 | .pdm.toml 111 | .pdm-python 112 | .pdm-build/ 113 | 114 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 115 | __pypackages__/ 116 | 117 | # Celery stuff 118 | celerybeat-schedule 119 | celerybeat.pid 120 | 121 | # SageMath parsed files 122 | *.sage.py 123 | 124 | # Environments 125 | .env 126 | .venv 127 | env/ 128 | venv/ 129 | ENV/ 130 | env.bak/ 131 | venv.bak/ 132 | 133 | # Spyder project settings 134 | .spyderproject 135 | .spyproject 136 | 137 | # Rope project settings 138 | .ropeproject 139 | 140 | # mkdocs documentation 141 | /site 142 | 143 | # mypy 144 | .mypy_cache/ 145 | .dmypy.json 146 | dmypy.json 147 | 148 | # Pyre type checker 149 | .pyre/ 150 | 151 | # pytype static type analyzer 152 | .pytype/ 153 | 154 | # Cython debug symbols 155 | cython_debug/ 156 | 157 | # PyCharm 158 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 159 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 160 | # and can be added to the global gitignore or merged into this file. For a more nuclear 161 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 162 | #.idea/ 163 | -------------------------------------------------------------------------------- /tests/nested/c-editable/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm-project.org/#use-with-ide 110 | .pdm.toml 111 | .pdm-python 112 | .pdm-build/ 113 | 114 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 115 | __pypackages__/ 116 | 117 | # Celery stuff 118 | celerybeat-schedule 119 | celerybeat.pid 120 | 121 | # SageMath parsed files 122 | *.sage.py 123 | 124 | # Environments 125 | .env 126 | .venv 127 | env/ 128 | venv/ 129 | ENV/ 130 | env.bak/ 131 | venv.bak/ 132 | 133 | # Spyder project settings 134 | .spyderproject 135 | .spyproject 136 | 137 | # Rope project settings 138 | .ropeproject 139 | 140 | # mkdocs documentation 141 | /site 142 | 143 | # mypy 144 | .mypy_cache/ 145 | .dmypy.json 146 | dmypy.json 147 | 148 | # Pyre type checker 149 | .pyre/ 150 | 151 | # pytype static type analyzer 152 | .pytype/ 153 | 154 | # Cython debug symbols 155 | cython_debug/ 156 | 157 | # PyCharm 158 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 159 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 160 | # and can be added to the global gitignore or merged into this file. For a more nuclear 161 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 162 | #.idea/ 163 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/a/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm-project.org/#use-with-ide 110 | .pdm.toml 111 | .pdm-python 112 | .pdm-build/ 113 | 114 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 115 | __pypackages__/ 116 | 117 | # Celery stuff 118 | celerybeat-schedule 119 | celerybeat.pid 120 | 121 | # SageMath parsed files 122 | *.sage.py 123 | 124 | # Environments 125 | .env 126 | .venv 127 | env/ 128 | venv/ 129 | ENV/ 130 | env.bak/ 131 | venv.bak/ 132 | 133 | # Spyder project settings 134 | .spyderproject 135 | .spyproject 136 | 137 | # Rope project settings 138 | .ropeproject 139 | 140 | # mkdocs documentation 141 | /site 142 | 143 | # mypy 144 | .mypy_cache/ 145 | .dmypy.json 146 | dmypy.json 147 | 148 | # Pyre type checker 149 | .pyre/ 150 | 151 | # pytype static type analyzer 152 | .pytype/ 153 | 154 | # Cython debug symbols 155 | cython_debug/ 156 | 157 | # PyCharm 158 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 159 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 160 | # and can be added to the global gitignore or merged into this file. For a more nuclear 161 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 162 | #.idea/ 163 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/b/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm-project.org/#use-with-ide 110 | .pdm.toml 111 | .pdm-python 112 | .pdm-build/ 113 | 114 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 115 | __pypackages__/ 116 | 117 | # Celery stuff 118 | celerybeat-schedule 119 | celerybeat.pid 120 | 121 | # SageMath parsed files 122 | *.sage.py 123 | 124 | # Environments 125 | .env 126 | .venv 127 | env/ 128 | venv/ 129 | ENV/ 130 | env.bak/ 131 | venv.bak/ 132 | 133 | # Spyder project settings 134 | .spyderproject 135 | .spyproject 136 | 137 | # Rope project settings 138 | .ropeproject 139 | 140 | # mkdocs documentation 141 | /site 142 | 143 | # mypy 144 | .mypy_cache/ 145 | .dmypy.json 146 | dmypy.json 147 | 148 | # Pyre type checker 149 | .pyre/ 150 | 151 | # pytype static type analyzer 152 | .pytype/ 153 | 154 | # Cython debug symbols 155 | cython_debug/ 156 | 157 | # PyCharm 158 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 159 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 160 | # and can be added to the global gitignore or merged into this file. For a more nuclear 161 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 162 | #.idea/ 163 | -------------------------------------------------------------------------------- /tests/nested-setuptools/a/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm-project.org/#use-with-ide 110 | .pdm.toml 111 | .pdm-python 112 | .pdm-build/ 113 | 114 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 115 | __pypackages__/ 116 | 117 | # Celery stuff 118 | celerybeat-schedule 119 | celerybeat.pid 120 | 121 | # SageMath parsed files 122 | *.sage.py 123 | 124 | # Environments 125 | .env 126 | .venv 127 | env/ 128 | venv/ 129 | ENV/ 130 | env.bak/ 131 | venv.bak/ 132 | 133 | # Spyder project settings 134 | .spyderproject 135 | .spyproject 136 | 137 | # Rope project settings 138 | .ropeproject 139 | 140 | # mkdocs documentation 141 | /site 142 | 143 | # mypy 144 | .mypy_cache/ 145 | .dmypy.json 146 | dmypy.json 147 | 148 | # Pyre type checker 149 | .pyre/ 150 | 151 | # pytype static type analyzer 152 | .pytype/ 153 | 154 | # Cython debug symbols 155 | cython_debug/ 156 | 157 | # PyCharm 158 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 159 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 160 | # and can be added to the global gitignore or merged into this file. For a more nuclear 161 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 162 | #.idea/ 163 | -------------------------------------------------------------------------------- /tests/nested-setuptools/b/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm-project.org/#use-with-ide 110 | .pdm.toml 111 | .pdm-python 112 | .pdm-build/ 113 | 114 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 115 | __pypackages__/ 116 | 117 | # Celery stuff 118 | celerybeat-schedule 119 | celerybeat.pid 120 | 121 | # SageMath parsed files 122 | *.sage.py 123 | 124 | # Environments 125 | .env 126 | .venv 127 | env/ 128 | venv/ 129 | ENV/ 130 | env.bak/ 131 | venv.bak/ 132 | 133 | # Spyder project settings 134 | .spyderproject 135 | .spyproject 136 | 137 | # Rope project settings 138 | .ropeproject 139 | 140 | # mkdocs documentation 141 | /site 142 | 143 | # mypy 144 | .mypy_cache/ 145 | .dmypy.json 146 | dmypy.json 147 | 148 | # Pyre type checker 149 | .pyre/ 150 | 151 | # pytype static type analyzer 152 | .pytype/ 153 | 154 | # Cython debug symbols 155 | cython_debug/ 156 | 157 | # PyCharm 158 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 159 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 160 | # and can be added to the global gitignore or merged into this file. For a more nuclear 161 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 162 | #.idea/ 163 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/c-editable/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm-project.org/#use-with-ide 110 | .pdm.toml 111 | .pdm-python 112 | .pdm-build/ 113 | 114 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 115 | __pypackages__/ 116 | 117 | # Celery stuff 118 | celerybeat-schedule 119 | celerybeat.pid 120 | 121 | # SageMath parsed files 122 | *.sage.py 123 | 124 | # Environments 125 | .env 126 | .venv 127 | env/ 128 | venv/ 129 | ENV/ 130 | env.bak/ 131 | venv.bak/ 132 | 133 | # Spyder project settings 134 | .spyderproject 135 | .spyproject 136 | 137 | # Rope project settings 138 | .ropeproject 139 | 140 | # mkdocs documentation 141 | /site 142 | 143 | # mypy 144 | .mypy_cache/ 145 | .dmypy.json 146 | dmypy.json 147 | 148 | # Pyre type checker 149 | .pyre/ 150 | 151 | # pytype static type analyzer 152 | .pytype/ 153 | 154 | # Cython debug symbols 155 | cython_debug/ 156 | 157 | # PyCharm 158 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 159 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 160 | # and can be added to the global gitignore or merged into this file. For a more nuclear 161 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 162 | #.idea/ 163 | -------------------------------------------------------------------------------- /tests/trivial/pdm.lock: -------------------------------------------------------------------------------- 1 | # This file is @generated by PDM. 2 | # It is not intended for manual editing. 3 | 4 | [metadata] 5 | groups = ["default"] 6 | strategy = ["cross_platform"] 7 | lock_version = "4.4" 8 | content_hash = "sha256:41e6c6ef128769b1caabe8698e4987fe6dc4f1d67864e21a62ecfa9d6e96c675" 9 | 10 | [[package]] 11 | name = "certifi" 12 | version = "2023.7.22" 13 | requires_python = ">=3.6" 14 | summary = "Python package for providing Mozilla's CA Bundle." 15 | files = [ 16 | {file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"}, 17 | {file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, 18 | ] 19 | 20 | [[package]] 21 | name = "charset-normalizer" 22 | version = "3.3.2" 23 | requires_python = ">=3.7.0" 24 | summary = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." 25 | files = [ 26 | {file = "charset-normalizer-3.3.2.tar.gz", hash = "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"}, 27 | {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db"}, 28 | {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:573f6eac48f4769d667c4442081b1794f52919e7edada77495aaed9236d13a96"}, 29 | {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:549a3a73da901d5bc3ce8d24e0600d1fa85524c10287f6004fbab87672bf3e1e"}, 30 | {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f27273b60488abe721a075bcca6d7f3964f9f6f067c8c4c605743023d7d3944f"}, 31 | {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ceae2f17a9c33cb48e3263960dc5fc8005351ee19db217e9b1bb15d28c02574"}, 32 | {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:65f6f63034100ead094b8744b3b97965785388f308a64cf8d7c34f2f2e5be0c4"}, 33 | {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8"}, 34 | {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4a78b2b446bd7c934f5dcedc588903fb2f5eec172f3d29e52a9096a43722adfc"}, 35 | {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e537484df0d8f426ce2afb2d0f8e1c3d0b114b83f8850e5f2fbea0e797bd82ae"}, 36 | {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:eb6904c354526e758fda7167b33005998fb68c46fbc10e013ca97f21ca5c8887"}, 37 | {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:deb6be0ac38ece9ba87dea880e438f25ca3eddfac8b002a2ec3d9183a454e8ae"}, 38 | {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:4ab2fe47fae9e0f9dee8c04187ce5d09f48eabe611be8259444906793ab7cbce"}, 39 | {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:80402cd6ee291dcb72644d6eac93785fe2c8b9cb30893c1af5b8fdd753b9d40f"}, 40 | {file = "charset_normalizer-3.3.2-cp311-cp311-win32.whl", hash = "sha256:7cd13a2e3ddeed6913a65e66e94b51d80a041145a026c27e6bb76c31a853c6ab"}, 41 | {file = "charset_normalizer-3.3.2-cp311-cp311-win_amd64.whl", hash = "sha256:663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77"}, 42 | {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:0b2b64d2bb6d3fb9112bafa732def486049e63de9618b5843bcdd081d8144cd8"}, 43 | {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:ddbb2551d7e0102e7252db79ba445cdab71b26640817ab1e3e3648dad515003b"}, 44 | {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6"}, 45 | {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f4a014bc36d3c57402e2977dada34f9c12300af536839dc38c0beab8878f38a"}, 46 | {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a10af20b82360ab00827f916a6058451b723b4e65030c5a18577c8b2de5b3389"}, 47 | {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8d756e44e94489e49571086ef83b2bb8ce311e730092d2c34ca8f7d925cb20aa"}, 48 | {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b"}, 49 | {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6ac7ffc7ad6d040517be39eb591cac5ff87416c2537df6ba3cba3bae290c0fed"}, 50 | {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:7ed9e526742851e8d5cc9e6cf41427dfc6068d4f5a3bb03659444b4cabf6bc26"}, 51 | {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:8bdb58ff7ba23002a4c5808d608e4e6c687175724f54a5dade5fa8c67b604e4d"}, 52 | {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:6b3251890fff30ee142c44144871185dbe13b11bab478a88887a639655be1068"}, 53 | {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:b4a23f61ce87adf89be746c8a8974fe1c823c891d8f86eb218bb957c924bb143"}, 54 | {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:efcb3f6676480691518c177e3b465bcddf57cea040302f9f4e6e191af91174d4"}, 55 | {file = "charset_normalizer-3.3.2-cp312-cp312-win32.whl", hash = "sha256:d965bba47ddeec8cd560687584e88cf699fd28f192ceb452d1d7ee807c5597b7"}, 56 | {file = "charset_normalizer-3.3.2-cp312-cp312-win_amd64.whl", hash = "sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001"}, 57 | {file = "charset_normalizer-3.3.2-py3-none-any.whl", hash = "sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc"}, 58 | ] 59 | 60 | [[package]] 61 | name = "idna" 62 | version = "3.4" 63 | requires_python = ">=3.5" 64 | summary = "Internationalized Domain Names in Applications (IDNA)" 65 | files = [ 66 | {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, 67 | {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, 68 | ] 69 | 70 | [[package]] 71 | name = "requests" 72 | version = "2.31.0" 73 | requires_python = ">=3.7" 74 | summary = "Python HTTP for Humans." 75 | dependencies = [ 76 | "certifi>=2017.4.17", 77 | "charset-normalizer<4,>=2", 78 | "idna<4,>=2.5", 79 | "urllib3<3,>=1.21.1", 80 | ] 81 | files = [ 82 | {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"}, 83 | {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"}, 84 | ] 85 | 86 | [[package]] 87 | name = "urllib3" 88 | version = "2.0.7" 89 | requires_python = ">=3.7" 90 | summary = "HTTP library with thread-safe connection pooling, file post, and more." 91 | files = [ 92 | {file = "urllib3-2.0.7-py3-none-any.whl", hash = "sha256:fdb6d215c776278489906c2f8916e6e7d4f5a9b602ccbcfdf7f016fc8da0596e"}, 93 | {file = "urllib3-2.0.7.tar.gz", hash = "sha256:c97dfde1f7bd43a71c8d2a58e369e9b2bf692d1334ea9f9cae55add7d0dd0f84"}, 94 | ] 95 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "flake-compat": { 4 | "flake": false, 5 | "locked": { 6 | "lastModified": 1696426674, 7 | "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", 8 | "owner": "edolstra", 9 | "repo": "flake-compat", 10 | "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", 11 | "type": "github" 12 | }, 13 | "original": { 14 | "owner": "edolstra", 15 | "repo": "flake-compat", 16 | "type": "github" 17 | } 18 | }, 19 | "flake-parts": { 20 | "inputs": { 21 | "nixpkgs-lib": [ 22 | "nixpkgs" 23 | ] 24 | }, 25 | "locked": { 26 | "lastModified": 1722555600, 27 | "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", 28 | "owner": "hercules-ci", 29 | "repo": "flake-parts", 30 | "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", 31 | "type": "github" 32 | }, 33 | "original": { 34 | "owner": "hercules-ci", 35 | "repo": "flake-parts", 36 | "type": "github" 37 | } 38 | }, 39 | "flake-utils": { 40 | "inputs": { 41 | "systems": "systems" 42 | }, 43 | "locked": { 44 | "lastModified": 1709126324, 45 | "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", 46 | "owner": "numtide", 47 | "repo": "flake-utils", 48 | "rev": "d465f4819400de7c8d874d50b982301f28a84605", 49 | "type": "github" 50 | }, 51 | "original": { 52 | "owner": "numtide", 53 | "repo": "flake-utils", 54 | "type": "github" 55 | } 56 | }, 57 | "mdbook-nixdoc": { 58 | "inputs": { 59 | "nix-github-actions": "nix-github-actions", 60 | "nixpkgs": [ 61 | "nixpkgs" 62 | ] 63 | }, 64 | "locked": { 65 | "lastModified": 1708395692, 66 | "narHash": "sha256-smf0VmxGbjJDZqKvxxG3ZVqubgbVwAWG26wPo+BT/A0=", 67 | "owner": "adisbladis", 68 | "repo": "mdbook-nixdoc", 69 | "rev": "d6a71b114b9221c0b4f20d31b81766d072cc26be", 70 | "type": "github" 71 | }, 72 | "original": { 73 | "owner": "adisbladis", 74 | "repo": "mdbook-nixdoc", 75 | "type": "github" 76 | } 77 | }, 78 | "mdbook-nixdoc_2": { 79 | "inputs": { 80 | "nix-github-actions": [ 81 | "pyproject-nix", 82 | "nix-github-actions" 83 | ], 84 | "nixpkgs": [ 85 | "pyproject-nix", 86 | "nixpkgs" 87 | ] 88 | }, 89 | "locked": { 90 | "lastModified": 1708395692, 91 | "narHash": "sha256-smf0VmxGbjJDZqKvxxG3ZVqubgbVwAWG26wPo+BT/A0=", 92 | "owner": "adisbladis", 93 | "repo": "mdbook-nixdoc", 94 | "rev": "d6a71b114b9221c0b4f20d31b81766d072cc26be", 95 | "type": "github" 96 | }, 97 | "original": { 98 | "owner": "adisbladis", 99 | "repo": "mdbook-nixdoc", 100 | "type": "github" 101 | } 102 | }, 103 | "nix-github-actions": { 104 | "inputs": { 105 | "nixpkgs": [ 106 | "mdbook-nixdoc", 107 | "nixpkgs" 108 | ] 109 | }, 110 | "locked": { 111 | "lastModified": 1703863825, 112 | "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", 113 | "owner": "nix-community", 114 | "repo": "nix-github-actions", 115 | "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", 116 | "type": "github" 117 | }, 118 | "original": { 119 | "owner": "nix-community", 120 | "repo": "nix-github-actions", 121 | "type": "github" 122 | } 123 | }, 124 | "nix-github-actions_2": { 125 | "inputs": { 126 | "nixpkgs": [ 127 | "nixpkgs" 128 | ] 129 | }, 130 | "locked": { 131 | "lastModified": 1720066371, 132 | "narHash": "sha256-uPlLYH2S0ACj0IcgaK9Lsf4spmJoGejR9DotXiXSBZQ=", 133 | "owner": "nix-community", 134 | "repo": "nix-github-actions", 135 | "rev": "622f829f5fe69310a866c8a6cd07e747c44ef820", 136 | "type": "github" 137 | }, 138 | "original": { 139 | "owner": "nix-community", 140 | "repo": "nix-github-actions", 141 | "type": "github" 142 | } 143 | }, 144 | "nix-github-actions_3": { 145 | "inputs": { 146 | "nixpkgs": [ 147 | "pyproject-nix", 148 | "nixpkgs" 149 | ] 150 | }, 151 | "locked": { 152 | "lastModified": 1703863825, 153 | "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", 154 | "owner": "nix-community", 155 | "repo": "nix-github-actions", 156 | "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", 157 | "type": "github" 158 | }, 159 | "original": { 160 | "owner": "nix-community", 161 | "repo": "nix-github-actions", 162 | "type": "github" 163 | } 164 | }, 165 | "nixdoc": { 166 | "inputs": { 167 | "flake-compat": "flake-compat", 168 | "flake-utils": "flake-utils", 169 | "nixpkgs": [ 170 | "nixpkgs" 171 | ] 172 | }, 173 | "locked": { 174 | "lastModified": 1717797326, 175 | "narHash": "sha256-9gBrFudzn75rzx7bTPgr+zzUpX2cLHOmE12xFtoH1eA=", 176 | "owner": "nix-community", 177 | "repo": "nixdoc", 178 | "rev": "37121757bf509829f25b11976defc53b150b1ca8", 179 | "type": "github" 180 | }, 181 | "original": { 182 | "owner": "nix-community", 183 | "repo": "nixdoc", 184 | "type": "github" 185 | } 186 | }, 187 | "nixpkgs": { 188 | "locked": { 189 | "lastModified": 1723175592, 190 | "narHash": "sha256-M0xJ3FbDUc4fRZ84dPGx5VvgFsOzds77KiBMW/mMTnI=", 191 | "owner": "nixos", 192 | "repo": "nixpkgs", 193 | "rev": "5e0ca22929f3342b19569b21b2f3462f053e497b", 194 | "type": "github" 195 | }, 196 | "original": { 197 | "owner": "nixos", 198 | "ref": "nixos-unstable", 199 | "repo": "nixpkgs", 200 | "type": "github" 201 | } 202 | }, 203 | "pyproject-nix": { 204 | "inputs": { 205 | "mdbook-nixdoc": "mdbook-nixdoc_2", 206 | "nix-github-actions": "nix-github-actions_3", 207 | "nixpkgs": [ 208 | "nixpkgs" 209 | ] 210 | }, 211 | "locked": { 212 | "lastModified": 1721039766, 213 | "narHash": "sha256-8H5z3bAOP5ukdXxSAisg6A1pdOJO2RwuJTsGTS3kpbk=", 214 | "owner": "adisbladis", 215 | "repo": "pyproject.nix", 216 | "rev": "8783458df981ba04aa75fad5fc169fb906b1bc50", 217 | "type": "github" 218 | }, 219 | "original": { 220 | "owner": "adisbladis", 221 | "repo": "pyproject.nix", 222 | "type": "github" 223 | } 224 | }, 225 | "root": { 226 | "inputs": { 227 | "flake-parts": "flake-parts", 228 | "mdbook-nixdoc": "mdbook-nixdoc", 229 | "nix-github-actions": "nix-github-actions_2", 230 | "nixdoc": "nixdoc", 231 | "nixpkgs": "nixpkgs", 232 | "pyproject-nix": "pyproject-nix", 233 | "treefmt-nix": "treefmt-nix" 234 | } 235 | }, 236 | "systems": { 237 | "locked": { 238 | "lastModified": 1681028828, 239 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 240 | "owner": "nix-systems", 241 | "repo": "default", 242 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 243 | "type": "github" 244 | }, 245 | "original": { 246 | "owner": "nix-systems", 247 | "repo": "default", 248 | "type": "github" 249 | } 250 | }, 251 | "treefmt-nix": { 252 | "inputs": { 253 | "nixpkgs": [ 254 | "nixpkgs" 255 | ] 256 | }, 257 | "locked": { 258 | "lastModified": 1722330636, 259 | "narHash": "sha256-uru7JzOa33YlSRwf9sfXpJG+UAV+bnBEYMjrzKrQZFw=", 260 | "owner": "numtide", 261 | "repo": "treefmt-nix", 262 | "rev": "768acdb06968e53aa1ee8de207fd955335c754b7", 263 | "type": "github" 264 | }, 265 | "original": { 266 | "owner": "numtide", 267 | "repo": "treefmt-nix", 268 | "type": "github" 269 | } 270 | } 271 | }, 272 | "root": "root", 273 | "version": 7 274 | } 275 | -------------------------------------------------------------------------------- /lib/fixtures/kitchen-sink/a/pdm.lock: -------------------------------------------------------------------------------- 1 | # This file is @generated by PDM. 2 | # It is not intended for manual editing. 3 | 4 | [metadata] 5 | groups = ["default", "dev"] 6 | strategy = ["cross_platform"] 7 | lock_version = "4.4" 8 | content_hash = "sha256:6f98b9ae565ba8ba1ad8da564962f7cc3bb24b59a5999e137693f0a706d5c89e" 9 | 10 | [[package]] 11 | name = "arpeggio" 12 | version = "2.0.2" 13 | url = "https://files.pythonhosted.org/packages/f7/4f/d28bf30a19d4649b40b501d531b44e73afada99044df100380fd9567e92f/Arpeggio-2.0.2-py2.py3-none-any.whl" 14 | summary = "Packrat parser interpreter" 15 | files = [ 16 | {file = "Arpeggio-2.0.2-py2.py3-none-any.whl", hash = "sha256:f7c8ae4f4056a89e020c24c7202ac8df3e2bc84e416746f20b0da35bb1de0250"}, 17 | ] 18 | 19 | [[package]] 20 | name = "attrs" 21 | version = "23.1.0" 22 | requires_python = ">=3.7" 23 | path = "../attrs-23.1.0.tar.gz" 24 | summary = "Classes Without Boilerplate" 25 | files = [ 26 | {file = "attrs-23.1.0.tar.gz", hash = "sha256:6279836d581513a26f1bf235f9acd333bc9115683f14f7e8fae46c98fc50e015"}, 27 | ] 28 | 29 | [[package]] 30 | name = "b" 31 | version = "0.1.0" 32 | requires_python = ">=3.11" 33 | path = "../b" 34 | summary = "Dummy project depended on by a" 35 | dependencies = [ 36 | "certifi", 37 | ] 38 | 39 | [[package]] 40 | name = "blinker" 41 | version = "1.6.2" 42 | requires_python = ">=3.7" 43 | url = "https://files.pythonhosted.org/packages/e8/f9/a05287f3d5c54d20f51a235ace01f50620984bc7ca5ceee781dc645211c5/blinker-1.6.2.tar.gz" 44 | summary = "Fast, simple object-to-object and broadcast signaling" 45 | files = [ 46 | {file = "blinker-1.6.2.tar.gz", hash = "sha256:4afd3de66ef3a9f8067559fb7a1cbe555c17dcbe15971b05d1b625c3e7abe213"}, 47 | ] 48 | 49 | [[package]] 50 | name = "c" 51 | version = "0.1.0" 52 | requires_python = ">=3.11" 53 | editable = true 54 | path = "../c-editable" 55 | summary = "Dummy project depended on in editable mode by a" 56 | 57 | [[package]] 58 | name = "certifi" 59 | version = "2023.7.22" 60 | requires_python = ">=3.6" 61 | summary = "Python package for providing Mozilla's CA Bundle." 62 | files = [ 63 | {file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"}, 64 | {file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, 65 | ] 66 | 67 | [[package]] 68 | name = "charset-normalizer" 69 | version = "3.3.2" 70 | requires_python = ">=3.7.0" 71 | summary = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." 72 | files = [ 73 | {file = "charset-normalizer-3.3.2.tar.gz", hash = "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"}, 74 | {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db"}, 75 | {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:573f6eac48f4769d667c4442081b1794f52919e7edada77495aaed9236d13a96"}, 76 | {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:549a3a73da901d5bc3ce8d24e0600d1fa85524c10287f6004fbab87672bf3e1e"}, 77 | {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f27273b60488abe721a075bcca6d7f3964f9f6f067c8c4c605743023d7d3944f"}, 78 | {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ceae2f17a9c33cb48e3263960dc5fc8005351ee19db217e9b1bb15d28c02574"}, 79 | {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:65f6f63034100ead094b8744b3b97965785388f308a64cf8d7c34f2f2e5be0c4"}, 80 | {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8"}, 81 | {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4a78b2b446bd7c934f5dcedc588903fb2f5eec172f3d29e52a9096a43722adfc"}, 82 | {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e537484df0d8f426ce2afb2d0f8e1c3d0b114b83f8850e5f2fbea0e797bd82ae"}, 83 | {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:eb6904c354526e758fda7167b33005998fb68c46fbc10e013ca97f21ca5c8887"}, 84 | {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:deb6be0ac38ece9ba87dea880e438f25ca3eddfac8b002a2ec3d9183a454e8ae"}, 85 | {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:4ab2fe47fae9e0f9dee8c04187ce5d09f48eabe611be8259444906793ab7cbce"}, 86 | {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:80402cd6ee291dcb72644d6eac93785fe2c8b9cb30893c1af5b8fdd753b9d40f"}, 87 | {file = "charset_normalizer-3.3.2-cp311-cp311-win32.whl", hash = "sha256:7cd13a2e3ddeed6913a65e66e94b51d80a041145a026c27e6bb76c31a853c6ab"}, 88 | {file = "charset_normalizer-3.3.2-cp311-cp311-win_amd64.whl", hash = "sha256:663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77"}, 89 | {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:0b2b64d2bb6d3fb9112bafa732def486049e63de9618b5843bcdd081d8144cd8"}, 90 | {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:ddbb2551d7e0102e7252db79ba445cdab71b26640817ab1e3e3648dad515003b"}, 91 | {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6"}, 92 | {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f4a014bc36d3c57402e2977dada34f9c12300af536839dc38c0beab8878f38a"}, 93 | {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a10af20b82360ab00827f916a6058451b723b4e65030c5a18577c8b2de5b3389"}, 94 | {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8d756e44e94489e49571086ef83b2bb8ce311e730092d2c34ca8f7d925cb20aa"}, 95 | {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b"}, 96 | {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6ac7ffc7ad6d040517be39eb591cac5ff87416c2537df6ba3cba3bae290c0fed"}, 97 | {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:7ed9e526742851e8d5cc9e6cf41427dfc6068d4f5a3bb03659444b4cabf6bc26"}, 98 | {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:8bdb58ff7ba23002a4c5808d608e4e6c687175724f54a5dade5fa8c67b604e4d"}, 99 | {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:6b3251890fff30ee142c44144871185dbe13b11bab478a88887a639655be1068"}, 100 | {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:b4a23f61ce87adf89be746c8a8974fe1c823c891d8f86eb218bb957c924bb143"}, 101 | {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:efcb3f6676480691518c177e3b465bcddf57cea040302f9f4e6e191af91174d4"}, 102 | {file = "charset_normalizer-3.3.2-cp312-cp312-win32.whl", hash = "sha256:d965bba47ddeec8cd560687584e88cf699fd28f192ceb452d1d7ee807c5597b7"}, 103 | {file = "charset_normalizer-3.3.2-cp312-cp312-win_amd64.whl", hash = "sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001"}, 104 | {file = "charset_normalizer-3.3.2-py3-none-any.whl", hash = "sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc"}, 105 | ] 106 | 107 | [[package]] 108 | name = "idna" 109 | version = "3.4" 110 | requires_python = ">=3.5" 111 | summary = "Internationalized Domain Names in Applications (IDNA)" 112 | files = [ 113 | {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, 114 | {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, 115 | ] 116 | 117 | [[package]] 118 | name = "pip" 119 | version = "20.3.1" 120 | requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" 121 | git = "https://github.com/pypa/pip.git" 122 | ref = "20.3.1" 123 | revision = "f94a429e17b450ac2d3432f46492416ac2cf58ad" 124 | summary = "The PyPA recommended tool for installing Python packages." 125 | 126 | [[package]] 127 | name = "pyasn1-modules" 128 | version = "0.0.0" 129 | url = "https://files.pythonhosted.org/packages/0b/67/c53ba0c386e1eaa3a9aa7937356d845fa7b22df0b6f9e54122fca594f6cd/pyasn1_modules-0.2.8-py3.7.egg" 130 | summary = "" 131 | files = [ 132 | {file = "pyasn1_modules-0.2.8-py3.7.egg", hash = "sha256:c29a5e5cc7a3f05926aff34e097e84f8589cd790ce0ed41b67aed6857b26aafd"}, 133 | ] 134 | 135 | [[package]] 136 | name = "requests" 137 | version = "2.31.0" 138 | requires_python = ">=3.7" 139 | summary = "Python HTTP for Humans." 140 | dependencies = [ 141 | "certifi>=2017.4.17", 142 | "charset-normalizer<4,>=2", 143 | "idna<4,>=2.5", 144 | "urllib3<3,>=1.21.1", 145 | ] 146 | files = [ 147 | {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"}, 148 | {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"}, 149 | ] 150 | 151 | [[package]] 152 | name = "resolvelib" 153 | version = "1.0.1" 154 | summary = "Resolve abstract dependencies into concrete ones" 155 | files = [ 156 | {file = "resolvelib-1.0.1-py2.py3-none-any.whl", hash = "sha256:d2da45d1a8dfee81bdd591647783e340ef3bcb104b54c383f70d422ef5cc7dbf"}, 157 | {file = "resolvelib-1.0.1.tar.gz", hash = "sha256:04ce76cbd63fded2078ce224785da6ecd42b9564b1390793f64ddecbe997b309"}, 158 | ] 159 | 160 | [[package]] 161 | name = "ruamel-yaml-clib" 162 | version = "0.2.8" 163 | requires_python = ">=3.6" 164 | hg = "http://hg.code.sf.net/p/ruamel-yaml-clib/code" 165 | revision = "44" 166 | summary = "C version of reader, parser and emitter for ruamel.yaml derived from libyaml" 167 | 168 | [[package]] 169 | name = "urllib3" 170 | version = "2.0.7" 171 | requires_python = ">=3.7" 172 | summary = "HTTP library with thread-safe connection pooling, file post, and more." 173 | files = [ 174 | {file = "urllib3-2.0.7-py3-none-any.whl", hash = "sha256:fdb6d215c776278489906c2f8916e6e7d4f5a9b602ccbcfdf7f016fc8da0596e"}, 175 | {file = "urllib3-2.0.7.tar.gz", hash = "sha256:c97dfde1f7bd43a71c8d2a58e369e9b2bf692d1334ea9f9cae55add7d0dd0f84"}, 176 | ] 177 | -------------------------------------------------------------------------------- /lib/test_lock.nix: -------------------------------------------------------------------------------- 1 | { lock 2 | , pkgs 3 | , lib 4 | , pyproject-nix 5 | , ... 6 | }: { 7 | inherit (builtins) removeAttrs; 8 | 9 | mkOverlay = { 10 | testWrongMetadataVersion = { 11 | expr = lock.mkOverlay { 12 | preferWheels = false; 13 | project = { 14 | pdmLock = { 15 | metadata = { 16 | lock_version = "3.0"; 17 | }; 18 | }; 19 | pyproject = { }; 20 | }; 21 | }; 22 | expectedError.type = "AssertionError"; 23 | }; 24 | 25 | testTrivial = { 26 | expr = 27 | let 28 | overlay = lock.mkOverlay { 29 | project = pyproject-nix.lib.project.loadPDMPyproject { projectRoot = ./fixtures/trivial; }; 30 | preferWheels = false; 31 | }; 32 | 33 | python = pkgs.python311.override { 34 | self = python; 35 | packageOverrides = overlay; 36 | }; 37 | 38 | in 39 | rec { 40 | names = lib.attrNames (overlay python.pkgs python.pkgs); 41 | pkgs = map 42 | (attr: 43 | let 44 | drv = python.pkgs.${attr}; 45 | in 46 | { 47 | inherit (drv) pname version; 48 | }) 49 | (lib.filter (name: name != "__pdm2nix") names); 50 | }; 51 | expected = { 52 | names = [ "__pdm2nix" "arpeggio" ]; 53 | pkgs = [ 54 | { pname = "arpeggio"; version = "2.0.2"; } 55 | ]; 56 | }; 57 | }; 58 | 59 | testWithMarker = { 60 | # Colorama is only available for win32 according to it's marker. 61 | # Ensure that a package is skipped when it's marker indicates it shouldn't be available for a platform. 62 | expr = 63 | let 64 | overlay = lock.mkOverlay { 65 | project = pyproject-nix.lib.project.loadPDMPyproject { projectRoot = ./fixtures/with-marker; }; 66 | preferWheels = false; 67 | }; 68 | 69 | python = pkgs.python311.override { 70 | self = python; 71 | packageOverrides = lib.composeExtensions 72 | (_final: _prev: { 73 | colorama = null; 74 | }) 75 | overlay; 76 | }; 77 | 78 | in 79 | python.pkgs.colorama; 80 | expectedError.type = "ThrownError"; 81 | expectedError.msg = "not supported for interpreter"; 82 | }; 83 | 84 | testKitchenSink = { 85 | expr = 86 | let 87 | overlay = lock.mkOverlay { 88 | project = pyproject-nix.lib.project.loadPDMPyproject { projectRoot = ./fixtures/kitchen-sink/a; }; 89 | preferWheels = false; 90 | }; 91 | 92 | python = pkgs.python311.override { 93 | self = python; 94 | packageOverrides = lib.composeExtensions overlay (_final: _prev: { 95 | # error: in pure evaluation mode, 'fetchMercurial' requires a Mercurial revision 96 | ruamel-yaml-clib = { 97 | pname = "ruamel-yaml-clib"; 98 | version = "0.1.0"; 99 | }; 100 | }); 101 | }; 102 | 103 | in 104 | rec { 105 | names = lib.attrNames (overlay python.pkgs python.pkgs); 106 | pkgs = map 107 | (attr: 108 | let 109 | drv = python.pkgs.${attr}; 110 | in 111 | { 112 | inherit (drv) pname version; 113 | }) 114 | (lib.filter (name: name != "__pdm2nix") names); 115 | }; 116 | expected = { 117 | names = [ "__pdm2nix" "arpeggio" "attrs" "b" "blinker" "c" "certifi" "charset-normalizer" "idna" "pip" "pyasn1-modules" "requests" "resolvelib" "ruamel-yaml-clib" "urllib3" ]; 118 | pkgs = [ 119 | { pname = "arpeggio"; version = "2.0.2"; } 120 | { pname = "attrs"; version = "23.1.0"; } 121 | { pname = "b"; version = "0.1.0"; } 122 | { pname = "blinker"; version = "1.6.2"; } 123 | { pname = "c"; version = "0.1.0"; } 124 | { pname = "certifi"; version = "2023.7.22"; } 125 | { pname = "charset-normalizer"; version = "3.3.2"; } 126 | { pname = "idna"; version = "3.4"; } 127 | { pname = "pip"; version = "20.3.1"; } 128 | { pname = "pyasn1-modules"; version = "0.0.0"; } 129 | { pname = "requests"; version = "2.31.0"; } 130 | { pname = "resolvelib"; version = "1.0.1"; } 131 | { pname = "ruamel-yaml-clib"; version = "0.1.0"; } 132 | { pname = "urllib3"; version = "2.0.7"; } 133 | ]; 134 | }; 135 | }; 136 | 137 | testKitchenSinkPreferWheels = { 138 | expr = 139 | let 140 | overlay = lock.mkOverlay { 141 | project = pyproject-nix.lib.project.loadPDMPyproject { projectRoot = ./fixtures/kitchen-sink/a; }; 142 | preferWheels = true; 143 | }; 144 | 145 | python = pkgs.python311.override { 146 | self = python; 147 | packageOverrides = lib.composeExtensions overlay (_final: _prev: { 148 | # error: in pure evaluation mode, 'fetchMercurial' requires a Mercurial revision 149 | ruamel-yaml-clib = { 150 | pname = "ruamel-yaml-clib"; 151 | version = "0.1.0"; 152 | }; 153 | }); 154 | }; 155 | 156 | in 157 | { 158 | isCorrectFile = lib.hasSuffix "Arpeggio-2.0.2-py2.py3-none-any.whl" "${python.pkgs.arpeggio.src}"; 159 | }; 160 | expected = { 161 | isCorrectFile = true; 162 | }; 163 | }; 164 | }; 165 | 166 | mkPackage = 167 | let 168 | project = { 169 | pyproject = { }; 170 | }; # Dummy empty project for tests 171 | 172 | callPackage = pkg: 173 | let 174 | py = pkgs.python311; 175 | 176 | drv = py.pkgs.callPackage pkg { 177 | buildPythonPackage = x: x; # No-op to return attrs 178 | 179 | __pdm2nix = { 180 | fetchPDMPackage = py.pkgs.callPackage lock.fetchPDMPackage { }; 181 | environ = pyproject-nix.lib.pep508.mkEnviron py; 182 | pyVersion = pyproject-nix.lib.pep440.parseVersion py.version; 183 | }; 184 | }; 185 | 186 | # Remove stuff we can't assert equality for easily 187 | cleaned = removeAttrs drv [ "override" "overrideDerivation" ]; 188 | in 189 | cleaned 190 | // { 191 | # Just extract names of dependencies for equality checking 192 | propagatedBuildInputs = map (drv: drv.pname) cleaned.propagatedBuildInputs; 193 | 194 | # Only get URLs from src 195 | src = drv.src.passthru; 196 | }; 197 | in 198 | { 199 | testSimple = { 200 | expr = callPackage (lock.mkPackage { inherit project; } { 201 | files = [ 202 | { 203 | file = "Arpeggio-2.0.0-py2.py3-none-any.whl"; 204 | hash = "sha256:448e332deb0e9ccd04046f1c6c14529d197f41bc2fdb3931e43fc209042fbdd3"; 205 | } 206 | { 207 | file = "Arpeggio-2.0.0.tar.gz"; 208 | hash = "sha256:d6b03839019bb8a68785f9292ee6a36b1954eb84b925b84a6b8a5e1e26d3ed3d"; 209 | } 210 | ]; 211 | name = "arpeggio"; 212 | summary = "Packrat parser interpreter"; 213 | version = "2.0.0"; 214 | }); 215 | expected = { 216 | doCheck = false; 217 | format = "pyproject"; 218 | meta = { 219 | description = "Packrat parser interpreter"; 220 | }; 221 | pname = "arpeggio"; 222 | propagatedBuildInputs = [ ]; 223 | version = "2.0.0"; 224 | src = { }; 225 | }; 226 | }; 227 | 228 | testWithDependencies = { 229 | expr = callPackage (lock.mkPackage { inherit project; } { 230 | dependencies = [ 231 | "python-dateutil>=2.7.0" 232 | "typing-extensions; python_version < \"3.8\"" 233 | ]; 234 | files = [ 235 | { 236 | file = "arrow-1.2.3-py3-none-any.whl"; 237 | hash = "sha256:5a49ab92e3b7b71d96cd6bfcc4df14efefc9dfa96ea19045815914a6ab6b1fe2"; 238 | } 239 | { 240 | file = "arrow-1.2.3.tar.gz"; 241 | hash = "sha256:3934b30ca1b9f292376d9db15b19446088d12ec58629bc3f0da28fd55fb633a1"; 242 | } 243 | ]; 244 | name = "arrow"; 245 | requires_python = ">=3.6"; 246 | summary = "Better dates & times for Python"; 247 | version = "1.2.3"; 248 | }); 249 | expected = { 250 | doCheck = false; 251 | format = "pyproject"; 252 | meta = { 253 | description = "Better dates & times for Python"; 254 | }; 255 | pname = "arrow"; 256 | propagatedBuildInputs = [ "python-dateutil" ]; 257 | version = "1.2.3"; 258 | src = { }; 259 | }; 260 | }; 261 | 262 | testWithDependenciesOptionals = { 263 | expr = callPackage (lock.mkPackage { inherit project; } { 264 | dependencies = [ 265 | "cachecontrol[filecache]" 266 | ]; 267 | files = [ 268 | { 269 | file = "arrow-1.2.3.tar.gz"; 270 | hash = "sha256:3934b30ca1b9f292376d9db15b19446088d12ec58629bc3f0da28fd55fb633a1"; 271 | } 272 | ]; 273 | name = "dummy"; 274 | requires_python = ">=3.6"; 275 | summary = "Dummy test package"; 276 | version = "1.2.3"; 277 | }); 278 | expected = { 279 | doCheck = false; 280 | format = "pyproject"; 281 | meta = { 282 | description = "Dummy test package"; 283 | }; 284 | pname = "dummy"; 285 | propagatedBuildInputs = [ "cachecontrol" "filelock" ]; 286 | version = "1.2.3"; 287 | src = { }; 288 | }; 289 | }; 290 | }; 291 | 292 | partitionFiles = { 293 | testSimple = { 294 | expr = lock.partitionFiles (builtins.head (lib.importTOML ./fixtures/trivial/pdm.lock).package).files; 295 | expected = { 296 | eggs = [ ]; 297 | others = [ ]; 298 | sdists = [ 299 | { 300 | file = "Arpeggio-2.0.2.tar.gz"; 301 | hash = "sha256:c790b2b06e226d2dd468e4fbfb5b7f506cec66416031fde1441cf1de2a0ba700"; 302 | } 303 | ]; 304 | wheels = [ 305 | { 306 | file = "Arpeggio-2.0.2-py2.py3-none-any.whl"; 307 | hash = "sha256:f7c8ae4f4056a89e020c24c7202ac8df3e2bc84e416746f20b0da35bb1de0250"; 308 | } 309 | ]; 310 | }; 311 | }; 312 | }; 313 | 314 | fetchPDMPackage = 315 | let 316 | pyproject = lib.importTOML ./fixtures/kitchen-sink/a/pyproject.toml; 317 | pdmLock = lib.importTOML ./fixtures/kitchen-sink/a/pdm.lock; 318 | projectRoot = ./fixtures/kitchen-sink/a; 319 | fetchPDMPackage = pkgs.callPackage lock.fetchPDMPackage { }; 320 | findPackage = name: lib.findFirst (pkg: pkg.name == name) (throw "package '${name} not found") pdmLock.package; 321 | in 322 | { 323 | testFetchFromLegacy = { 324 | expr = 325 | let 326 | src = (fetchPDMPackage { 327 | inherit pyproject projectRoot; 328 | package = findPackage "requests"; 329 | filename = "requests-2.31.0.tar.gz"; 330 | }).passthru; 331 | in 332 | src; 333 | expected = { }; 334 | }; 335 | 336 | testURL = { 337 | expr = (fetchPDMPackage { 338 | inherit pyproject projectRoot; 339 | package = findPackage "arpeggio"; 340 | filename = "Arpeggio-2.0.2-py2.py3-none-any.whl"; 341 | }).passthru; 342 | expected = { 343 | url = "https://files.pythonhosted.org/packages/f7/4f/d28bf30a19d4649b40b501d531b44e73afada99044df100380fd9567e92f/Arpeggio-2.0.2-py2.py3-none-any.whl"; 344 | }; 345 | }; 346 | 347 | testMercurial = { 348 | expr = fetchPDMPackage { 349 | inherit pyproject projectRoot; 350 | package = findPackage "ruamel-yaml-clib"; 351 | }; 352 | expectedError.type = "Error"; 353 | expectedError.msg = "requires a Mercurial revision"; 354 | }; 355 | 356 | testGit = { 357 | expr = 358 | let 359 | src = fetchPDMPackage { 360 | inherit pyproject projectRoot; 361 | package = findPackage "pip"; 362 | }; 363 | in 364 | assert lib.hasAttr "outPath" src; 365 | { inherit (src) ref allRefs submodules rev; }; 366 | expected = { 367 | allRefs = true; 368 | ref = "refs/tags/20.3.1"; 369 | rev = "f94a429e17b450ac2d3432f46492416ac2cf58ad"; 370 | submodules = true; 371 | }; 372 | }; 373 | 374 | testPathSdist = { 375 | expr = 376 | let 377 | src = fetchPDMPackage { 378 | inherit pyproject projectRoot; 379 | package = findPackage "attrs"; 380 | filename = "attrs-23.1.0.tar.gz"; 381 | }; 382 | in 383 | { 384 | isStorePath = lib.isStorePath "${src}"; 385 | hasSuffix = lib.hasSuffix "attrs-23.1.0.tar.gz" "${src}"; 386 | }; 387 | expected = { 388 | isStorePath = true; 389 | hasSuffix = true; 390 | }; 391 | }; 392 | }; 393 | } 394 | -------------------------------------------------------------------------------- /lib/lock.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , pyproject-nix 3 | , editable 4 | , ... 5 | }: 6 | 7 | lib.fix (self: 8 | let 9 | inherit (builtins) hasAttr splitVersion head filter length nixVersion baseNameOf match pathExists; 10 | inherit (pyproject-nix.lib) pep508 pypa; 11 | inherit (lib) flatten filterAttrs attrValues optionalAttrs listToAttrs nameValuePair versionAtLeast; 12 | 13 | # Select the best compatible wheel from a list of wheels 14 | selectWheels = wheels: python: 15 | let 16 | # Filter wheels based on interpreter 17 | compatibleWheels = pypa.selectWheels python.stdenv.targetPlatform python (map (fileEntry: pypa.parseWheelFileName fileEntry.file) wheels); 18 | in 19 | map (wheel: wheel.filename) compatibleWheels; 20 | 21 | # Select the best compatible egg from a list of eggs 22 | selectEggs = eggs: python: map (egg: egg.filename) (pyproject-nix.lib.eggs.selectEggs python (map (egg: pyproject-nix.lib.eggs.parseEggFileName egg.file) eggs)); 23 | 24 | # Take the first element of a list, return null for empty 25 | 26 | # Match str against a glob pattern 27 | matchGlob = 28 | let 29 | # Make regex from glob pattern 30 | mkRe = builtins.replaceStrings [ "*" ] [ ".*" ]; 31 | in 32 | str: glob: match (mkRe glob) str != null; 33 | 34 | # Make the internal __pdm2nix overlay attribute. 35 | # This is used in the overlay to create PEP-508 environments & fetchers that don't need to be instantiated for every package. 36 | mkPdm2Nix = { python, callPackage, environ ? pep508.mkEnviron python }: { 37 | inherit environ; 38 | fetchPDMPackage = python.pkgs.callPackage self.fetchPDMPackage { }; 39 | # TODO: Drop mkEditablePackage, it doesn't belong in pdm2nix. 40 | mkEditablePackage = callPackage editable.mkEditablePackage { }; 41 | pyVersion = pyproject-nix.lib.pep440.parseVersion python.version; 42 | }; 43 | 44 | optionalHead = list: if length list > 0 then head list else null; 45 | 46 | in 47 | { 48 | /* 49 | Create package overlay from pdm.lock 50 | */ 51 | mkOverlay = 52 | { 53 | # PDM project from pyproject.lib.project loadPDMPyproject 54 | project 55 | , # Whether to prefer prebuilt binary wheels over sdists 56 | preferWheels 57 | , 58 | }: 59 | let 60 | inherit (project.pdmLock) metadata; 61 | lockMajor = head (splitVersion metadata.lock_version); 62 | in 63 | assert project.pdmLock != null; 64 | assert lockMajor == "4"; 65 | lib.composeExtensions 66 | (final: _prev: { 67 | __pdm2nix = final.callPackage mkPdm2Nix { }; 68 | }) 69 | (final: _prev: 70 | lib.listToAttrs ( 71 | map 72 | (package: lib.nameValuePair package.name ( 73 | # Route package depending on source: 74 | # - If a package is from pyproject.toml import it and call it directly 75 | # - If a package is a nested pyproject load it 76 | # - Otherwise generate purely from pdm.lock metadata 77 | let 78 | isEditable = hasAttr "editable" package; 79 | isPath = hasAttr "path" package; 80 | path = project.projectRoot + "/${package.path}"; 81 | 82 | defaultNix = path + "/default.nix"; 83 | hasNix = isPath && pathExists defaultNix; 84 | 85 | hasPyproject = isPath && pathExists "${path}/pyproject.toml"; 86 | 87 | in 88 | if isEditable then 89 | ( 90 | final.__pdm2nix.mkEditablePackage { 91 | pname = package.name; 92 | inherit (package) version; 93 | inherit path; 94 | } 95 | ) 96 | 97 | # If a package is from a local default.nix, callPackage the path directly 98 | else if hasNix then final.callPackage defaultNix { } 99 | 100 | # Import nested pyproject.toml 101 | else if hasPyproject then 102 | ( 103 | final.callPackage 104 | ({ buildPythonPackage, python }: buildPythonPackage ( 105 | (pyproject-nix.lib.project.loadPyprojectDynamic { 106 | projectRoot = path; 107 | }).renderers.buildPythonPackage 108 | { inherit python; } // { 109 | inherit (package) version; 110 | } 111 | )) 112 | { } 113 | ) 114 | 115 | # Package is from pdm.lock 116 | else (final.callPackage (self.mkPackage { inherit project preferWheels; } package) { }) 117 | )) 118 | project.pdmLock.package 119 | )); 120 | 121 | partitionFiles = 122 | # List of files from poetry.lock -> package segment 123 | files: 124 | let 125 | wheels = lib.lists.partition (f: pypa.isWheelFileName f.file) files; 126 | sdists = lib.lists.partition (f: pypa.isSdistFileName f.file) wheels.wrong; 127 | eggs = lib.lists.partition (f: pyproject-nix.lib.eggs.isEggFileName f.file) sdists.wrong; 128 | in 129 | { 130 | sdists = sdists.right; 131 | wheels = wheels.right; 132 | eggs = eggs.right; 133 | others = eggs.wrong; 134 | }; 135 | 136 | /* 137 | Fetch a package from pdm.lock 138 | */ 139 | fetchPDMPackage = 140 | { fetchPypiLegacy 141 | , fetchurl 142 | }: { 143 | # The specific package segment from pdm.lock 144 | package 145 | , # Project root path used for local file/directory sources 146 | projectRoot 147 | , # Filename for which to invoke fetcher 148 | filename ? throw "Missing argument filename" 149 | , # Parsed pyproject.toml contents 150 | pyproject 151 | }: 152 | let 153 | # Group list of files by their filename into an attrset 154 | filesByFileName = listToAttrs (map (file: nameValuePair file.file file) package.files); 155 | file = filesByFileName.${filename} or (throw "Filename '${filename}' not present in package"); 156 | 157 | in 158 | if hasAttr "git" package then 159 | ( 160 | builtins.fetchGit 161 | { 162 | url = package.git; 163 | rev = package.revision; 164 | } 165 | // optionalAttrs (hasAttr "ref" package) { 166 | ref = "refs/tags/${package.ref}"; 167 | } 168 | // optionalAttrs (versionAtLeast nixVersion "2.4") { 169 | allRefs = true; 170 | submodules = true; 171 | } 172 | ) 173 | else if hasAttr "hg" package then 174 | ( 175 | builtins.fetchMercurial 176 | { 177 | url = package.hg; 178 | rev = package.revision; 179 | } 180 | ) 181 | else if hasAttr "url" package then 182 | ( 183 | fetchurl { 184 | url = assert (baseNameOf package.url) == filename; package.url; 185 | inherit (file) hash; 186 | } 187 | ) 188 | else if hasAttr "path" package then 189 | { 190 | outPath = projectRoot + "/${package.path}"; 191 | } 192 | else 193 | ( 194 | # Fetch from Pypi, either the public instance or a private one. 195 | let 196 | sources' = pyproject.tool.pdm.source or [ ]; 197 | 198 | # Source from pyproject.toml keyed by their name 199 | sources = { 200 | # Default Pypi mirror as per https://pdm-project.org/latest/usage/config/. 201 | # If you want to omit the default PyPI index, just set the source name to pypi and that source will replace it. 202 | pypi = { 203 | url = "https://pypi.org/simple"; 204 | }; 205 | } // listToAttrs (map (source: nameValuePair source.name source) sources'); 206 | 207 | # Filter only PyPi mirrors matching this package 208 | activeSources = filter 209 | ( 210 | source: ( 211 | (! hasAttr "include_packages" source || lib.any (matchGlob package.name) source.include_packages) 212 | && 213 | (! hasAttr "exclude_packages" source || lib.all (glob: ! (matchGlob package.name) glob) source.exclude_packages) 214 | ) 215 | ) 216 | (attrValues sources); 217 | 218 | in 219 | if sources' == [ ] then 220 | (fetchPypiLegacy { 221 | pname = package.name; 222 | inherit (file) file hash; 223 | url = "https://pypi.org/simple"; 224 | }) 225 | else 226 | (fetchPypiLegacy { 227 | urls = map (source: source.url) activeSources; 228 | pname = package.name; 229 | inherit (file) file hash; 230 | }) 231 | ); 232 | 233 | mkPackage = 234 | { 235 | # Project as returned by pyproject.lib.project.loadPDMPyProject 236 | project 237 | , # Whether to prefer prebuilt binary wheels over sdists 238 | preferWheels ? false 239 | , 240 | }: 241 | # Package segment 242 | { 243 | # Package name string 244 | name 245 | , # Version string 246 | version 247 | , # Summary (description) 248 | summary 249 | , # Python interpreter PEP-440 constraints # List of PEP-508 strings 250 | dependencies ? [ ] 251 | , # List of attrset with files 252 | files ? [ ] 253 | , # URL string 254 | url ? null # deadnix: skip 255 | , # Path string 256 | path ? null # deadnix: skip 257 | , # Git ref 258 | ref ? null # deadnix: skip 259 | , # VCS revision 260 | revision ? null # deadnix: skip 261 | , # Git URL 262 | git ? null # deadnix: skip 263 | , # Mercurial URL 264 | hg ? null # deadnix: skip 265 | , # Editable path 266 | editable ? false # deadnix: skip 267 | , # Python constraint 268 | requires_python ? "" # deadnix: skip 269 | , # Groups 270 | groups ? [ ] # deadnix: skip 271 | , # PEP-508 marker 272 | marker ? "" # deadnix: skip 273 | }@package: ( 274 | let 275 | inherit (self.partitionFiles files) wheels sdists eggs others; 276 | requiresPython = pyproject-nix.lib.pep440.parseVersionConds package.requires_python; 277 | 278 | in 279 | { python 280 | , pythonPackages 281 | , buildPythonPackage 282 | , autoPatchelfHook 283 | , wheelUnpackHook 284 | , pypaInstallHook 285 | , pythonManylinuxPackages 286 | , stdenv 287 | , __pdm2nix 288 | , # Whether to prefer prebuilt binary wheels over sdists 289 | preferWheel ? preferWheels 290 | }: 291 | let 292 | # Select filename based on preference order. 293 | # By default we prefer sdists, but can optionally prefer to order wheels first. 294 | filenames = 295 | let 296 | selectedWheels = selectWheels wheels python; 297 | selectedSdists = map (file: file.file) sdists; 298 | in 299 | ( 300 | if preferWheel then selectedWheels ++ selectedSdists 301 | else selectedSdists ++ selectedWheels 302 | ) ++ selectEggs eggs python ++ map (file: file.file) others; 303 | 304 | filename = optionalHead filenames; 305 | 306 | format = 307 | if filename == null || pypa.isSdistFileName filename then "pyproject" 308 | else if pypa.isWheelFileName filename then "wheel" 309 | else if pyproject-nix.lib.eggs.isEggFileName filename then "egg" 310 | else throw "Could not infer format from filename '${filename}'"; 311 | 312 | src = __pdm2nix.fetchPDMPackage { 313 | inherit (project) pyproject projectRoot; 314 | inherit package filename; 315 | }; 316 | 317 | disabled = 318 | if package ? "requires_python" && ! lib.all (spec: pyproject-nix.lib.pep440.comparators.${spec.op} __pdm2nix.pyVersion spec.version) requiresPython then true 319 | else if package ? "marker" && ! (pep508.evalMarkers __pdm2nix.environ (pep508.parseMarkers marker)) then true 320 | else false; 321 | 322 | in 323 | buildPythonPackage 324 | ({ 325 | pname = name; 326 | inherit version src format; 327 | 328 | doCheck = false; # No development deps in pdm.lock 329 | 330 | propagatedBuildInputs = 331 | let 332 | parsed = map pep508.parseString dependencies; 333 | # Filter only dependencies valid for this platform 334 | filtered = filter (dep: dep.markers == null || pep508.evalMarkers __pdm2nix.environ dep.markers) parsed; 335 | in 336 | flatten (map 337 | (dep: 338 | let 339 | # Optional dependencies filtered by enabled groups 340 | optionals = attrValues (filterAttrs (group: _: lib.elem group dep.extras) (pythonPackages.${dep.name}.optional-dependencies or { })); 341 | in 342 | [ pythonPackages.${dep.name} ] ++ optionals) 343 | filtered); 344 | 345 | meta = { 346 | description = summary; 347 | }; 348 | } 349 | // optionalAttrs disabled { inherit disabled; } 350 | // optionalAttrs (format == "wheel") { 351 | # Don't strip prebuilt wheels 352 | dontStrip = true; 353 | 354 | # Add wheel utils 355 | nativeBuildInputs = 356 | [ wheelUnpackHook pypaInstallHook ] 357 | ++ lib.optional stdenv.isLinux autoPatchelfHook 358 | ; 359 | 360 | buildInputs = 361 | # Add manylinux platform dependencies. 362 | lib.optionals (stdenv.isLinux && stdenv.hostPlatform.libc == "glibc") (lib.unique (lib.flatten ( 363 | let 364 | parsed = pyproject-nix.lib.pypa.parseWheelFileName filename; 365 | in 366 | map 367 | (tag: ( 368 | if lib.hasPrefix "manylinux1" tag then pythonManylinuxPackages.manylinux1 369 | else if lib.hasPrefix "manylinux2010" tag then pythonManylinuxPackages.manylinux2010 370 | else if lib.hasPrefix "manylinux2014" tag then pythonManylinuxPackages.manylinux2014 371 | else if lib.hasPrefix "manylinux_" tag then pythonManylinuxPackages.manylinux2014 372 | else [ ] # Any other type of wheel don't need manylinux inputs 373 | )) 374 | parsed.platformTags 375 | ))); 376 | }) 377 | 378 | ); 379 | }) 380 | --------------------------------------------------------------------------------