Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
179 commits
Select commit Hold shift + click to select a range
11ea0e9
python3: 3.9 -> 3.10
mweinelt May 25, 2022
f1ac3fa
python3Minimal: 3.9 -> 3.10
mweinelt May 29, 2022
4566beb
doc/python: update python version references
mweinelt May 25, 2022
a15f7dd
spidermonkey_78: pin python39
mweinelt Jun 1, 2022
7986ff2
python3Packages.gyp: 2020-05-12 -> unstable-2022-04-01
mweinelt Jun 1, 2022
4571d1d
python310Packages.asgiref: 3.5.0 -> 3.5.2
SuperSandro2000 Jun 1, 2022
fa3f5e1
python310Packages.astroid: 2.11.2 -> 2.11.4, adopt
SuperSandro2000 Jun 1, 2022
374f134
python310Packages.pylint: 2.13.5 -> 2.14.0, adopt
SuperSandro2000 Jun 1, 2022
b5f8c41
python310Packages.certifi: 2021.10.08 -> 2022.05.18.1
SuperSandro2000 Jun 1, 2022
8abc97c
python310Packages.hypothesis: 6.40.0 -> 6.46.3
SuperSandro2000 May 11, 2022
055e0f9
python310Packages.hypothesis: 6.46.3 -> 6.46.10
SuperSandro2000 Jun 1, 2022
4561bf0
python310Packages.cryptography: 36.0.2 -> 37.0.2
SuperSandro2000 Jun 1, 2022
f68add0
python310Packages.pure-eval: 0.2.1 -> 0.2.2
fabaff Apr 30, 2022
cfe5a6b
python310Packages.aiomysql: 0.1.0 -> 0.1.1
fabaff May 14, 2022
205524d
python310Packages.pytest-httpbin: 1.0.1 -> 1.0.2
fabaff May 18, 2022
b19bb22
python310Packages.pytest-localserver: 0.5.1.post0 -> 0.6.0
fabaff May 18, 2022
14f9564
python310Packages.sopel: 7.1.8 -> 7.1.9
fabaff May 20, 2022
181ec21
python310Packages.pytest-randomly: 3.11.0 -> 3.12.0
fabaff May 20, 2022
276654d
python310Packages.vulture: 2.3 -> 2.4
fabaff May 21, 2022
6ca651b
python310Packages.pytest-subtests: 0.7.0 -> 0.8.0
fabaff May 26, 2022
39d1306
python310Packages.apipkg: 2.1.0 -> 2.1.1
fabaff May 25, 2022
b31b5f1
python310Packages.webob: switch to pytestCheckHook
fabaff May 28, 2022
774f693
python310Packages.pyzmq: 22.3.0 -> 23.0.0
fabaff May 28, 2022
04b3069
python310Packages.GitPython: 3.1.25 -> 3.1.27
fabaff May 23, 2022
9169629
python310Packages.lxml: 4.8.0 -> 4.9.0
SuperSandro2000 May 30, 2022
76170bf
python310Packages.typed-ast: 1.5.2 -> 1.5.4
SuperSandro2000 Jun 1, 2022
8842868
python310Packages.types-typed-ast: 1.5.4 -> 1.5.6
SuperSandro2000 Jun 1, 2022
9a7c066
python310Packages.xmltodict: 0.12.0 -> 0.13.0
SuperSandro2000 Jun 1, 2022
989872e
python310Packages.raven: update dependencies, description, comment
SuperSandro2000 May 30, 2022
2d25c8e
python310Packages.httpbin: fix dependencies
SuperSandro2000 May 30, 2022
1f5366f
python310Packages.zipp: 3.7.0 -> 3.8.0
SuperSandro2000 Jun 1, 2022
473c566
python310Packages.pysqueezebox: fix formatting
SuperSandro2000 Jun 2, 2022
2922699
python310Packages.urllib3: add optional-dependencies
SuperSandro2000 May 30, 2022
7895b85
python310Packages.pillow: 9.1.0 -> 9.1.1
SuperSandro2000 Jun 1, 2022
ab0b903
python310Packages.ordereddict: drop
SuperSandro2000 May 28, 2022
014c7bd
python310Packages.botocore: drop ordereddict
SuperSandro2000 May 28, 2022
1e861c4
python310Packages.flask-limiter: drop ordereddict
SuperSandro2000 May 28, 2022
9e3cbe0
python310Packages.yamlordereddictloader: drop ordereddict
SuperSandro2000 May 28, 2022
d6252cb
python27Packages.botocore: drop ordereddict
SuperSandro2000 May 28, 2022
bbe515c
jira_cli: drop ordereddict
SuperSandro2000 May 28, 2022
cb24b62
python310Packages.pyscss: drop ordereddict
SuperSandro2000 May 28, 2022
9d0985f
python310Packages.pyscss: switch to pytestCheckHook
SuperSandro2000 May 28, 2022
a4a4d9b
python310Packages.pbr: 5.8.1 -> 5.9.0
SuperSandro2000 Jun 1, 2022
92ea671
python310Packages.libcst: 0.4.1 -> 0.4.3, drop inactive maintainer
SuperSandro2000 Jun 1, 2022
6944e6c
python310Packages.cachecontrol: 0.12.10 -> 0.12.11
SuperSandro2000 Jun 2, 2022
55531cf
python310Packages.cherrypy: properly declare optional dependencies
SuperSandro2000 Jun 2, 2022
8465729
python310Packages.repoze_lru: add pythonImportsCheck
SuperSandro2000 Jun 2, 2022
a40d0cb
python310Packages.routes: update meta, normalize pname, cleanup
SuperSandro2000 Jun 2, 2022
1d5ed92
python310Packages.soupsieve: document circular dependency, cleanup
SuperSandro2000 Jun 2, 2022
548ae98
dtc: fix python 3.10 compatibility
SuperSandro2000 Jun 2, 2022
00f527c
python3Packages.osmnx: 1.1.2 → 1.2.0
sikmir Jun 2, 2022
a972e00
python3Packages.networkx: 2.7.1 → 2.8.2
sikmir Jun 2, 2022
eebbe8c
python3Packages.Rtree: 0.9.7 → 1.0.0
sikmir Jun 2, 2022
2933cc9
python310Packages.responses: 0.20.0 -> 0.21.0
fabaff Jun 2, 2022
af4aa2f
python310Packages.cachetools: 5.0.0 -> 5.2.0
fabaff Jun 2, 2022
d028f1e
python310Packages.httpcore: 0.14.7 -> 0.15.0
fabaff Jun 2, 2022
99ecb8d
python310Packages.httpx: 0.22.0 -> 0.23.0
fabaff Jun 2, 2022
a9221ef
python310Packages.pytest-httpx: 0.20.0 -> 0.21.0
fabaff Jun 2, 2022
0af0534
python310Packages.python-slugify: 6.1.1 -> 6.1.2
fabaff Jun 2, 2022
c43e4f6
python310Packages.simple-rest-client: 1.1.2 -> 1.1.3
fabaff Jun 2, 2022
d465833
unicorn: 2.0.0-rc5 -> 2.0.0-rc7
fabaff Jun 2, 2022
2370e4e
python310Packages.pefile: 2021.9.3 -> 2022.5.30
fabaff Jun 2, 2022
ca78347
python310Packages.pyelftools: 0.27 -> 0.28
fabaff Jun 2, 2022
7931c07
python310Packages.qiling: 1.4.2 -> 1.4.3
fabaff Jun 2, 2022
d7be051
python310Packages.xdis: unstable-2022-04-13 -> 6.0.4
SuperSandro2000 Jun 2, 2022
a2004af
python3Packages.numpy: 1.21.5 -> 1.21.6
mweinelt Jun 2, 2022
00908f6
python3Packages.sqlalchemy: 1.4.36 -> 1.4.37
mweinelt Jun 3, 2022
ac1db34
python310Packages.m2r: fix tests under python 3.10
SuperSandro2000 Jun 2, 2022
f3270c3
python310Packages.billiard: disable flaky test
SuperSandro2000 Jun 3, 2022
270c647
python310Packages.pgpy: ignore broken test
SuperSandro2000 Jun 3, 2022
fd028a2
python310Packages.pylink-square: 0.8.1 -> 0.13.0
dotlambda Jun 2, 2022
7a83c76
sftpman: 1.1.3 -> 1.2.2
dotlambda Jun 3, 2022
0f14467
MACS2: mark broken
SuperSandro2000 Jun 3, 2022
e460b28
python310Packages.jsonschema: 4.5.1 -> 4.6.0
SuperSandro2000 Jun 3, 2022
5a8116f
python3Packages.moto: 3.1.3 -> 3.1.11
mweinelt Jun 3, 2022
cd49d60
python3Packages.certbot: 1.24.0 -> 1.27.0
mweinelt Jun 3, 2022
34423b1
python3Packages.hass-nabuacasa: update dependency constraints
mweinelt Jun 3, 2022
ac2e6fb
home-assistant: update python-slugify override
mweinelt Jun 3, 2022
962a325
python310Packages.cssutils: 2.4.0 -> 2.4.1
dotlambda Jun 3, 2022
d11da8c
python310Packages.fonttools: specify passthru.optional-dependencies
dotlambda Jun 3, 2022
17e9bab
python310Packages.weasyprint: update dependencies
dotlambda Jun 3, 2022
d8c3800
python310Packages.pygal: update dependencies
dotlambda Jun 3, 2022
2dce5a7
python310Packages.trio-websocket: init at 0.9.2
SuperSandro2000 Jun 4, 2022
8466ac2
python310Packages.selenium: 3.141.0 -> 4.2.0
SuperSandro2000 Jun 4, 2022
15f74ff
python3Packages.ansible-later: 2.0.13 -> 2.0.14
mweinelt Jun 4, 2022
4104ea1
python310Packages.splinter: disable by design not working test, remov…
SuperSandro2000 Jun 4, 2022
a7ed20d
python3Packages.audible: update httpx constraint, disable check phase
mweinelt Jun 4, 2022
17da2b4
python3Packages.sanic-tesing: relax httpx constraint
mweinelt Jun 4, 2022
731a3c9
python3Packages.fastapi-mail: relax http constraint
mweinelt Jun 4, 2022
ea66d03
python3Packages.graph-tool: 2.43 -> 2.45
mweinelt Jun 5, 2022
0d1516e
python3Packages.sleekxmpp: disable on python3.10
mweinelt Jun 5, 2022
e5b1832
python3Packages.homeconnect: propagate six
mweinelt Jun 5, 2022
a543fd1
python3Packages.aiosteamist: relax xmltodict constraint
mweinelt Jun 5, 2022
313d44a
python310Packages.cloudpickle: 2.0.0 -> 2.1.0
fabaff Jun 2, 2022
5d96f57
python310Packages.msgpack: 1.0.3 -> 1.0.4
fabaff Jun 4, 2022
c5b343c
home-assistant: relax cryptography constraint
mweinelt Jun 5, 2022
80577b6
python3Packages.cfn-flip: fix hash
mweinelt Jun 5, 2022
3a5f902
python3Packages.node_progressive: mark unconditionally as broken
mweinelt Jun 5, 2022
c9d25b2
python3Packages.sphinxcontrib_bayesnet: mark unconditionally broken
mweinelt Jun 5, 2022
1c701dd
python3Packages.selectors2: fix mapping import
mweinelt Jun 5, 2022
323bc12
python3Packages.snowflake-connector-python: relax cryptography constr…
mweinelt Jun 5, 2022
1d1120a
quodlibet: 4.4.0 -> 4.5.0
mweinelt Jun 5, 2022
ae784e7
diffoscope: 214 -> 215
mweinelt Jun 5, 2022
61d056d
python3Packages.hyperion-py: fix python3.10 support
mweinelt Jun 5, 2022
77cf041
python3Packages.requests: expose optional-dependencies
mweinelt Jun 5, 2022
665aec3
python3Packages.beautifulsoup4: propagate chardet
mweinelt Jun 5, 2022
397cf8e
gdown: propagate requests[socks]
mweinelt Jun 5, 2022
2600e7d
python3Packages.starlette: 0.19.0 -> 0.20.1
mweinelt Jun 5, 2022
39e1366
python3Packages.fastapi: 0.75.2 -> 0.78.0
mweinelt Jun 5, 2022
ce67d25
python3Packages.fastapi-mail: relax fastapi constraint
mweinelt Jun 5, 2022
a45f138
mapnik: unvendor scons
dotlambda Jun 5, 2022
c146fde
python310Packages.limits: 2.6.2 -> 2.6.3
SuperSandro2000 Jun 5, 2022
852ef21
cantoolz: fix python3.10 support
mweinelt Jun 5, 2022
9641ef0
i3a: relax python version constraint
mweinelt Jun 5, 2022
b6f6f1f
python3Packages.flickrapi: propagate six
mweinelt Jun 5, 2022
a4b86d4
python3Packages.globus-sdk: fix tests
mweinelt Jun 6, 2022
b670cf8
python3Packages.snscrape: propagate requests[socks]
mweinelt Jun 6, 2022
51fd3fe
turses: update tweepy override
mweinelt Jun 6, 2022
b10d49e
errbot: use python39
dotlambda Jun 5, 2022
418a929
ntfy: use python39 and remove ntfy-webpush from python3Packages
dotlambda Jun 5, 2022
d588e9a
python3Packages.snowflake-sqlalchemy: propgate six
mweinelt Jun 6, 2022
cbda7b3
python310Packages.twine: 4.0.0 -> 4.0.1
SuperSandro2000 Jun 6, 2022
0eb0706
python310Packages.snscrape: unstable-2021-08-30 -> 0.4.3.20220106
fabaff Jun 6, 2022
fe428eb
python310Packages.websockets: 10.1 -> 10.3
fabaff Jun 6, 2022
d07a5a3
python310Packages.unidecode: 1.3.2 -> 1.3.4
fabaff Jun 6, 2022
8759218
python310Packages.databases: 0.5.5 -> 0.6.0
fabaff Jun 6, 2022
b5751da
python310Packages.filelock: 3.6.0 -> 3.7.1
fabaff Jun 6, 2022
a91744f
python310Packages.pybase64: 1.2.1 -> 1.2.2
fabaff Jun 6, 2022
269e8cf
python310Packages.immutables: 0.17 -> 0.18
fabaff Jun 6, 2022
141824e
python310Packages.pyathena: 2.5.2 -> 2.9.1
fabaff Jun 6, 2022
3e1a60f
python310Packages.gcsfs: 2022.3.0 -> 2022.5.0
fabaff May 22, 2022
3bd9157
python310Packages.dask-gateway-server: 0.9.0 -> 2022.4.0
fabaff May 22, 2022
6d106f0
python310Packages.distributed: 2022.2.1 -> 2022.5.0
fabaff May 22, 2022
348353c
python310Packages.locket: 0.2.1 -> 1.0.0
fabaff May 22, 2022
9cf7ead
python310Packages.s3fs: 2022.2.0 -> 2022.5.0
fabaff May 22, 2022
55c67f4
python310Packages.tifffile: 2022.3.25 -> 2022.5.4
fabaff May 23, 2022
630241e
python310Packages.imageio: 2.16.1 -> 2.19.2
fabaff May 23, 2022
f76d963
python310Packages.pyarrow: disable flaky test
fabaff May 27, 2022
15b6704
python310Packages.dask: 2022.05.0 -> 2022.05.2
fabaff May 27, 2022
71d5ec6
python310Packages.distributed: 2022.5.0 -> 2022.5.2
fabaff May 28, 2022
ddb88d2
python310Packages.streamz: disable flaky tests
fabaff May 30, 2022
0220a62
python310Packages.pyarrow: disable flaky test
fabaff May 30, 2022
792e5af
python310Packages.intake: 0.6.4 -> 0.6.5
fabaff May 31, 2022
e35789d
python310Packages.fsspec: 2022.3.0 -> 2022.5.0
fabaff Jun 1, 2022
b352fc5
python310Packages.dask: 2022.02.1 -> 2022.05.0
fabaff May 22, 2022
32a2f6f
python310Packages.fastparquet: add optional dependency
fabaff Jun 2, 2022
ea65830
python310Packages.s3fs: disable on older Python releases
fabaff Jun 2, 2022
077cf7c
Python310Packages.sparse: disable on older Python releases
fabaff Jun 3, 2022
fc78ec9
python310Packages.dask-glm: handle optional dependencies
fabaff Jun 3, 2022
e3873e7
python310Packages.dask-ml: handle optional dependencies
fabaff Jun 3, 2022
e18f93c
python310Packages.dask: 2022.05.0 -> 2022.05.2
fabaff Jun 3, 2022
b045199
privacyidea: use python39
dotlambda Jun 6, 2022
37cc04e
odoo: use python39
dotlambda Jun 6, 2022
c2aa107
python3Packages.azure-mgmt-containerinstance: 9.1.0 -> 9.2.0
jonringer Jun 6, 2022
42caf48
python3Packages.azure-mgmt-containerregistry: 9.1.0 -> 10.0.0
jonringer Jun 6, 2022
7c16cc8
python3Packages.azure-storage-blob: 12.11.0 -> 12.12.0
jonringer Jun 6, 2022
cb93a02
python310Packages.glances-api: 0.3.5 -> 0.3.6
fabaff Jun 6, 2022
8b04068
python310Packages.pymemcache: 3.5.1 -> 3.5.2
fabaff Jun 6, 2022
c9b86a2
python3Packages.azure-data-tables: init at 12.4.0
jonringer Jun 6, 2022
c055b9b
python3Packages.antlr4-python3-runtime: fix tests for 4.9+
jonringer Jun 6, 2022
40e0a8d
azure-cli: remove blanket python2 compat logic
jonringer Jun 6, 2022
ce0ebc2
azure-cli: 2.34.1 -> 2.37.0
jonringer Jun 6, 2022
77cdee1
fixup! python3Packages.azure-data-tables: init at 12.4.0
SuperSandro2000 Jun 7, 2022
daad0be
fixup! azure-cli: 2.34.1 -> 2.37.0
SuperSandro2000 Jun 7, 2022
499c504
python310Packages.pylint: 2.14.0 -> 2.14.1
SuperSandro2000 Jun 7, 2022
0031cca
python310Packages.pyserial: add pythonImportsCheck
fabaff Jun 7, 2022
0dbb26a
python310Packages.configobj: switch to pytestCheckHook
fabaff Jun 7, 2022
13a4a87
python310Packages.jsonpatch: enable tests
fabaff Jun 7, 2022
069f9a0
python310Packages.netifaces: add format
fabaff Jun 7, 2022
9af97d3
python310Packages.pyannotate: switch to pytestCheckHook
fabaff Jun 7, 2022
209c3fa
python310Packages.pytest-annotate: relax pytest constraint
fabaff Jun 7, 2022
c422b65
pip-audit: adjust inputs
fabaff Jun 7, 2022
53c8f97
autoflake: switch to pytestCheckHook
fabaff Jun 8, 2022
d0ee55d
thrift: disable failing tests
fabaff Jun 8, 2022
7770164
python310Packages.qutip: 4.6.3 -> 4.7.0
fabaff Jun 8, 2022
66bb79f
python39Packages.rokuecp: disable failing tests
fabaff Jun 8, 2022
4f1fa2f
python310Packages.graphite-web: 1.1.8 -> 1.1.10
fabaff Jun 8, 2022
3b754de
python310Packages.graphite-web: remove patch
fabaff Jun 8, 2022
7e2f6fa
calibre-web: add missing input
fabaff Jun 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 35 additions & 32 deletions doc/languages-frameworks/python.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

