summaryrefslogtreecommitdiff
path: root/gnu/packages/python.scm
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2026-05-27 20:16:54 +0200
committerSharlatan Hellseher <sharlatanus@gmail.com>2026-06-10 13:50:58 +0100
commit272ca20778da5b6e6e54a7463f8bf188282c2140 (patch)
tree0b0b43470a780aba52b7639c5fb17330fb5a4e65 /gnu/packages/python.scm
parent2cba4f7cd35bdc419f552bf9af9b28993683c6a5 (diff)
gnu: Add python-3.13.
* gnu/pacakges/python.scm (python-3.13): New variable. * gnu/packages/patches/python-3.13-fix-tests.patch: Add patch. * gnu/local.mk (dist_DATA): Record patch. Merges: guix/guix!8889 Reviewed-by: Hugo Buddelmeijer <hugo@buddelmeijer.nl> Reviewed-by: Yelninei <yelninei@tutamail.com> Change-Id: I4ed0afd312ebdb33bc7b8c93b475c824f8a6b508 Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Diffstat (limited to 'gnu/packages/python.scm')
-rw-r--r--gnu/packages/python.scm193
1 files changed, 193 insertions, 0 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 7eaf07b6325..c80ecf18a0e 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -1121,6 +1121,199 @@ data types.")
1121 (cpe-vendor . "python"))) 1121 (cpe-vendor . "python")))
1122 (license license:psfl))) 1122 (license license:psfl)))
1123 1123
1124(define-public python-3.13
1125 (package
1126 (name "python")
1127 (version "3.13.13")
1128 (source
1129 (origin
1130 (method url-fetch)
1131 (uri (string-append "https://www.python.org/ftp/python/" version
1132 "/Python-" version ".tar.xz"))
1133 (sha256
1134 (base32 "0wcanwlkfy91hhpsgx9b1vbdyywm5s40rlbm9ykcqg3q07s1zf9a"))
1135 (patches (search-patches "python-3-deterministic-build-info.patch"
1136 "python-3.13-fix-tests.patch"
1137 "python-3-hurd-configure.patch"))
1138 (modules '((guix build utils)))
1139 (snippet '(begin
1140 ;; Delete the bundled copy of libexpat.
1141 (delete-file-recursively "Modules/expat")
1142 (substitute* "Modules/Setup"
1143 ;; Link Expat instead of embedding the bundled one.
1144 (("^#pyexpat.*")
1145 "pyexpat pyexpat.c -lexpat\n"))
1146 ;; Delete windows binaries
1147 (for-each delete-file
1148 (find-files "Lib/distutils/command" "\\.exe$"))))))
1149 (outputs '("out" "tk" ;tkinter; adds 50 MiB to the closure
1150 "idle")) ;programming environment; weighs 5MB
1151 (build-system gnu-build-system)
1152 (arguments
1153 (list
1154 #:test-target "test"
1155 #:configure-flags
1156 #~(list "--enable-shared" ;allow embedding
1157 "--with-system-expat" ;for XML support
1158 "--with-system-ffi" ;build ctypes
1159 "--with-ensurepip=install" ;install pip and setuptools
1160 "--with-computed-gotos" ;main interpreter loop optimization
1161 "--enable-unicode=ucs4"
1162 "--without-static-libpython"
1163 "--enable-loadable-sqlite-extensions"
1164
1165 ;; FIXME: These flags makes Python significantly faster,
1166 ;; but leads to non-reproducible binaries.
1167 ;; "--with-lto" ;increase size by 20MB, but 15% speedup
1168 ;; "--enable-optimizations"
1169
1170 ;; Prevent the installed _sysconfigdata.py from retaining
1171 ;; a reference to coreutils.
1172 "INSTALL=install -c"
1173 "MKDIR_P=mkdir -p"
1174
1175 ;; Disable runtime check failing if cross-compiling, see:
1176 ;; https://lists.yoctoproject.org/pipermail/poky/2013-June/008997.html
1177 #$@(if (%current-target-system)
1178 #~("ac_cv_buggy_getaddrinfo=no"
1179 "ac_cv_file__dev_ptmx=no"
1180 "ac_cv_file__dev_ptc=no"
1181 (string-append "--with-build-python="
1182 #+(this-package-native-input "python")
1183 "/bin/python3"))
1184 #~())
1185 ;; -fno-semantic-interposition reinstates some
1186 ;; optimizations by gcc leading to around 15% speedup.
1187 ;; This is the default starting from python 3.10.
1188 "CFLAGS=-fno-semantic-interposition"
1189 (string-append "LDFLAGS=-Wl,-rpath="
1190 (assoc-ref %outputs "out")
1191 "/lib"
1192 " -fno-semantic-interposition"))
1193 ;; With no -j argument tests use all available cpus, so provide one.
1194 #:make-flags
1195 #~(list (string-append (format #f "TESTOPTS=-j~d"
1196 (parallel-job-count))
1197 ;; those tests fail on low-memory systems
1198 " --exclude"
1199 " test_mmap"
1200 " test_socket"
1201 " test_threading"
1202 " test_asyncio"
1203 " test_shutdown"
1204 #$@(if (target-ppc32?)
1205 #~(" test_ssl")
1206 #~())
1207 #$@(if (system-hurd?)
1208 #~(" test_posix" ;multiple errors
1209 " test_time"
1210 " test_pty"
1211 " test_shutil"
1212 " test_tempfile" ;chflags: invalid argument:
1213 ;; tbv14c9t/dir0/dir0/dir0/test0.txt
1214 " test_os" ;stty: 'standard input':
1215 ;; Inappropriate ioctl for device
1216 " test_openpty" ;No such file or directory
1217 " test_selectors" ;assertEqual(NUM_FDS // 2, len(fds))
1218 ;; 32752 != 4
1219 " test_compileall" ;multiple errors
1220 " test_poll" ;list index out of range
1221 " test_subprocess" ;runs over 10min
1222 " test_asyncore" ;multiple errors
1223 " test_threadsignals"
1224 " test_eintr" ;Process return code is -14
1225 " test_io" ;multiple errors
1226 " test_logging"
1227 " test_signal"
1228 " test_flags" ;ERROR
1229 " test_bidirectional_pty"
1230 " test_create_unix_connection"
1231 " test_unix_sock_client_ops"
1232 " test_open_unix_connection"
1233 " test_open_unix_connection_error"
1234 " test_read_pty_output"
1235 " test_write_pty"
1236 " test_concurrent_futures" ;freeze
1237 " test_venv" ;freeze
1238 " test_multiprocessing_forkserver" ;runs over 10min
1239 " test_multiprocessing_spawn" ;runs over 10min
1240 " test_glob" ;did not finish in 10h
1241 " test_site" ;Invalid argument
1242 " test_termios" ;os.openpty() Operation not permitted
1243 " test_tty" ;os.openpty() Operation not permitted
1244 " test_sqlite3" ;; sqlite3.OperationalError: database is locked
1245 " test_tarfile" ;; ELOOP vs ENAMETOOLONG
1246 " test_builtin"
1247 " test_capi"
1248 " test_dbm_ndbm"
1249 " test_exceptions"
1250 " test_faulthandler"
1251 " test_getopt"
1252 " test_importlib"
1253 " test_json"
1254 " test_multiprocessing_fork"
1255 " test_multiprocessing_main_handling"
1256 " test_pdb "
1257 " test_regrtest"
1258 " test_ssl" ;; Fails with openssl 3.5
1259 " test_sqlite")
1260 #~())
1261 #$@(if (system-hurd64?)
1262 #~(" test_largefile") ;; hangs
1263 #~())))
1264
1265 #:modules '((ice-9 ftw)
1266 (ice-9 match)
1267 (guix build utils)
1268 (guix build gnu-build-system))
1269
1270 #:phases
1271 #~(modify-phases %standard-phases
1272 #$@(common-python3-phases-edits)
1273 (add-after 'install 'install-sitecustomize.py
1274 #$(customize-site version)))))
1275 (inputs (list bzip2
1276 expat
1277 gdbm
1278 libffi ;for ctypes
1279 sqlite ;for sqlite extension
1280 openssl
1281 readline
1282 zlib
1283 tcl
1284 tk)) ;for tkinter
1285 (native-inputs `(("tzdata" ,tzdata-for-tests)
1286 ("unzip" ,unzip)
1287 ("zip" ,(@ (gnu packages compression) zip))
1288 ("pkg-config" ,pkg-config)
1289 ("sitecustomize.py" ,(local-file (search-auxiliary-file
1290 "python/sitecustomize.py")))
1291 ;; When cross-compiling, a native version of Python itself is needed.
1292 ,@(if (%current-target-system)
1293 `(("python" ,this-package)
1294 ("which" ,which))
1295 '())))
1296 (native-search-paths
1297 (list (guix-pythonpath-search-path version)
1298 ;; Used to locate tzdata by the zoneinfo module introduced in
1299 ;; Python 3.9.
1300 (search-path-specification
1301 (variable "PYTHONTZPATH")
1302 (files (list "share/zoneinfo")))))
1303 (home-page "https://www.python.org")
1304 (synopsis "High-level, dynamically-typed programming language")
1305 (description
1306 "Python is a remarkably powerful dynamic programming language that
1307is used in a wide variety of application domains. Some of its key
1308distinguishing features include: clear, readable syntax; strong
1309introspection capabilities; intuitive object orientation; natural
1310expression of procedural code; full modularity, supporting hierarchical
1311packages; exception-based error handling; and very high level dynamic
1312data types.")
1313 (properties '((cpe-name . "python")
1314 (cpe-vendor . "python")))
1315 (license license:psfl)))
1316
1124;; Next 3.x version. 1317;; Next 3.x version.
1125(define-public python-next python-3.12) 1318(define-public python-next python-3.12)
1126 1319