rapydscript-ns 0.9.0 → 0.9.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/CHANGELOG.md +8 -0
- package/README.md +6 -5
- package/TODO.md +1 -3
- package/language-service/index.js +4 -4
- package/package.json +1 -1
- package/release/compiler.js +2 -2
- package/release/signatures.json +3 -3
- package/src/lib/contextlib.pyj +379 -0
- package/src/lib/datetime.pyj +712 -0
- package/src/lib/io.pyj +500 -0
- package/src/lib/json.pyj +227 -0
- package/src/monaco-language-service/diagnostics.js +2 -2
- package/src/tokenizer.pyj +1 -1
- package/test/contextlib.pyj +362 -0
- package/test/datetime.pyj +500 -0
- package/test/debugger_stmt.pyj +41 -0
- package/test/io.pyj +316 -0
- package/test/json.pyj +196 -0
- package/test/unit/web-repl.js +533 -0
- package/web-repl/rapydscript.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
version 0.9.1
|
|
2
|
+
=======================
|
|
3
|
+
* Added the contextlib standard library
|
|
4
|
+
* Added the datetime standard library
|
|
5
|
+
* Added the io standard library
|
|
6
|
+
* Added the json standard library
|
|
7
|
+
* Added support for the `debugger` keyword
|
|
8
|
+
|
|
1
9
|
version 0.9.0
|
|
2
10
|
=======================
|
|
3
11
|
* All optional Python compatibility features are now enabled by default. See Python Feature Coverage from the README
|
package/README.md
CHANGED
|
@@ -3348,6 +3348,7 @@ One of Python's main strengths is the number of libraries available to the devel
|
|
|
3348
3348
|
itertools # count, cycle, repeat, accumulate, chain, compress, dropwhile, filterfalse,
|
|
3349
3349
|
# groupby, islice, pairwise, starmap, takewhile, zip_longest,
|
|
3350
3350
|
# product, permutations, combinations, combinations_with_replacement
|
|
3351
|
+
io # StringIO (in-memory text stream), BytesIO (in-memory binary stream)
|
|
3351
3352
|
|
|
3352
3353
|
For the most part, the logic implemented in these libraries functions identically to the Python versions. I'd be happy to include more libraries, if other members of the community want them. However, unlike most other Python-to-JavaScript compilers, RapydScript doesn't need them to be complete since there are already tons of available JavaScript libraries that it can use natively.
|
|
3353
3354
|
|
|
@@ -4016,7 +4017,7 @@ This restores the original RapydScript behavior: plain JS objects for `{}`, no o
|
|
|
4016
4017
|
|
|
4017
4018
|
---
|
|
4018
4019
|
|
|
4019
|
-
### Not Supported
|
|
4020
|
+
### Python Features That Are Not Supported
|
|
4020
4021
|
|
|
4021
4022
|
| Feature | Notes |
|
|
4022
4023
|
|---------------------------------------|-----------------------------------------------------------------------------------------|
|
|
@@ -4050,13 +4051,13 @@ Modules with a `src/lib/` implementation available are marked ✅. All others ar
|
|
|
4050
4051
|
| `dataclasses` | ✅ | `@dataclass`, `field()`, `asdict()`, `astuple()`, `replace()`, `fields()`, `is_dataclass()`, `MISSING` in `src/lib/dataclasses.pyj`; `frozen=True`, `order=True`, inheritance supported; note: `field()` first positional arg is the default value (JS reserved word `default` cannot be used as a kwarg) |
|
|
4051
4052
|
| `enum` | ✅ | `Enum` base class in `src/lib/enum.pyj`; `.name`, `.value`, iteration, `isinstance` checks; `IntEnum`/`Flag` not available |
|
|
4052
4053
|
| `abc` | ✅ | `ABC`, `@abstractmethod`, `Protocol`, `@runtime_checkable`, `ABCMeta` (informational), `get_cache_token()` in `src/lib/abc.pyj`; abstract method enforcement via `__init__` guard; `ABC.register()` for virtual subclasses with isinstance support; `Symbol.hasInstance` enables structural isinstance for `@runtime_checkable` protocols; `ABCMeta` metaclass not usable (no metaclass support), use `ABC` base class instead |
|
|
4053
|
-
| `contextlib` |
|
|
4054
|
+
| `contextlib` | ✅ | `AbstractContextManager`, `@contextmanager`, `closing`, `nullcontext`, `suppress`, `ExitStack` in `src/lib/contextlib.pyj`; generator-based context managers via `@contextmanager`; `asynccontextmanager` not available |
|
|
4055
|
+
| `datetime` | ✅ | `date`, `time`, `datetime`, `timedelta`, `MINYEAR`, `MAXYEAR` in `src/lib/datetime.pyj`; construction, `isoformat()`, `fromisoformat()`, `today()`/`now()`, `combine()`, arithmetic (via `__add__`/`__sub__`; operators need `overload_operators`), comparisons, `replace()`, `strftime()` (%Y %m %d %H %M %S %f %A %a %B %b %j %p %I %%); no tzinfo/timezone support |
|
|
4056
|
+
| `json` | ✅ | `dumps()`, `loads()`, `dump()`, `load()`, `JSONDecodeError` in `src/lib/json.pyj`; `indent`, `sort_keys`, `separators`, `dflt` (Python's `default`) callback, `object_hook`, `object_pairs_hook`, `parse_float`, `parse_int` supported; backed by the JS `JSON` global; note: `default` is a JS reserved word — use `dflt=` instead |
|
|
4057
|
+
| `io` | ✅ | `StringIO`, `BytesIO`, `UnsupportedOperation` in `src/lib/io.pyj`; `read([size])`, `readline([size])`, `readlines([hint])`, `write()`, `writelines()`, `seek(pos[, whence])`, `tell()`, `truncate([pos])`, `getvalue()`, `close()`, `closed`; context manager support; `readable()`, `writable()`, `seekable()` return True; `newline` parameter accepted for API compatibility |
|
|
4054
4058
|
| `string` | ❌ | Character constants, `Template`, `Formatter` not available |
|
|
4055
|
-
| `json` | ❌ | No Python wrapper; JS `JSON.parse` / `JSON.stringify` work directly via verbatim JS |
|
|
4056
|
-
| `datetime` | ❌ | `date`, `time`, `datetime`, `timedelta` not available |
|
|
4057
4059
|
| `inspect` | ❌ | `signature`, `getmembers`, `isfunction` etc. not available |
|
|
4058
4060
|
| `asyncio` | ❌ | Event loop, `gather`, `sleep`, `Queue`, `Task` wrappers not available; use `async`/`await` |
|
|
4059
|
-
| `io` | ❌ | `StringIO`, `BytesIO` not available |
|
|
4060
4061
|
| `struct` | ❌ | Binary packing/unpacking not available |
|
|
4061
4062
|
| `hashlib` | ❌ | MD5, SHA-256 etc. not available; use Web Crypto API via verbatim JS |
|
|
4062
4063
|
| `hmac` | ❌ | Keyed hashing not available |
|
package/TODO.md
CHANGED
|
@@ -15,7 +15,5 @@
|
|
|
15
15
|
- examples of using js libraries in rapydscript in readme?
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
I would like you to add support for [
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
I would like you to add support for [the python io.stringIO and io.bytesio library ] to rapydscript. It should have the same syntax as the Python implementation, and be transpiled into equivalent javascript. Please ensure with unit tests that it transpiles and the output JS runs correctly, and that the language service correctly handles it in parsed code. Please make sure it works in the web-repl too. Please also update the README if it has any outdated info about this, and the PYTHON_FEATURE_COVERAGE report. Please also add a simple example to the bottom of the TODO document using this feature (make no other changes to that file).
|
|
21
19
|
|