Several versions of the Python interpreter are available on Nix, as well as a
high amount of packages. The attribute `python3` refers to the default
interpreter, which is currently CPython 3.9. The attribute `python` refers to
interpreter, which is currently CPython 3.10. The attribute `python` refers to
CPython 2.7 for backwards-compatibility. It is also possible to refer to
specific versions, e.g. `python38` refers to CPython 3.8, and `pypy` refers to
specific versions, e.g. `python39` refers to CPython 3.9, and `pypy` refers to
the default PyPy interpreter.

Python is used a lot, and in different ways. This affects also how it is
Expand All @@ -26,10 +26,10 @@ however, are in separate sets, with one set per interpreter version.
The interpreters have several common attributes. One of these attributes is
`pkgs`, which is a package set of Python libraries for this specific
interpreter. E.g., the `toolz` package corresponding to the default interpreter
is `python.pkgs.toolz`, and the CPython 3.8 version is `python38.pkgs.toolz`.
is `python.pkgs.toolz`, and the CPython 3.9 version is `python39.pkgs.toolz`.
The main package set contains aliases to these package sets, e.g.
`pythonPackages` refers to `python.pkgs` and `python38Packages` to
`python38.pkgs`.
`pythonPackages` refers to `python.pkgs` and `python39Packages` to
`python39.pkgs`.

