You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See Changelog.md for changes.
* adapt data interface for new sdist dependency graph format
* change wording in readme
* wheel support + concept providers
* overlay support WIP
* overlay support
* extras support for nixpkgs
* machnix as overrides
* granular provider settings + custom autoPatchelfHook
* improve overlay generator, remove prefer_new
* unify nixpkgs src
* update interface, bump version and examples
* fixes and updated docs
-**Python Wheels**: Wheels are supported for linux including manylinux1, manylinux2010, manylinux2014
4
+
-**Nixpkgs python packages**: Nixpkgs is now treated as a separate provider. That means packages can be taken directly from there, independent on their availability from pypi.
5
+
-**Configurable Providers**: The user can now freely decide where packages should be taken from either via a default or on a per package basis. Currently available provider are `nixpkgs`, `sdist`, `wheel`.
6
+
-**Core architecture - Python Overrides**: The core of mach nix now produces python overrides instead of nixpkgs overlays which makes it much more composible and allows for a less strange API.
7
+
-**Overlay support**: `mkPython` and lower level interfaces now accept new parameter `pkgs` and `python` which indirectly enables you to use any nixpkgs overlays (But don't use this for modifying python packages. Better do this with **Python Overrides**)
8
+
-**Python Overrides support**: `mkPython` now accepts new parameter `overrides_pre` and `overrides_post` each allowing to inject a list of python overrides to apply before and after the mach-nix internal overrides. This allows you to fixup packages or add your own modifications to them.
9
+
-**Extras support**: All providers now fully support python [extras](https://www.python.org/dev/peps/pep-0508/#extras). That means requirements like for example '`requests[security]`' will be correctly resolved.
10
+
11
+
## Nix Interface changes:
12
+
- Removed:
13
+
-**mkPythonExpr**: removed in favor of `machNixFile` and `machNix`
14
+
- Added:
15
+
-**machNixFile** which generates a nex expresison
16
+
-**machNix** which evaluates the generated nix expression to get `overrides` and `select_pkgs`
17
+
- Changed:
18
+
-**mkPython**:
19
+
- Removed arguments:
20
+
- `python_attr` in favor if `python`
21
+
- `prefer_nixpkgs` in favor of `providers`
22
+
- `nixpkgs_commit` in favor of `pkgs`
23
+
- `nixpkgs_tarball_sha256` in favor of `pkgs`
24
+
- Added arguments:
25
+
- `overrides_pre`: list of python overrides to apply before the machnix overrides
26
+
- `overrides_post`: list of python overrides to apply after the machnix overrides
27
+
- `pkgs`: pass custom nixpkgs. Only used for manylinux wheel dependencies.
28
+
- `providers`: define provider preferences
29
+
- `_provider_defaults`: builtin provider defaults. Disable them by passing {}
nix-env -if https://github.com/DavHau/mach-nix/tarball/1.0.0 -A mach-nix
16
+
nix-env -if https://github.com/DavHau/mach-nix/tarball/2.0.0 -A mach-nix
17
17
```
18
18
19
19
## Basic usage
@@ -44,8 +44,7 @@ If you are comfortable with writing nix expressions, you don't need to install t
44
44
let
45
45
mach-nix = import (builtins.fetchGit {
46
46
url = "https://github.com/DavHau/mach-nix/";
47
-
ref = "master";
48
-
rev = "fa2bb2d33fb9b9dc3113046e4fcc16088f56981a";
47
+
ref = "2.0.0";
49
48
});
50
49
in
51
50
mach-nix.mkPython {
@@ -70,7 +69,7 @@ mach-nix.mkPython {
70
69
The general mechanism can be broken down into the following:
71
70
72
71
### Dependency resolution
73
-
Mach-nix contains a dependency graph of nearly all python packages available on pypi.org. With this, mach-nix is able to do dependency resolution offline within seconds.
72
+
Mach-nix contains a dependency graph of nearly all python packages available on pypi.org. This allows mach-nix to resolve dependencies offline within seconds.
74
73
75
74
The dependency graph data can be found here: https://github.com/DavHau/pypi-deps-db
76
75
The dependency graph is updated on a daily basis by this set of tools: https://github.com/DavHau/pypi-crawlers
@@ -100,31 +99,34 @@ The overlay is generated by applying the following strategy to each required pyt
100
99
- If no version of the required package is found in nixpkgs, the package is built from scratch by using `buildPythonPackage`.
101
100
102
101
## Advanced Usage (Nix Only)
103
-
Mach-nix can be fine tuned with additional arguments by importing it via `builtins.fetchGit`. Examples can be found in [./example](./example/). There are 3 different methods which can be invoked:
104
-
1.**mkPythonExpr** - returns a derivation containing a nix expression in $out/share/expr.nix which describes the python environment defined by your inputs
105
-
1.**mkPython** - returns the python environment derivation. It basically just evaluates the expression coming from **mkPythonExpr**.
102
+
Mach-nix can be fine tuned with additional arguments by importing it via `builtins.fetchGit`. Examples can be found in [./example](./example/). There are 4 different methods which can be invoked:
103
+
1.**machNixFile** - returns a single file derivation containing a nix expression in $out/share/mach_nix_file.nix which contains python overrides and a package selector.
104
+
1.**MachNix** - evaluates **machNixFile** and returns `overrides` and `select_pkgs` which you can use to satisfy your requirements.
105
+
1.**mkPython** - builds a python environment for a given `requirements.txt`.
106
106
1.**mkPythonShell** - returns the python environment suitable for nix-shell.
107
107
108
-
All 3 methods take the following set of inputs which are processed in [./mach_nix/nix/expression.nix](./mach_nix/nix/expression.nix):
108
+
Both **mkPython** and **mkPythonShell**take the following arguments:
109
109
110
110
### Required Arguments:
111
111
-**requirements** (string): Text content of a typical `requirements.txt`.
112
112
113
113
### Optional Arguments:
114
-
-**python_attr** (string): Select one of (python27, python35, python36, python37, python38). (default: python37)
115
-
-**prefer_nixpkgs** (bool): Prefer python package versions from nixpkgs instead of newer ones. Decreases build time. (default: true)
116
-
-**disable_checks** (bool): Disable tests wherever possible to decrease build time.
117
-
-**nixpkgs_commit** (string): commit hash of nixpkgs version to use python packages from
118
-
-**nixpkgs_tarball_sha256** (string): sha256 hash of the unpacked tarball for the selected nixpkgs version. (obtained via `nix-prefetch-url --unpack https://github.com/nixos/nixpkgs/tarball/<nixpkgs_commit>`)
114
+
-**disable_checks** (bool): Disable tests wherever possible to decrease build time and failures due to nix incompatible tests
115
+
-**overrides_pre** (list): list of pythonOverrides to apply before the machnix overrides
116
+
-**overrides_post** (list): list of pythonOverrides to apply after the machnix overrides
117
+
-**pkgs** (set): pass custom nixpkgs version (20.03 or higher is required for wheel support)
118
+
-**providers** (set): define provider preferences
119
119
-**pypi_deps_db_commit** (string): commit hash of a specific version of the dependency graph ([pypi-deps-db](https://github.com/DavHau/pypi-deps-db)).
120
120
-**pypi_deps_db_sha256** (string): sha256 hash obtained via `nix-prefetch-url --unpack https://github.com/DavHau/pypi-deps-db/tarball/<pypi_deps_db_commit>`
121
+
-**python** (set): select custom python to base overrides on. Should be from nixpkgs >= 20.03
122
+
-**_provider_defaults** (set): builtin provider defaults. Disable them by passing {}
123
+
121
124
122
125
## Contributing
123
126
Contributions to this project are welcome in the form of GitHub PRs. If you are planning to make any considerable changes, you should first present your plans in a GitHub issue so it can be discussed.
124
127
125
128
## Limitations
126
-
- Currently mach-nix does not provide any functionality which supports you in publishing python projects, like [Poetry](https://python-poetry.org/) does for example.
127
-
- Mach-nix does not yet support python packages in form of bdist_wheels, therefore some packages from pypi are not available.
129
+
- Currently mach-nix does not provide any functionality which supports you in publishing python projects, like [Poetry](https://python-poetry.org/) does for example.
0 commit comments