pyodide 0.23.3 → 0.24.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ffi.d.ts CHANGED
@@ -1,32 +1,5 @@
1
- // Generated by dts-bundle-generator v6.7.0
1
+ // Generated by dts-bundle-generator v6.13.0
2
2
 
3
- declare type PyProxyCache = {
4
- cacheId: number;
5
- refcnt: number;
6
- leaked?: boolean;
7
- };
8
- declare type PyProxyProps = {
9
- /**
10
- * captureThis tracks whether this should be passed as the first argument to
11
- * the Python function or not. We keep it false by default. To make a PyProxy
12
- * where the ``this`` argument is included, call the :js:meth:`captureThis` method.
13
- */
14
- captureThis: boolean;
15
- /**
16
- * isBound tracks whether bind has been called
17
- */
18
- isBound: boolean;
19
- /**
20
- * the ``this`` value that has been bound to the PyProxy
21
- */
22
- boundThis?: any;
23
- /**
24
- * Any extra arguments passed to bind are used for partial function
25
- * application. These are stored here.
26
- */
27
- boundArgs: any[];
28
- roundtrip: boolean;
29
- };
30
3
  interface PyProxy {
31
4
  [x: string]: any;
32
5
  }
@@ -35,16 +8,10 @@ interface PyProxy {
35
8
  * JavaScript. See :ref:`type-translations-pyproxy`.
36
9
  */
37
10
  declare class PyProxy {
38
- /** @private */
39
- $$: {
40
- ptr: number;
41
- cache: PyProxyCache;
42
- destroyed_msg?: string;
43
- };
44
- /** @private */
45
- $$props: PyProxyProps;
46
11
  /** @private */
47
12
  $$flags: number;
13
+ /** @private */
14
+ static [Symbol.hasInstance](obj: any): obj is PyProxy;
48
15
  /**
49
16
  * @private
50
17
  * @hideconstructor
@@ -446,6 +413,270 @@ declare class PyAsyncGeneratorMethods {
446
413
  */
447
414
  return(v: any): Promise<IteratorResult<any, any>>;
448
415
  }
416
+ declare class PySequence extends PyProxy {
417
+ /** @private */
418
+ static [Symbol.hasInstance](obj: any): obj is PyProxy;
419
+ }
420
+ interface PySequence extends PySequenceMethods {
421
+ }
422
+ declare class PySequenceMethods {
423
+ get [Symbol.isConcatSpreadable](): boolean;
424
+ /**
425
+ * See :js:meth:`Array.join`. The :js:meth:`Array.join` method creates and
426
+ * returns a new string by concatenating all of the elements in the
427
+ * :py:class:`~collections.abc.Sequence`.
428
+ *
429
+ * @param separator A string to separate each pair of adjacent elements of the
430
+ * Sequence.
431
+ *
432
+ * @returns A string with all Sequence elements joined.
433
+ */
434
+ join(separator?: string): string;
435
+ /**
436
+ * See :js:meth:`Array.slice`. The :js:meth:`Array.slice` method returns a
437
+ * shallow copy of a portion of a :py:class:`~collections.abc.Sequence` into a
438
+ * new array object selected from ``start`` to ``stop`` (`stop` not included)
439
+ * @param start Zero-based index at which to start extraction. Negative index
440
+ * counts back from the end of the Sequence.
441
+ * @param stop Zero-based index at which to end extraction. Negative index
442
+ * counts back from the end of the Sequence.
443
+ * @returns A new array containing the extracted elements.
444
+ */
445
+ slice(start?: number, stop?: number): any;
446
+ /**
447
+ * See :js:meth:`Array.lastIndexOf`. Returns the last index at which a given
448
+ * element can be found in the Sequence, or -1 if it is not present.
449
+ * @param elt Element to locate in the Sequence.
450
+ * @param fromIndex Zero-based index at which to start searching backwards,
451
+ * converted to an integer. Negative index counts back from the end of the
452
+ * Sequence.
453
+ * @returns The last index of the element in the Sequence; -1 if not found.
454
+ */
455
+ lastIndexOf(elt: any, fromIndex?: number): number;
456
+ /**
457
+ * See :js:meth:`Array.indexOf`. Returns the first index at which a given
458
+ * element can be found in the Sequence, or -1 if it is not present.
459
+ * @param elt Element to locate in the Sequence.
460
+ * @param fromIndex Zero-based index at which to start searching, converted to
461
+ * an integer. Negative index counts back from the end of the Sequence.
462
+ * @returns The first index of the element in the Sequence; -1 if not found.
463
+ */
464
+ indexOf(elt: any, fromIndex?: number): number;
465
+ /**
466
+ * See :js:meth:`Array.forEach`. Executes a provided function once for each
467
+ * ``Sequence`` element.
468
+ * @param callbackfn A function to execute for each element in the ``Sequence``. Its
469
+ * return value is discarded.
470
+ * @param thisArg A value to use as ``this`` when executing ``callbackFn``.
471
+ */
472
+ forEach(callbackfn: (elt: any) => void, thisArg?: any): void;
473
+ /**
474
+ * See :js:meth:`Array.map`. Creates a new array populated with the results of
475
+ * calling a provided function on every element in the calling ``Sequence``.
476
+ * @param callbackfn A function to execute for each element in the ``Sequence``. Its
477
+ * return value is added as a single element in the new array.
478
+ * @param thisArg A value to use as ``this`` when executing ``callbackFn``.
479
+ */
480
+ map(callbackfn: (elt: any, index: number, array: any) => void, thisArg?: any): unknown[];
481
+ /**
482
+ * See :js:meth:`Array.filter`. Creates a shallow copy of a portion of a given
483
+ * ``Sequence``, filtered down to just the elements from the given array that pass
484
+ * the test implemented by the provided function.
485
+ * @param callbackfn A function to execute for each element in the array. It
486
+ * should return a truthy value to keep the element in the resulting array,
487
+ * and a falsy value otherwise.
488
+ * @param thisArg A value to use as ``this`` when executing ``predicate``.
489
+ */
490
+ filter(predicate: (elt: any, index: number, array: any) => boolean, thisArg?: any): any[];
491
+ /**
492
+ * See :js:meth:`Array.some`. Tests whether at least one element in the
493
+ * ``Sequence`` passes the test implemented by the provided function.
494
+ * @param callbackfn A function to execute for each element in the
495
+ * ``Sequence``. It should return a truthy value to indicate the element
496
+ * passes the test, and a falsy value otherwise.
497
+ * @param thisArg A value to use as ``this`` when executing ``predicate``.
498
+ */
499
+ some(predicate: (value: any, index: number, array: any[]) => unknown, thisArg?: any): boolean;
500
+ /**
501
+ * See :js:meth:`Array.every`. Tests whether every element in the ``Sequence``
502
+ * passes the test implemented by the provided function.
503
+ * @param callbackfn A function to execute for each element in the
504
+ * ``Sequence``. It should return a truthy value to indicate the element
505
+ * passes the test, and a falsy value otherwise.
506
+ * @param thisArg A value to use as ``this`` when executing ``predicate``.
507
+ */
508
+ every(predicate: (value: any, index: number, array: any[]) => unknown, thisArg?: any): boolean;
509
+ /**
510
+ * See :js:meth:`Array.reduce`. Executes a user-supplied "reducer" callback
511
+ * function on each element of the Sequence, in order, passing in the return
512
+ * value from the calculation on the preceding element. The final result of
513
+ * running the reducer across all elements of the Sequence is a single value.
514
+ * @param callbackfn A function to execute for each element in the ``Sequence``. Its
515
+ * return value is discarded.
516
+ * @param thisArg A value to use as ``this`` when executing ``callbackfn``.
517
+ */
518
+ reduce(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any) => any, initialValue?: any): any;
519
+ /**
520
+ * See :js:meth:`Array.reduceRight`. Applies a function against an accumulator
521
+ * and each value of the Sequence (from right to left) to reduce it to a
522
+ * single value.
523
+ * @param callbackfn A function to execute for each element in the Sequence.
524
+ * Its return value is discarded.
525
+ * @param thisArg A value to use as ``this`` when executing ``callbackFn``.
526
+ */
527
+ reduceRight(callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any) => any, initialValue: any): any;
528
+ /**
529
+ * See :js:meth:`Array.at`. Takes an integer value and returns the item at
530
+ * that index.
531
+ * @param index Zero-based index of the Sequence element to be returned,
532
+ * converted to an integer. Negative index counts back from the end of the
533
+ * Sequence.
534
+ * @returns The element in the Sequence matching the given index.
535
+ */
536
+ at(index: number): any;
537
+ /**
538
+ * The :js:meth:`Array.concat` method is used to merge two or more arrays.
539
+ * This method does not change the existing arrays, but instead returns a new
540
+ * array.
541
+ * @param rest Arrays and/or values to concatenate into a new array.
542
+ * @returns A new Array instance.
543
+ */
544
+ concat(...rest: ConcatArray<any>[]): any[];
545
+ /**
546
+ * The :js:meth:`Array.includes` method determines whether a Sequence
547
+ * includes a certain value among its entries, returning true or false as
548
+ * appropriate.
549
+ * @param elt
550
+ * @returns
551
+ */
552
+ includes(elt: any): any;
553
+ /**
554
+ * The :js:meth:`Array.entries` method returns a new iterator object that
555
+ * contains the key/value pairs for each index in the ``Sequence``.
556
+ * @returns A new iterator object.
557
+ */
558
+ entries(): IterableIterator<[
559
+ number,
560
+ any
561
+ ]>;
562
+ /**
563
+ * The :js:meth:`Array.keys` method returns a new iterator object that
564
+ * contains the keys for each index in the ``Sequence``.
565
+ * @returns A new iterator object.
566
+ */
567
+ keys(): IterableIterator<number>;
568
+ /**
569
+ * The :js:meth:`Array.values` method returns a new iterator object that
570
+ * contains the values for each index in the ``Sequence``.
571
+ * @returns A new iterator object.
572
+ */
573
+ values(): IterableIterator<any>;
574
+ /**
575
+ * The :js:meth:`Array.find` method returns the first element in the provided
576
+ * array that satisfies the provided testing function.
577
+ * @param predicate A function to execute for each element in the
578
+ * ``Sequence``. It should return a truthy value to indicate a matching
579
+ * element has been found, and a falsy value otherwise.
580
+ * @param thisArg A value to use as ``this`` when executing ``predicate``.
581
+ * @returns The first element in the ``Sequence`` that satisfies the provided
582
+ * testing function.
583
+ */
584
+ find(predicate: (value: any, index: number, obj: any[]) => any, thisArg?: any): any;
585
+ /**
586
+ * The :js:meth:`Array.findIndex` method returns the index of the first
587
+ * element in the provided array that satisfies the provided testing function.
588
+ * @param predicate A function to execute for each element in the
589
+ * ``Sequence``. It should return a truthy value to indicate a matching
590
+ * element has been found, and a falsy value otherwise.
591
+ * @param thisArg A value to use as ``this`` when executing ``predicate``.
592
+ * @returns The index of the first element in the ``Sequence`` that satisfies
593
+ * the provided testing function.
594
+ */
595
+ findIndex(predicate: (value: any, index: number, obj: any[]) => any, thisArg?: any): number;
596
+ }
597
+ declare class PyMutableSequence extends PyProxy {
598
+ /** @private */
599
+ static [Symbol.hasInstance](obj: any): obj is PyProxy;
600
+ }
601
+ interface PyMutableSequence extends PyMutableSequenceMethods {
602
+ }
603
+ declare class PyMutableSequenceMethods {
604
+ /**
605
+ * The :js:meth:`Array.reverse` method reverses a ``MutableSequence`` in
606
+ * place.
607
+ * @returns A reference to the same ``MutableSequence``
608
+ */
609
+ reverse(): this;
610
+ /**
611
+ * The :js:meth:`Array.sort` method sorts the elements of a
612
+ * ``MutableSequence`` in place.
613
+ * @param compareFn A function that defines the sort order.
614
+ * @returns A reference to the same ``MutableSequence``
615
+ */
616
+ sort(compareFn?: (a: any, b: any) => number): this;
617
+ /**
618
+ * The :js:meth:`Array.splice` method changes the contents of a
619
+ * ``MutableSequence`` by removing or replacing existing elements and/or
620
+ * adding new elements in place.
621
+ * @param start Zero-based index at which to start changing the
622
+ * ``MutableSequence``.
623
+ * @param deleteCount An integer indicating the number of elements in the
624
+ * ``MutableSequence`` to remove from ``start``.
625
+ * @param items The elements to add to the ``MutableSequence``, beginning from
626
+ * ``start``.
627
+ * @returns An array containing the deleted elements.
628
+ */
629
+ splice(start: number, deleteCount?: number, ...items: any[]): void;
630
+ /**
631
+ * The :js:meth:`Array.push` method adds the specified elements to the end of
632
+ * a ``MutableSequence``.
633
+ * @param elts The element(s) to add to the end of the ``MutableSequence``.
634
+ * @returns The new length property of the object upon which the method was
635
+ * called.
636
+ */
637
+ push(...elts: any[]): any;
638
+ /**
639
+ * The :js:meth:`Array.pop` method removes the last element from a
640
+ * ``MutableSequence``.
641
+ * @returns The removed element from the ``MutableSequence``; undefined if the
642
+ * ``MutableSequence`` is empty.
643
+ */
644
+ pop(): void;
645
+ /**
646
+ * The :js:meth:`Array.shift` method removes the first element from a
647
+ * ``MutableSequence``.
648
+ * @returns The removed element from the ``MutableSequence``; undefined if the
649
+ * ``MutableSequence`` is empty.
650
+ */
651
+ shift(): void;
652
+ /**
653
+ * The :js:meth:`Array.unshift` method adds the specified elements to the
654
+ * beginning of a ``MutableSequence``.
655
+ * @param elts The elements to add to the front of the ``MutableSequence``.
656
+ * @returns The new length of the ``MutableSequence``.
657
+ */
658
+ unshift(...elts: any[]): any;
659
+ /**
660
+ * The :js:meth:`Array.copyWithin` method shallow copies part of a
661
+ * ``MutableSequence`` to another location in the same ``MutableSequence``
662
+ * without modifying its length.
663
+ * @param target Zero-based index at which to copy the sequence to.
664
+ * @param start Zero-based index at which to start copying elements from.
665
+ * @param end Zero-based index at which to end copying elements from.
666
+ * @returns The modified ``MutableSequence``.
667
+ */
668
+ copyWithin(target: number, start?: number, end?: number): any;
669
+ /**
670
+ * The :js:meth:`Array.fill` method changes all elements in an array to a
671
+ * static value, from a start index to an end index.
672
+ * @param value Value to fill the array with.
673
+ * @param start Zero-based index at which to start filling. Default 0.
674
+ * @param end Zero-based index at which to end filling. Default
675
+ * ``list.length``.
676
+ * @returns
677
+ */
678
+ fill(value: any, start?: number, end?: number): any;
679
+ }
449
680
  /**
450
681
  * A :js:class:`~pyodide.ffi.PyProxy` whose proxied Python object is :ref:`awaitable
451
682
  * <asyncio-awaitables>` (i.e., has an :meth:`~object.__await__` method).
@@ -801,6 +1032,8 @@ declare const ffi: {
801
1032
  PyBuffer: typeof PyBuffer;
802
1033
  PyBufferView: typeof PyBufferView;
803
1034
  PythonError: typeof PythonError;
1035
+ PySequence: typeof PySequence;
1036
+ PyMutableSequence: typeof PyMutableSequence;
804
1037
  };
805
1038
 
806
1039
  export type {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyodide",
3
- "version": "0.23.3",
3
+ "version": "0.24.0-alpha.1",
4
4
  "description": "The Pyodide JavaScript package",
5
5
  "keywords": [
6
6
  "python",
@@ -16,29 +16,23 @@
16
16
  },
17
17
  "license": "Apache-2.0",
18
18
  "devDependencies": {
19
- "@rollup/plugin-commonjs": "^21.0.1",
20
- "@rollup/plugin-node-resolve": "^13.1.3",
21
19
  "@types/assert": "^1.5.6",
22
20
  "@types/emscripten": "^1.39.5",
23
21
  "@types/expect": "^24.3.0",
24
22
  "@types/mocha": "^9.1.0",
25
23
  "@types/node": "^17.0.25",
26
- "@types/node-fetch": "^2.6.1",
27
24
  "@types/ws": "^8.5.3",
28
25
  "chai": "^4.3.6",
29
26
  "chai-as-promised": "^7.1.1",
30
27
  "cross-env": "^7.0.3",
31
28
  "dts-bundle-generator": "^6.7.0",
32
29
  "error-stack-parser": "^2.1.4",
30
+ "esbuild": "^0.17.12",
33
31
  "express": "^4.17.3",
34
32
  "mocha": "^9.0.2",
35
33
  "npm-run-all": "^4.1.5",
36
34
  "nyc": "^15.1.0",
37
35
  "prettier": "^2.2.1",
38
- "rollup": "^2.48.0",
39
- "rollup-plugin-terser": "^7.0.2",
40
- "rollup-plugin-ts": "^2.0.5",
41
- "terser": "^5.7.0",
42
36
  "ts-mocha": "^9.0.2",
43
37
  "tsd": "^0.24.1",
44
38
  "typedoc": "^0.22.15",
@@ -48,7 +42,8 @@
48
42
  "exports": {
49
43
  ".": {
50
44
  "require": "./pyodide.js",
51
- "import": "./pyodide.mjs"
45
+ "import": "./pyodide.mjs",
46
+ "types": "./pyodide.d.ts"
52
47
  },
53
48
  "./pyodide.asm.wasm": "./pyodide.asm.wasm",
54
49
  "./pyodide.asm.js": "./pyodide.asm.js",
@@ -56,7 +51,7 @@
56
51
  "./pyodide.mjs": "./pyodide.mjs",
57
52
  "./pyodide.js": "./pyodide.js",
58
53
  "./package.json": "./package.json",
59
- "./repodata.json": "./repodata.json"
54
+ "./pyodide-lock.json": "./pyodide-lock.json"
60
55
  },
61
56
  "files": [
62
57
  "pyodide.asm.js",
@@ -67,7 +62,7 @@
67
62
  "pyodide.mjs.map",
68
63
  "pyodide.d.ts",
69
64
  "ffi.d.ts",
70
- "repodata.json",
65
+ "pyodide-lock.json",
71
66
  "console.html"
72
67
  ],
73
68
  "browser": {
@@ -85,6 +80,7 @@
85
80
  "test:unit": "cross-env TEST_NODE=1 ts-mocha -p tsconfig.test.json test/unit/**/*.test.ts",
86
81
  "test:node": "cross-env TEST_NODE=1 mocha test/integration/**/*.test.js",
87
82
  "test:browser": "mocha test/integration/**/*.test.js",
83
+ "tsc": "tsc --noEmit",
88
84
  "coverage": "cross-env TEST_NODE=1 npm-run-all coverage:*",
89
85
  "coverage:build": "nyc npm run test:node"
90
86
  },
@@ -131,7 +127,6 @@
131
127
  },
132
128
  "dependencies": {
133
129
  "base-64": "^1.0.0",
134
- "node-fetch": "^2.6.1",
135
130
  "ws": "^8.5.0"
136
131
  },
137
132
  "types": "./pyodide.d.ts"