gnu: Add python-pyshp.
[jackhill/guix/guix.git] / gnu / packages / time.scm
CommitLineData
233e7676
LC
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
ac83dc82 3;;; Copyright © 2013, 2017, 2020 Ludovic Courtès <ludo@gnu.org>
33dc54b0 4;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
08d81afa 5;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
33dc54b0
RW
6;;; Copyright © 2015, 2017 Leo Famulari <leo@famulari.name>
7;;; Copyright © 2015, 2017 Cyril Roelandt <tipecaml@gmail.com>
8;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
9;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
10;;; Copyright © 2016 Danny Milosavljevic <dannym+a@scratchpost.org>
463e9835 11;;; Copyright © 2016, 2020 Marius Bakke <mbakke@fastmail.com>
626bc647 12;;; Copyright © 2016, 2017, 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
5d20e1ec 13;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
3c986a7d 14;;; Copyright © 2017 Nikita <nikita@n0.is>
33dc54b0 15;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
f8460d26 16;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
3ef29c00 17;;; Copyright © 2019 Kyle Meyer <kyle@kyleam.com>
0d5b7ea1 18;;; Copyright © 2019 Pierre Langlois <pierre.langlois@gmx.com>
0ab3a8c2 19;;; Copyright © 2020 Lars-Dominik Braun <ldb@leibniz-psychology.org>
e86ed845 20;;; Copyright © 2020 Tanguy Le Carrour <tanguy@bioneland.org>
efe7a174 21;;; Copyright © 2021 Ryan Prior <rprior@protonmail.com>
b147f59f 22;;;
233e7676 23;;; This file is part of GNU Guix.
b147f59f 24;;;
233e7676 25;;; GNU Guix is free software; you can redistribute it and/or modify it
b147f59f
NK
26;;; under the terms of the GNU General Public License as published by
27;;; the Free Software Foundation; either version 3 of the License, or (at
28;;; your option) any later version.
29;;;
233e7676 30;;; GNU Guix is distributed in the hope that it will be useful, but
b147f59f
NK
31;;; WITHOUT ANY WARRANTY; without even the implied warranty of
32;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33;;; GNU General Public License for more details.
34;;;
35;;; You should have received a copy of the GNU General Public License
233e7676 36;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
b147f59f 37
1ffa7090 38(define-module (gnu packages time)
ac257f12 39 #:use-module (gnu packages check)
33dc54b0 40 #:use-module (gnu packages compression)
efe7a174 41 #:use-module (gnu packages golang)
3ef29c00 42 #:use-module (gnu packages perl)
44d10b1f 43 #:use-module (gnu packages python)
efe7a174
RPG
44 #:use-module (gnu packages python-xyz)
45 #:use-module (gnu packages terminals)
46 #:use-module (gnu packages textutils)
47 #:use-module (gnu packages)
48 #:use-module (guix build-system gnu)
49 #:use-module (guix build-system go)
50 #:use-module (guix build-system python)
51 #:use-module (guix download)
52 #:use-module (guix git-download)
53 #:use-module (guix licenses)
54 #:use-module (guix packages))
b147f59f
NK
55
56(define-public time
57 (package
58 (name "time")
64f925cb 59 (version "1.9")
b147f59f
NK
60 (source
61 (origin
62 (method url-fetch)
63 (uri (string-append "mirror://gnu/time/time-"
64 version ".tar.gz"))
65 (sha256
66 (base32
64f925cb 67 "07jj7cz6lc13iqrpgn81ivqh8rkm73p4rnivwgrrshk23v4g1b7v"))))
b147f59f 68 (build-system gnu-build-system)
6fd52309 69 (home-page "https://www.gnu.org/software/time/")
f50d2669 70 (synopsis "Run a command, then display its resource usage")
b147f59f 71 (description
a22dc0c4
LC
72 "Time is a command that displays information about the resources that a
73program uses. The display output of the program can be customized or saved
74to a file.")
c8b38f8e 75 (license gpl3+)))
5d20e1ec 76
0d5b7ea1
PL
77(define-public python-pytimeparse
78 (package
79 (name "python-pytimeparse")
80 (version "1.1.8")
81 (source
82 (origin
83 (method url-fetch)
84 (uri (pypi-uri "pytimeparse" version))
85 (sha256
86 (base32
87 "02kaambsgpjx3zi42j6l11rwms2p35b9hsk4f3kdf979gd3kcqg8"))))
88 (native-inputs
89 `(("python-nose" ,python-nose)))
90 (build-system python-build-system)
91 (home-page "https://github.com/wroberts/pytimeparse")
92 (synopsis "Time expression parser")
93 (description "This small Python module parses various kinds of time
94expressions.")
95 (license expat)))
96
5d20e1ec
BW
97(define-public python-pytzdata
98 (package
99 (name "python-pytzdata")
b05edb8c 100 (version "2020.1")
5d20e1ec
BW
101 (source
102 (origin
103 (method url-fetch)
104 (uri (pypi-uri "pytzdata" version))
105 (sha256
106 (base32
b05edb8c 107 "0h0md0ldhb8ghlwjslkzh3wcj4fxg3n43bj5sghqs2m06nri7yiy"))))
5d20e1ec 108 (build-system python-build-system)
463e9835
MB
109 ;; XXX: The PyPI distribution contains no tests, and the upstream
110 ;; repository lacks a setup.py! How to build from git?
111 (arguments '(#:tests? #f))
112 (propagated-inputs
113 `(("python-cleo" ,python-cleo)))
5d20e1ec
BW
114 (home-page "https://github.com/sdispater/pytzdata")
115 (synopsis "Timezone database for Python")
116 (description
117 "This library provides a timezone database for Python.")
118 (license expat)))
119
120(define-public python2-tzdata
121 (package-with-python2 python-pytzdata))
89c3eaaa 122
33dc54b0
RW
123(define-public python-pytz
124 (package
125 (name "python-pytz")
e8337f1e
LF
126 ;; This package should be kept in sync with tzdata in (gnu packages base).
127 (version "2021.1")
33dc54b0
RW
128 (source
129 (origin
130 (method url-fetch)
4c97f959 131 (uri (pypi-uri "pytz" version))
33dc54b0
RW
132 (sha256
133 (base32
e8337f1e 134 "1nn459q7zg20n75akxl3ljkykgw1ydc8nb05rx1y4f5zjh4ak943"))))
33dc54b0 135 (build-system python-build-system)
33dc54b0
RW
136 (home-page "http://pythonhosted.org/pytz")
137 (synopsis "Python timezone library")
138 (description "This library brings the Olson tz database into Python. It
139allows accurate and cross platform timezone calculations using Python 2.4 or
140higher. It also solves the issue of ambiguous times at the end of daylight
141saving time. Almost all of the Olson timezones are supported.")
142 (license expat)))
143
144(define-public python2-pytz
145 (package-with-python2 python-pytz))
146
89c3eaaa
BW
147(define-public python-pendulum
148 (package
149 (name "python-pendulum")
5e7fa528 150 (version "2.1.2")
89c3eaaa
BW
151 (source
152 (origin
153 (method url-fetch)
154 (uri (pypi-uri "pendulum" version))
155 (sha256
5e7fa528 156 (base32 "01zjc245w08j0xryrgrq9vng59q1cl5ry0hcpw5rj774pyhhqsmh"))))
89c3eaaa 157 (build-system python-build-system)
e5023bfd
MB
158 ;; XXX: The PyPI distribution lacks tests, and the upstream repository
159 ;; lacks a setup.py!
160 (arguments '(#:tests? #f))
89c3eaaa
BW
161 (propagated-inputs
162 `(("python-dateutil" ,python-dateutil)
e5023bfd 163 ("python-pytzdata" ,python-pytzdata)))
89c3eaaa
BW
164 (home-page "https://github.com/sdispater/pendulum")
165 (synopsis "Alternate API for Python datetimes")
166 (description "Pendulum is a drop-in replacement for the standard
167@{datetime} class, providing an alternative API. As it inherits from the
168standard @code{datetime} all @code{datetime} instances can be replaced by
169Pendulum instances.")
170 (license expat)))
171
33dc54b0
RW
172(define-public python-dateutil
173 (package
174 (name "python-dateutil")
4255efda 175 (version "2.8.1")
33dc54b0
RW
176 (source
177 (origin
178 (method url-fetch)
179 (uri (pypi-uri "python-dateutil" version))
180 (sha256
181 (base32
4255efda 182 "0g42w7k5007iv9dam6gnja2ry8ydwirh99mgdll35s12pyfzxsvk"))))
33dc54b0 183 (build-system python-build-system)
de92ab21
MB
184 (arguments
185 `(#:phases (modify-phases %standard-phases
186 (replace 'check
187 (lambda _
188 ;; Delete tests that depend on "freezegun" to avoid a
189 ;; circular dependency.
190 (delete-file "dateutil/test/test_utils.py")
191 (delete-file "dateutil/test/test_rrule.py")
192
193 ;; XXX: Fails to get timezone from /etc/localtime.
194 (delete-file "dateutil/test/test_tz.py")
195
196 (invoke "pytest" "-vv"))))))
e30fc546 197 (native-inputs
de92ab21 198 `(("python-pytest" ,python-pytest)
40d97db7 199 ("python-pytest-cov" ,python-pytest-cov)
de92ab21 200 ("python-setuptools-scm" ,python-setuptools-scm)))
33dc54b0
RW
201 (propagated-inputs
202 `(("python-six" ,python-six)))
203 (home-page "https://dateutil.readthedocs.io/en/stable/")
204 (synopsis "Extensions to the standard datetime module")
205 (description
206 "The dateutil module provides powerful extensions to the standard
207datetime module, available in Python 2.3+.")
e30fc546
MB
208 ;; The license was changed from the three-clause BSD license to a dual
209 ;; Apache 2.0/BSD-3 variant at 2017-12-01. Some code is only available as
210 ;; BSD-3 still; but all new code is dual licensed (the user can choose).
211 (license (list bsd-3 asl2.0))))
33dc54b0
RW
212
213(define-public python2-dateutil
214 (package-with-python2 python-dateutil))
215
216(define-public python-parsedatetime
217 (package
218 (name "python-parsedatetime")
219 (version "2.4")
220 (source
221 (origin
222 (method url-fetch)
223 (uri (pypi-uri "parsedatetime" version))
224 (sha256
225 (base32
226 "0jxqkjks7z9dn222cqgvskp4wr6d92aglinxq7pd2w4mzdc7r09x"))))
227 (build-system python-build-system)
228 (native-inputs
229 `(("python-nose" ,python-nose)
230 ("python-pyicu" ,python-pyicu)
231 ("python-pytest" ,python-pytest)
232 ("python-pytest-runner" ,python-pytest-runner)))
233 (propagated-inputs
234 `(("python-future" ,python-future)))
235 (home-page "https://github.com/bear/parsedatetime/")
236 (synopsis "Parse human-readable date/time text")
237 (description
238 "Parse human-readable date/time text.")
239 (license asl2.0)))
240
241(define-public python2-parsedatetime
242 (package-with-python2 python-parsedatetime))
243
0ab3a8c2
LDB
244(define-public python-ciso8601
245 (package
246 (name "python-ciso8601")
247 (version "2.1.3")
248 (source
249 (origin
250 (method git-fetch)
251 ;; The PyPi distribution doesn't include the tests.
252 (uri (git-reference
b0e7b699 253 (url "https://github.com/closeio/ciso8601")
0ab3a8c2
LDB
254 (commit (string-append "v" version))))
255 (file-name (git-file-name name version))
256 (sha256
257 (base32
258 "0g1aiyc1ayh0rnibyy416m5mmck38ksgdm3jsy0z3rxgmgb24951"))))
259 (build-system python-build-system)
260 ;; Pytz should only be required for Python 2, but the test suite fails
261 ;; without it.
262 (native-inputs
263 `(("python-pytz" ,python-pytz)))
264 (home-page "https://github.com/closeio/ciso8601")
265 (synopsis
266 "Fast ISO8601 date time parser")
267 (description
268 "The package ciso8601 converts ISO 8601 or RFC 3339 date time strings into
269Python datetime objects.")
270 (license expat)))
271
33dc54b0
RW
272(define-public python-tzlocal
273 (package
274 (name "python-tzlocal")
8af48c14 275 (version "2.1")
33dc54b0
RW
276 (source
277 (origin
278 (method url-fetch)
279 (uri (pypi-uri "tzlocal" version))
280 (sha256
281 (base32
8af48c14 282 "0i1fm4sl04y65qnaqki0w75j34w863gxjj8ag0vwgvaa572rfg34"))))
33dc54b0 283 (build-system python-build-system)
d1e75921
EF
284 (arguments
285 `(#:phases
286 (modify-phases %standard-phases
287 (add-before 'check 'fix-symlink-test
288 ;; see: https://github.com/regebro/tzlocal/issues/53
289 (lambda _
8af48c14 290 (delete-file "tests/test_data/symlink_localtime/etc/localtime")
d1e75921 291 (symlink "../usr/share/zoneinfo/Africa/Harare"
8af48c14
EF
292 "tests/test_data/symlink_localtime/etc/localtime")
293 ;; And skip the test_fail test, it is known to fail
294 (substitute* "tests/tests.py"
295 (("def test_fail") "def _test_fail"))
d1e75921 296 #t)))))
33dc54b0
RW
297 (propagated-inputs
298 `(("python-pytz" ,python-pytz)))
d1e75921
EF
299 (native-inputs
300 `(("python-mock" ,python-mock)))
33dc54b0
RW
301 (home-page "https://github.com/regebro/tzlocal")
302 (synopsis "Local timezone information for Python")
303 (description
304 "Tzlocal returns a tzinfo object with the local timezone information.
305This module attempts to fix a glaring hole in pytz, that there is no way to
306get the local timezone information, unless you know the zoneinfo name, and
307under several distributions that's hard or impossible to figure out.")
d1e75921 308 (license expat)))
33dc54b0
RW
309
310(define-public python-isodate
311 (package
312 (name "python-isodate")
e4be1faa 313 (version "0.6.0")
33dc54b0
RW
314 (source
315 (origin
316 (method url-fetch)
317 (uri (pypi-uri "isodate" version))
318 (sha256
319 (base32
e4be1faa 320 "1n7jkz68kk5pwni540pr5zdh99bf6ywydk1p5pdrqisrawylldif"))))
33dc54b0 321 (build-system python-build-system)
e4be1faa
EF
322 (native-inputs
323 `(("python-six" ,python-six)))
324 (home-page "https://github.com/gweis/isodate/")
33dc54b0
RW
325 (synopsis "Python date parser and formatter")
326 (description
327 "Python-isodate is a python module for parsing and formatting
328ISO 8601 dates, time and duration.")
329 (license bsd-3)))
330
331(define-public python2-isodate
332 (package-with-python2 python-isodate))
333
334(define-public python-iso8601
335 (package
336 (name "python-iso8601")
5f321292 337 (version "0.1.13")
33dc54b0
RW
338 (source
339 (origin
340 (method url-fetch)
341 (uri (pypi-uri "iso8601" version))
342 (sha256
343 (base32
5f321292 344 "1cgfj91khil4ii5gb8s6nxwm73vx7hqc2k79dd9d8990ylmc5ppp"))))
33dc54b0 345 (build-system python-build-system)
5f321292
MB
346 (arguments
347 '(#:phases (modify-phases %standard-phases
348 (replace 'check
349 (lambda _
350 (invoke "pytest" "-vv" "iso8601"))))))
33dc54b0
RW
351 (native-inputs
352 `(("python-pytest" ,python-pytest)))
353 (home-page "https://bitbucket.org/micktwomey/pyiso8601")
354 (synopsis "Module to parse ISO 8601 dates")
355 (description
356 "This module parses the most common forms of ISO 8601 date strings (e.g.
357@code{2007-01-14T20:34:22+00:00}) into @code{datetime} objects.")
358 (license expat)))
359
360(define-public python2-iso8601
361 (package-with-python2 python-iso8601))
362
363(define-public python-monotonic
364 (package
365 (name "python-monotonic")
33fdde8d 366 (version "1.5")
33dc54b0
RW
367 (source
368 (origin
369 (method url-fetch)
db3e631d 370 (uri (pypi-uri "monotonic" version))
33dc54b0
RW
371 (sha256
372 (base32
33fdde8d 373 "1c6z46yb600klbfhqadyl7vq0jdjdxkm72k43ra3iw3d0xakv593"))))
33dc54b0 374 (build-system python-build-system)
33fdde8d 375 (arguments '(#:tests? #f)) ; no tests
33dc54b0
RW
376 (home-page "https://github.com/atdt/monotonic")
377 (synopsis "Implementation of time.monotonic() for Python 2 & < 3.3")
378 (description
379 "This module provides a @code{monotonic()} function which returns the
380value (in fractional seconds) of a clock which never goes backwards.")
381 (license asl2.0)))
382
383(define-public python2-monotonic
384 (package-with-python2 python-monotonic))
385
386(define-public python-pyrfc3339
387 (package
388 (name "python-pyrfc3339")
0ce92d74 389 (version "1.1")
33dc54b0
RW
390 (source
391 (origin
392 (method url-fetch)
393 (uri (pypi-uri "pyRFC3339" version))
394 (sha256
395 (base32
0ce92d74 396 "06jv7ar7lpvvk0dixzwdr3wgm0g1lipxs429s2z7knwwa7hwpf41"))))
33dc54b0
RW
397 (build-system python-build-system)
398 (propagated-inputs
399 `(("python-pytz" ,python-pytz)))
400 (native-inputs
401 `(("python-nose" ,python-nose)))
402 (home-page "https://github.com/kurtraschke/pyRFC3339")
403 (synopsis "Python timestamp library")
404 (description "Python library for generating and parsing RFC 3339-compliant
405timestamps.")
406 (license expat)))
407
408(define-public python2-pyrfc3339
409 (package-with-python2 python-pyrfc3339))
410
411(define-public python-arrow
412 (package
413 (name "python-arrow")
e86ed845 414 (version "0.17.0")
33dc54b0
RW
415 (source (origin
416 (method url-fetch)
417 (uri (pypi-uri "arrow" version))
418 (sha256
419 (base32
e86ed845 420 "1m3fpz96w3g08i9x9cpqh3cr795y9zbj1bfnay3ccdhxv86d227z"))))
33dc54b0 421 (build-system python-build-system)
e86ed845
TLC
422 (arguments
423 `(#:phases
424 (modify-phases %standard-phases
425 (replace 'check
426 (lambda _
08d81afa
EF
427 (invoke "pytest" "-vv" "tests"
428 ;; python-dateutil doesn't recognize America/Nuuk.
429 ;; Remove when python-dateutil > 2.8.1.
430 "-k" "not test_parse_tz_name_zzz"))))))
33dc54b0
RW
431 (native-inputs
432 `(;; For testing
433 ("python-chai" ,python-chai)
e86ed845
TLC
434 ("python-pytest" ,python-pytest)
435 ("python-pytest-cov" ,python-pytest-cov)
436 ("python-pytest-mock" ,python-pytest-mock)
33dc54b0
RW
437 ("python-simplejson" ,python-simplejson)))
438 (propagated-inputs
e86ed845
TLC
439 `(("python-dateutil" ,python-dateutil)
440 ("python-pytz" ,python-pytz)))
441 (home-page "https://github.com/arrow-py/arrow")
33dc54b0
RW
442 (synopsis "Dates and times for Python")
443 (description
444 "Arrow is a Python library to creating, manipulating, formatting and
445converting dates, times, and timestamps. It implements and updates the
446datetime type.")
447 (license asl2.0)))
448
33dc54b0
RW
449(define-public python-aniso8601
450 (package
451 (name "python-aniso8601")
452 (version "1.3.0")
453 (source
454 (origin
455 (method url-fetch)
456 (uri (pypi-uri "aniso8601" version))
457 (sha256
458 (base32
459 "1waj54iv3n3lw1fapbz8a93yjgrybgpc86wif5baxdh1arpj9df3"))))
460 (build-system python-build-system)
461 (propagated-inputs
462 `(("python-dateutil" ,python-dateutil)))
463 (home-page "https://bitbucket.org/nielsenb/aniso8601")
464 (synopsis "Python library for parsing ISO 8601 strings")
465 (description
466 "This package contains a library for parsing ISO 8601 datetime strings.")
467 (license bsd-3)))
468
469(define-public python2-aniso8601
470 (package-with-python2 python-aniso8601))
3ef29c00
KM
471
472(define-public datefudge
473 (package
474 (name "datefudge")
69dc3e52 475 (version "1.23")
3ef29c00 476 (source (origin
ac83dc82
LC
477 ;; Source code is available from
478 ;; <https://salsa.debian.org/debian/datefudge.git>. However,
479 ;; for bootstrapping reasons, we do not rely on 'git-fetch' here
480 ;; (since Git -> GnuTLS -> datefudge).
481 (method url-fetch)
482 (uri (string-append
483 "mirror://debian/pool/main/d/datefudge/datefudge_"
484 version ".tar.xz"))
3ef29c00
KM
485 (sha256
486 (base32
ac83dc82 487 "0ifnlb0mc8qc2kb5042pbz0ns6rwcb7201di8wyrsphl0yhnhxiv"))
eb07edab 488 (patches (search-patches "datefudge-gettimeofday.patch"))))
3ef29c00
KM
489 (build-system gnu-build-system)
490 (arguments
491 `(#:test-target "test"
492 #:make-flags (list "CC=gcc"
493 (string-append "prefix=" (assoc-ref %outputs "out")))
494 #:phases
495 (modify-phases %standard-phases
496 (add-after 'unpack 'patch-makefile
497 (lambda _
498 (substitute* "Makefile"
499 ((" -o root -g root") "")
500 (("VERSION := \\$\\(shell dpkg-parsechangelog .*")
501 (string-append "VERSION = " ,version)))
502 #t))
503 (delete 'configure))))
504 (native-inputs
505 `(("perl" ,perl)))
506 (home-page "https://salsa.debian.org/debian/datefudge")
507 (synopsis "Pretend the system date is different")
508 (description
509 "Utility that fakes the system time by pre-loading a small library that
510modifies the @code{time}, @code{gettimeofday} and @code{clock_gettime} system
511calls.")
512 (license gpl2)))
efe7a174
RPG
513
514(define-public countdown
515 (package
516 (name "countdown")
517 (version "1.0.0")
518 (source
519 (origin
520 (method git-fetch)
521 (uri (git-reference
522 (url "https://github.com/antonmedv/countdown")
523 (commit (string-append "v" version))))
524 (file-name (git-file-name name version))
525 (sha256
526 (base32 "0pdaw1krr0bsl4amhwx03v2b02iznvwvqn7af5zp4fkzjaj14cdw"))))
527 (build-system go-build-system)
528 (arguments
529 '(#:import-path "github.com/antonmedv/countdown"))
530 (native-inputs
531 `(("runewidth" ,go-github.com-mattn-go-runewidth)
532 ("termbox" ,go-github.com-nsf-termbox-go)))
533 (home-page "https://github.com/antonmedv/countdown")
534 (synopsis "Counts to zero with a text user interface")
535 (description
536 "Countdown provides a fancy text display while it counts down to zero
537from a starting point you provide. The user can pause and resume the
538countdown from the text user interface.")
539 (license expat)))