#### Installing Python and packages {#installing-python-and-packages}

Expand All @@ -54,7 +54,7 @@ with `python.buildEnv` or `python.withPackages` where the interpreter and other
executables are wrapped to be able to find each other and all of the modules.

In the following examples we will start by creating a simple, ad-hoc environment
with a nix-shell that has `numpy` and `toolz` in Python 3.8; then we will create
with a nix-shell that has `numpy` and `toolz` in Python 3.9; then we will create
a re-usable environment in a single-file Python script; then we will create a
full Python environment for development with this same environment.

Expand All @@ -70,19 +70,19 @@ temporary shell session with a Python and a *precise* list of packages (plus
their runtime dependencies), with no other Python packages in the Python
interpreter's scope.

To create a Python 3.8 session with `numpy` and `toolz` available, run:
To create a Python 3.9 session with `numpy` and `toolz` available, run:

```sh
$ nix-shell -p 'python38.withPackages(ps: with ps; [ numpy toolz ])'
$ nix-shell -p 'python39.withPackages(ps: with ps; [ numpy toolz ])'
```

By default `nix-shell` will start a `bash` session with this interpreter in our
`PATH`, so if we then run:

```Python console
[nix-shell:~/src/nixpkgs]$ python3
Python 3.8.1 (default, Dec 18 2019, 19:06:26)
[GCC 9.2.0] on linux
Python 3.9.12 (main, Mar 23 2022, 21:36:19)
[GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy; import toolz
```
Expand All @@ -102,13 +102,16 @@ will still get 1 wrapped Python interpreter. We can start the interpreter
directly like so:

