Commit Graph

71 Commits

Author SHA1 Message Date
Hood Chatham 2cdca2ea47
MAINT Make doctests run; run some doctests in pyodide (#4280)
This uses pyodide/pytest-pyodide#117 to run doctests in
Pyodide. I also turned on and fixed various doctests that were not working for
unrelated reasons
2023-11-18 16:17:30 -08:00
Hood Chatham cbb008da59
Improve handling of generated typescript files (#4212)
This makes IDEs, documentation generation tools, and linters handle our
generated files better. I set the project root to be `src` instead of `src/js`  
so that it is allowed to import files directly from `src/core`. This way we 
don't have to copy `error_handling.ts` we can just import
`../core/error_handling`.

I made a new folder called `src/js/generated` to place generated files into and
added typescript resolution rules so that when we import a file called
"generated/blah" we first look for `blah` in `src/js/generated` and then fall
back to a file called `blah` in `src/core`.

This also allows us to move around fewer files when building the docs 
and in the makefile.
2023-10-11 08:14:42 -07:00
Hood Chatham dbf4dea326
MAINT Add some more types to various things (#4202) 2023-10-06 19:42:28 -07:00
Hood Chatham 2988faf8d4
Use upstreamed autosummary and automodule directives (#4196) 2023-10-02 12:00:32 -07:00
Hood Chatham 2bcd48c4c2
Switch to using sphinx-js fork (#4193) 2023-09-30 16:41:02 -07:00
Hood Chatham 53744b4906
DOCS Some minor tuneups (#4189) 2023-09-28 17:09:28 -07:00
Hood Chatham e19621d483
ENH Rework streams handling (#4035)
This fixes a number problems with the old stream handling:

1. Not possible to set a custom errno (necessary for proper interrupt
   handling and possibly for other things)

2. Inefficient: in a lot of cases we have data in one buffer and we need
   it placed into a different buffer, but we have to implement a function
   that gets one byte out of the source buffer and then call it repeatedly
   to move one byte at a time to the target buffer.

3. Ease of implementation: in many cases we already have perfectly good
   buffer manipulation APIs, so if we have direct access to the true source
   or target buffer we can just use these. See: the node IO code, which got
   much simpler.

This is backwards compatible, so you can still use the old input mechanism
or use buffered or raw output. But it adds a new method of directly implementing
read/write. For simplicity, we insure that the source/destination buffers are
always `Uint8Array` views that point to exactly the region that is meant to be
read/written.

The old mechanisms are faster than before and can correctly support keyboard
interrupts. Other than that I think the original behavior is unchanged. I added a
lot more test coverage to ensure backwards compatibility since there was pretty
anemic coverage before.

I think the read/write APIs are mostly pretty simple to use, with the exception
that someone might forget to return the number of bytes read. JavaScript's ordinary
behavior coerces the `undefined` to a 0, which leads to an infinite loop where the
filesystem repeatedly asks to read/write the same data since it sees no progress.
I added a check that writes an error message to the console and sets EIO when undefined
is returned so the infinite loop is prevented and the problem is explained.
2023-08-21 08:41:44 +02:00
Hood Chatham 85a1e1fefd
DOCS Mark pyodide APIs as not static (#4038)
This removes several confusing `static` markers and fixes the xrefs for
the async functions defined in api.ts
2023-08-04 13:44:58 +02:00
Tomas R 5744a9e12f
Add support for the @example JSDoc directive (#4009)
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-07-23 09:54:28 +02:00
Hood Chatham 1aea59f55a
Add js array methods to pyproxy of list (#3853)
Work towards making a pyproxy of a list a drop-in replacement for an array.
This can't be done entirely because lists don't allow weird things like holes,
writing to the length field, writing out of bounds entries, etc. But we
implement  the main Array APIs.
2023-06-01 09:13:52 -07:00
Gyeongjae Choi 2f9d689b88
DOC Hide disabled packages from docs (#3778)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-04-21 10:51:27 +02:00
Gyeongjae Choi 2046310460
ENH Support SDL-based packages and add pyxel (#3508)
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
2023-03-30 08:18:31 +00:00
Christian Clauss 57f36ac6f8
Ruff is now compatible with Python pattern matching (#3650) 2023-03-13 22:45:06 +01:00
Hood Chatham ad483dc14d
NFC Rearrange api.ts (#3547) 2023-03-06 13:11:33 +09:00
Roman Yurchak 48258ff146
Replace isort, flake8, pycln and pyupgrade by ruff (#3522)
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2023-02-07 08:35:20 +09:00
Hood Chatham 861a758c3b
Add new `pyodide.ffi` JavaScript submodule with PyProxy subtypes (#3523)
This creates a new `pyodide.ffi` submodule and adds a bunch of new subclasses of
`PyProxy` to it.

There are three stages in which we are concerned with the behavior of the
objects we define:
1. at time of static typechecks
2. at execution time
3. when generating docs

Prior to this PR, the subtypes of PyProxy only work well for static type checks,
they work acceptably at runtime (just don't let the user access them), and the
docs don't look that great. This PR is primarily intended to improve the docs
for PyProxy, but they also make execution time checks work better: you can now
say `obj instanceof pyodide.ffi.PyCallable` instead of `obj.isCallable()` which
I is easier to understand and to cross reference against the documentation. I am
marking `isCallable` as deprecated.

I also made a bunch of edits and improvements to the docs.

I have deprecated `PyProxyCallable` in favor of `pyodide.ffi.PyCallable` and
`PyProxy.isCallable` in favor of `obj instanceof pyodide.ffi.PyCallable`.
`PyBuffer` has been renamed to `pyodide.ffi.PyBufferView` and a new `PyBuffer`
has been created which is a subtype of `PyProxy`.
2023-02-05 19:35:08 -08:00
Hood Chatham 20e92c37ca
DOCS, MAINT: Replace :any: xrefs with more specific types (#3531)
This leads to more consistent rendering (functions and methods get parens after
them) and reduces chances of warnings about getting the wrong link. It is also
possible to use `~fully.quallified.name` to just show `name` if we use a specific
reference type, but it doesn't work with `any` for some reason.
2023-02-01 11:00:58 -08:00
Gyeongjae Choi 328a9ffc34
Add tag key in meta.yaml spec (#3444)
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2023-01-27 13:31:26 +09:00
Hood Chatham 8c5ae6ff9e
Update description of github releases in docs (#3498) 2023-01-24 13:11:31 -08:00
Hood Chatham 3b2952fc92
Python3.11 (#3252) 2023-01-23 19:45:59 -08:00
Hood Chatham 8a26af4f76
DOCS Improve JavaScript type rendering (#3481) 2023-01-22 09:26:42 +01:00
Hood Chatham 69d7b4e099
Remove napoleon_fixes (#3479)
I upstreamed all of this into sphinx-autodoc-typehints.
2023-01-21 17:44:20 -08:00
Hood Chatham 6972ff101d
DOCS Add sphinx cross referencing to MDN docs using intersphinx (#3477) 2023-01-20 11:21:44 +09:00
Hood Chatham 9b58bf4294
DOCS Remove ensure_argument_types and use autodoc-typehints feature for this (#3475)
Turns out there was a setting for this. Should have read the docs!
2023-01-18 14:13:17 -08:00
Hood Chatham 920f2e1679
DOCS: Help Spinx find ffi types (#3465)
The `pyodide.ffi` stuff is defined in `_pyodide._core_docs`. We don't want `_pyodide._core_docs` to appear in the documentation because this isn't where you should import things from so we override the `__name__` of `_pyodide._core_docs` to be `pyodide.ffi`. But then Sphinx fails to locate the source for the stuff defined in `_pyodide._core_docs`. This patches `ModuleAnalyzer` to tell it to look for the source of things from `pyodide.ffi` in `_pyodide._core_docs`.
2023-01-17 22:34:15 -08:00
Hood Chatham 3cc6ac7873
Minor docs fixes (#3467)
Remove the property prefix from properties, add a link for ast.Module.

Previously this included more significant changes but they have been upstreamed into sphinx-autodoc-typehints.
2023-01-18 14:00:39 +09:00
Hood Chatham 4ff8687965
DOCS Fixes for shortcomings of napoleon (#3451)
I opened a PR for one of the Napoleon changes:
https://github.com/sphinx-doc/sphinx/pull/11131
But we use Sphinx v5.3 so even if we upstream Napoleon fixes into Sphinx v6.x, 
we won't get to use them for a while.
2023-01-16 19:59:07 -08:00
Hood Chatham f55bb2e423
Cleanup of documentation configuration (#3448) 2023-01-14 15:01:20 +01:00
Hood Chatham b0b07efe94
Update to sphinx-js 3.2.1 (#3429) 2023-01-07 13:23:56 +02:00
Hood Chatham aeb066bbce
DOCS Improve rendering of JavaScript property types (#3426) 2023-01-06 00:06:04 -05:00
Hood Chatham e90154f3e2
DOCS Use autodoc typehints and make various improvements to autodoc rendering (#3405)
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
2023-01-04 11:51:09 +02:00
Hood Chatham 1169cf59a3
Hide deprecated arguments from docs (#3396)
This adds a mechanism to hide deprecated or private arguments from the documentation and
applies it to errorCallbackDeprecated.
2023-01-03 13:26:37 +09:00
Hood Chatham bddcc22dda
DOCS Fix the async prefix, improvement to summary table format (#3399) 2023-01-02 10:33:55 +09:00
Gyeongjae Choi 8c6b0a365a
Remove interface.ts and fix doc build error (#3377) 2022-12-21 16:28:05 +09:00
Hood Chatham 560364b98a
Add type field to PythonError (#3289) 2022-11-25 17:01:03 +09:00
Hood Chatham ffd2d4a79b
DOCS Fix rendering of function types and null (#3271) 2022-11-21 09:39:51 +09:00
Gyeongjae Choi 3ad41f13c7
Merge library and sharedlibrary key to build/type (#3238) 2022-11-13 12:31:14 +09:00
Roman Yurchak 4dd8a3e0cb
Switch to meta.yaml parsing with pydantic (#3079) 2022-09-11 09:20:56 +02:00
Ryan Russell 42d33407ca
DOCS Fix Typos (#2656)
Fixed 2 typos.
2022-05-31 16:06:06 -07:00
Henry Schreiner 5523d539bf
chore(types): fill out remaining partial types (#2612) 2022-05-25 20:31:04 -07:00
Henry Schreiner e31bb554e4
chore: complete more incomplete types (#2590)
* chore: add some incomplete types
* chore: modernize pyproject.toml

Adding more incomplete types. About 2/3 of the way through being
able to turn on the strictness flag for it.
2022-05-21 13:35:02 -07:00
Hood Chatham 6e3de5734f
Fix test_pyodide_analyzer (#2501)
This fixes a mistake I committed in #2496.
2022-05-05 08:13:02 -06:00
Hood Chatham 3334580867
Remove private names from js api docs (#2496)
Some private names ended up in the docs for some reason. This removes them.
2022-05-04 21:52:17 -06:00
Gyeongjae Choi 6d34ef0b6f
DOC Fix renderer for Interface type (#2417) 2022-04-21 15:55:50 +09:00
Gyeongjae Choi a95a27e754
DOC Remove dummy packages from docs (#2358) 2022-04-14 06:22:07 -07:00
Hood Chatham 0e1e2ac01c
Python 3.10 (#2225) 2022-03-17 15:48:56 -07:00
Henry Schreiner 4f8b0a0344
chore: more pre-commit checking (#2257) 2022-03-07 21:51:20 -08:00
Hood Chatham fff0f0e9b0
Add `default_converter` argument to `to_js` and `toJs` (#2208) 2022-03-05 12:32:04 -08:00
Henry Schreiner 8d00451142
chore: enable the rest of flake8 & bugbear (#2216) 2022-02-27 12:39:53 -05:00
Henry Schreiner 8385df36a4
tests: enabling mypy on untyped defs (#2204) 2022-02-23 17:10:53 -05:00