```sh
$ nix-shell -p 'python38.withPackages(ps: with ps; [ numpy toolz requests ])' --run python3
these derivations will be built:
/nix/store/xbdsrqrsfa1yva5s7pzsra8k08gxlbz1-python3-3.8.1-env.drv
building '/nix/store/xbdsrqrsfa1yva5s7pzsra8k08gxlbz1-python3-3.8.1-env.drv'...
created 277 symlinks in user environment
Python 3.8.1 (default, Dec 18 2019, 19:06:26)
[GCC 9.2.0] on linux
$ nix-shell -p "python39.withPackages (ps: with ps; [ numpy toolz requests ])" --run python3
this derivation will be built:
/nix/store/mpn7k6bkjl41fm51342rafaqfsl10qs4-python3-3.9.12-env.drv
this path will be fetched (0.09 MiB download, 0.41 MiB unpacked):
/nix/store/5gaiacnzi096b6prc6aa1pwrhncmhc8b-python3.9-toolz-0.11.2
copying path '/nix/store/5gaiacnzi096b6prc6aa1pwrhncmhc8b-python3.9-toolz-0.11.2' from 'https://cache.nixos.org'...
building '/nix/store/mpn7k6bkjl41fm51342rafaqfsl10qs4-python3-3.9.12-env.drv'...
created 279 symlinks in user environment
Python 3.9.12 (main, Mar 23 2022, 21:36:19)
[GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>>
Expand Down Expand Up @@ -147,7 +150,7 @@ Executing this script requires a `python3` that has `numpy`. Using what we learn
in the previous section, we could startup a shell and just run it like so:

```ShellSession
$ nix-shell -p 'python38.withPackages(ps: with ps; [ numpy ])' --run 'python3 foo.py'
$ nix-shell -p 'python39.withPackages(ps: with ps; [ numpy ])' --run 'python3 foo.py'
The dot product of [1 2] and [3 4] is: 11
```

Expand Down Expand Up @@ -210,12 +213,12 @@ create a single script with Python dependencies, but in the course of normal
development we're usually working in an entire package repository.

As explained in the Nix manual, `nix-shell` can also load an expression from a
`.nix` file. Say we want to have Python 3.8, `numpy` and `toolz`, like before,
`.nix` file. Say we want to have Python 3.9, `numpy` and `toolz`, like before,
in an environment. We can add a `shell.nix` file describing our dependencies:

```nix
with import <nixpkgs> {};
(python38.withPackages (ps: [ps.numpy ps.toolz])).env
(python39.withPackages (ps: [ps.numpy ps.toolz])).env
```

And then at the command line, just typing `nix-shell` produces the same
Expand All @@ -229,7 +232,7 @@ What's happening here?
imports the `<nixpkgs>` function, `{}` calls it and the `with` statement
brings all attributes of `nixpkgs` in the local scope. These attributes form
the main package set.
2. Then we create a Python 3.8 environment with the `withPackages` function, as before.
2. Then we create a Python 3.9 environment with the `withPackages` function, as before.
3. The `withPackages` function expects us to provide a function as an argument
that takes the set of all Python packages and returns a list of packages to
include in the environment. Here, we select the packages `numpy` and `toolz`
Expand All @@ -240,7 +243,7 @@ To combine this with `mkShell` you can:
```nix
with import <nixpkgs> {};
let
pythonEnv = python38.withPackages (ps: [
pythonEnv = python39.withPackages (ps: [
ps.numpy
ps.toolz
]);
Expand Down Expand Up @@ -378,8 +381,8 @@ information. The output of the function is a derivation.

An expression for `toolz` can be found in the Nixpkgs repository. As explained
in the introduction of this Python section, a derivation of `toolz` is available
for each interpreter version, e.g. `python38.pkgs.toolz` refers to the `toolz`
derivation corresponding to the CPython 3.8 interpreter.
for each interpreter version, e.g. `python39.pkgs.toolz` refers to the `toolz`
derivation corresponding to the CPython 3.9 interpreter.

The above example works when you're directly working on
`pkgs/top-level/python-packages.nix` in the Nixpkgs repository. Often though,
Expand All @@ -392,11 +395,11 @@ and adds it along with a `numpy` package to a Python environment.
with import <nixpkgs> {};

( let
my_toolz = python38.pkgs.buildPythonPackage rec {
my_toolz = python39.pkgs.buildPythonPackage rec {
pname = "toolz";
version = "0.10.0";

src = python38.pkgs.fetchPypi {
src = python39.pkgs.fetchPypi {
inherit pname version;
Comment on lines -395 to 403
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Their is a leftover in this expression python38.withPackages (ps: [ps.numpy my_toolz]) Is it intentional ? Now It can be udpated to 3.10

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, wasn't intentional. I apparently missed it.

sha256 = "08fdd5ef7c96480ad11c12d472de21acd32359996f69a5259299b540feba4560";
};
Expand All @@ -414,7 +417,7 @@ with import <nixpkgs> {};
```

Executing `nix-shell` will result in an environment in which you can use
Python 3.8 and the `toolz` package. As you can see we had to explicitly mention
Python 3.9 and the `toolz` package. As you can see we had to explicitly mention
for which Python version we want to build a package.

So, what did we do here? Well, we took the Nix expression that we used earlier
Expand Down Expand Up @@ -742,15 +745,15 @@ If we create a `shell.nix` file which calls `buildPythonPackage`, and if `src`
is a local source, and if the local source has a `setup.py`, then development
mode is activated.

In the following example we create a simple environment that has a Python 3.8
In the following example we create a simple environment that has a Python 3.9
version of our package in it, as well as its dependencies and other packages we
like to have in the environment, all specified with `propagatedBuildInputs`.
Indeed, we can just add any package we like to have in our environment to
`propagatedBuildInputs`.

```nix
with import <nixpkgs> {};
with python38Packages;
with python39Packages;

buildPythonPackage rec {
name = "mypackage";
Expand Down Expand Up @@ -828,9 +831,9 @@ and in this case the `python38` interpreter is automatically used.

### Interpreters {#interpreters}

Versions 2.7, 3.7, 3.8 and 3.9 of the CPython interpreter are available as
respectively `python27`, `python37`, `python38` and `python39`. The
aliases `python2` and `python3` correspond to respectively `python27` and
Versions 2.7, 3.7, 3.8, 3.9 and 3.10 of the CPython interpreter are available
as respectively `python27`, `python37`, `python38`, `python39` and `python310`.
The aliases `python2` and `python3` correspond to respectively `python27` and
`python39`. The attribute `python` maps to `python2`. The PyPy interpreters
compatible with Python 2.7 and 3 are available as `pypy27` and `pypy3`, with
aliases `pypy2` mapping to `pypy27` and `pypy` mapping to `pypy2`. The Nix
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/audio/quodlibet/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
let optionals = lib.optionals; in
python3.pkgs.buildPythonApplication rec {
pname = "quodlibet${tag}";
version = "4.4.0";
version = "4.5.0";

src = fetchurl {
url = "https://github.com/quodlibet/quodlibet/releases/download/release-${version}/quodlibet-${version}.tar.gz";
sha256 = "sha256-oDMY0nZ+SVlVF2PQqH+tl3OHr3EmCP5XJxQXaiS782c=";
sha256 = "sha256-MBYVgp9lLLr+2zVTkjcWKli8HucaVn0kn3eJ2SaCRbw=";
};

nativeBuildInputs = [ wrapGAppsHook gettext ];
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/finance/odoo/default.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{ stdenv
, lib
, fetchurl
, python3
, python39
, nodePackages
, wkhtmltopdf
, nixosTests
}:

let
python = python3.override {
python = python39.override {
packageOverrides = self: super: {
click = super.click.overridePythonAttrs (old: rec {
version = "7.1.2";
Expand Down
6 changes: 3 additions & 3 deletions pkgs/applications/misc/privacyidea/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{ lib, fetchFromGitHub, cacert, openssl, nixosTests
, python3
, python39
}:

let
python3' = python3.override {
python3' = python39.override {
packageOverrides = self: super: {
sqlalchemy = super.sqlalchemy.overridePythonAttrs (oldAttrs: rec {
version = "1.3.24";
Expand All @@ -19,7 +19,7 @@ let
});
flask_migrate = super.flask_migrate.overridePythonAttrs (oldAttrs: rec {
version = "2.7.0";
src = python3.pkgs.fetchPypi {
src = self.fetchPypi {
pname = "Flask-Migrate";
inherit version;
sha256 = "ae2f05671588762dd83a21d8b18c51fe355e86783e24594995ff8d7380dffe38";
Expand Down
32 changes: 6 additions & 26 deletions pkgs/applications/networking/errbot/default.nix
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
{ lib
, ansi
, buildPythonApplication
, colorlog
, daemonize
, deepmerge
, dulwich
, fetchFromGitHub
, flask
, glibcLocales
, hypchat
, irc
, jinja2
, markdown
, mock
, pyasn1
, pyasn1-modules
, pygments
, pygments-markdown-lexer
, pyopenssl
, pytestCheckHook
, requests
, slackclient
, sleekxmpp
, telegram
, webtest
, python39
}:

buildPythonApplication rec {
let
python3 = python39;
in python3.pkgs.buildPythonApplication rec {
pname = "errbot";
version = "6.1.7";

Expand All @@ -41,7 +21,7 @@ buildPythonApplication rec {

buildInputs = [ glibcLocales ];

propagatedBuildInputs = [
propagatedBuildInputs = with python3.pkgs; [
ansi
colorlog
daemonize
Expand All @@ -64,7 +44,7 @@ buildPythonApplication rec {
webtest
];

checkInputs = [
checkInputs = with python3.pkgs; [
mock
pytestCheckHook
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ let
rev = "v${version}";
sha256 = "0k4bdlwjna6f1k19jki4xqgckrinkkw8b9wihzymr1l04rwd05nw";
};
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [
super.six
super.requests.optional-dependencies.socks
];
doCheck = false;
});
};
Expand Down
8 changes: 8 additions & 0 deletions pkgs/applications/science/biology/MACS2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ python3.pkgs.buildPythonPackage rec {
sha256 = "1rcxj943kgzs746f5jrb72x1cp4v50rk3qmad0m99a02vndscb5d";
};

postPatch = ''
# remove version check which breaks on 3.10
substituteInPlace setup.py \
--replace 'if float(sys.version[:3])<3.6:' 'if False:'
'';

propagatedBuildInputs = with python3.pkgs; [ numpy ];

# To prevent ERROR: diffpeak_cmd (unittest.loader._FailedTest) for obsolete
Expand All @@ -21,5 +27,7 @@ python3.pkgs.buildPythonPackage rec {
license = licenses.bsd3;
maintainers = with maintainers; [ gschwartz ];
platforms = platforms.linux;
# error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘use_tracing’; did you mean ‘tracing’?
broken = true;
};
}
25 changes: 22 additions & 3 deletions pkgs/development/compilers/dtc/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{ stdenv, lib, fetchgit, flex, bison, pkg-config, which
, pythonSupport ? false, python ? null, swig, libyaml
{ stdenv
, lib
, fetchgit
, fetchpatch
, flex
, bison
, pkg-config
, which
, pythonSupport ? false
, python ? null
, swig
, libyaml
}:

stdenv.mkDerivation rec {
Expand All @@ -12,8 +22,17 @@ stdenv.mkDerivation rec {
sha256 = "sha256-gx9LG3U9etWhPxm7Ox7rOu9X5272qGeHqZtOe68zFs4=";
};

patches = [
# fix python 3.10 compatibility
# based on without requiring the setup.py rework
# https://git.kernel.org/pub/scm/utils/dtc/dtc.git/commit/?id=383e148b70a47ab15f97a19bb999d54f9c3e810f
./python-3.10.patch
];

nativeBuildInputs = [ flex bison pkg-config which ]
++ lib.optionals pythonSupport [ python swig ];

buildInputs = [ libyaml ];
nativeBuildInputs = [ flex bison pkg-config which ] ++ lib.optionals pythonSupport [ python swig ];

postPatch = ''
patchShebangs pylibfdt/
Expand Down
28 changes: 28 additions & 0 deletions pkgs/development/compilers/dtc/python-3.10.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i
index 51ee801..075ef70 100644
--- a/pylibfdt/libfdt.i
+++ b/pylibfdt/libfdt.i
@@ -1044,9 +1044,9 @@ typedef uint32_t fdt32_t;
$result = Py_None;
else
%#if PY_VERSION_HEX >= 0x03000000
- $result = Py_BuildValue("y#", $1, *arg4);
+ $result = Py_BuildValue("y#", $1, (Py_ssize_t)*arg4);
%#else
- $result = Py_BuildValue("s#", $1, *arg4);
+ $result = Py_BuildValue("s#", $1, (Py_ssize_t)*arg4);
%#endif
}

diff --git a/pylibfdt/setup.py b/pylibfdt/setup.py
index ef40f15..81e161a 100755
--- a/pylibfdt/setup.py
+++ b/pylibfdt/setup.py
@@ -42,6 +42,7 @@ def get_version():
libfdt_module = Extension(
'_libfdt',
sources=[os.path.join(srcdir, 'libfdt.i')],
+ define_macros=[('PY_SSIZE_T_CLEAN', None)],
include_dirs=[os.path.join(srcdir, '../libfdt')],
libraries=['fdt'],
library_dirs=[os.path.join(top_builddir, 'libfdt')],
Loading