Commit Graph

340 Commits

Author SHA1 Message Date
Philipp Rudiger
deb2eee3ad Revert output manager after REPR evaluation (#522)
* Revert output manager after repr evaluation

* Fix indentation
2022-06-21 16:42:53 -05:00
Philipp Rudiger
829cc9f6f9 Simplify tests with pytest-playwright (#523)
* Simplify tests with pytest-playwright

* Add pytest-playwright to pip

* Fix simple_clock example

* Attempt to make example tests more robust

* Make pre-commit happy

* Revert accidental change to simple_clock pyscript resources

* Another attempt at reducing flakeyness

* Do not wait until page load event is fired

* Remove pointless py-config

Co-authored-by: mariana <marianameireles@protonmail.com>
2022-06-21 14:28:05 -03:00
woxtu
6822105c70 Add type annotations (#488) 2022-06-20 13:22:03 -03:00
andre-dietrich
e1622a56fa fix: < & > are parsed with HTML escape symbols (#481)
Adds utils.htmlDecode arround innerHTML to read the code for <py-repl> and
<py-script>, which preserves all newlines, tabs, and < & > characters.

Fix bug #480
2022-06-09 16:01:31 -05:00
Fabio Pliger
f60dd6a788 Fix extensions regression bug (#489)
* add output div visibility rule and make sure CustomWidget is being registered

* add new runAfterRuntimeInitialized method that classes can use to run code only after runtime actually initialized

* replace setTimout with proper event to wait for runtime to be completed

* replace setTimout on pyinpytbox with proper event to wait for runtime to be completed
2022-06-01 15:39:05 -05:00
woxtu
4b4ff08131 Change the metadata format (#457)
* Chnage the metadata format

* Add syntax highlighting

* have simple_clock example run from local build to test change

Co-authored-by: Fabio Pliger <fabio.pliger@gmail.com>
2022-06-01 15:49:41 -03:00
marianoweber
eaacd45672 [FIX] output management cleanups (#464)
* return on \n before empty div is appended

* use appendOutput with out.write

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: Mariano Weber <info@uiremotely.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-05-27 00:21:47 -05:00
Peter W
1bf6cc0e72 Fix examples Ci, Makefile, some doc references (#469)
* fix examples ci, makefile, and update docs

* getting started reference
2022-05-26 16:56:54 -05:00
Mariana Meireles
a9470ed9c1 Move tests, create makefile action to run tests on examples (#433)
* Move tests, create makefile action to run tests on examples

* Correct import file for html files

* Build environment for tests

* Fix the CI

* rearrange CI

* fix find cmd and make sure we don't delete the folder implicitly

* more rearranging

* fix folder permissions and custom sed for subfolders

* add toga wheels files

* re-add missing file

* mirror latest changes in alpha ci

* fix find cmd

* try different fix for find

* remove redundant build

Co-authored-by: mariana <marianameireles@protonmail.com>
Co-authored-by: pww217 <pwilson@anaconda.com>
Co-authored-by: Fabio Pliger <fabio.pliger@gmail.com>
2022-05-26 16:31:38 -05:00
Philipp Rudiger
2c5ef95027 Update panel examples to panel 0.13.1 (#458)
* Update panel examples to panel 0.13.1

* More indent
2022-05-24 18:01:45 -05:00
marianoweber
f712b1369a [PROPOSAL] REPL output replacement (#439)
* fix OutputManager _append setter

* fix OutputManager change parameters

* fix OutputCtxManager __init__ and change methods

* replacing OutputManager pyscript.write with write function

* add optional output-append attribute to py-repl

* add appendOutput(default: true) to base component

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update pyscriptjs/src/components/pyrepl.ts

Co-authored-by: woxtu <woxtup@gmail.com>

* change from output-append flag to output-mode attribute

* removed type annotation

* repositioned setOutputMode call for auto-generated REPLs to work

* fixed indentation error for indented input

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* added preEvaluate method

* moved output-mode logic to preEvaluate

* remove static write method from PyScript, add write method to Element

* removed err parameter from OutputCtxManager

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add PyScript.write back with a deprecation warning

* fix wrong input name

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: woxtu <woxtup@gmail.com>
Co-authored-by: Fabio Pliger <fabio.pliger@gmail.com>
2022-05-24 17:58:48 -05:00
ic-768
8cd5ba6361 Minor refactoring (#437) 2022-05-23 18:15:37 -05:00
woxtu
3b68e1b27d Bundle the Python files into the output file (#441)
* Bundle the Python files into the output file

* Remove unused functions
2022-05-22 16:30:19 -05:00
Peter W
ee46b46234 Add testing to CI flow (#418)
* new testing ci flow

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* install conda

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* test conda

* pre-commit fix

* remove if

* makefile fix

* fix pytest install

* argument for test

* restructure

* fix sync

* full path filter

* use setup-condav2

* syntax

* test path

* add binary argument

* remove which

* Update Makefile

* remove arguments

* trigger CI

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-05-20 13:45:49 -05:00
Furkan Doğan
db49fd498a fixed the logging of initializers (#431) 2022-05-19 19:44:55 -03:00
woxtu
e95b90363e Add event listeners properly (#424) 2022-05-19 17:56:53 -03:00
woxtu
82c0d741e4 Add type annotations (#396)
* Add type annotations

* Replace `StateCommand` with `Command`

* Revert "Replace `StateCommand` with `Command`"

This reverts commit 2dfc2d34e4.

* Fix the return value
2022-05-19 16:59:39 -03:00
ic-768
508a7d8605 Add labels for pyrepl component (#322)
* Add labels for pyrepl component

* Add id to editor box instead of main div

Co-authored-by: Fabio Pliger <fabio.pliger@gmail.com>
2022-05-19 09:23:08 -05:00
cleonard
59fc667651 Basic tests (#355)
* Added microsoft channel and playwright as dependency

* Added test-setup to run

* Basic tests for each example in examples/index.html

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update test_webgl_raycaster_index.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update test_folium.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update test_folium.py

* Update test_folium.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update test_bokeh.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Whitelisting assertion statements in test files

* Updated bare execept statements with ImportError

* Flake8 compliance

* Updated  message

* Removed 'make test-setup'

* Removed @echo from make test

* Uncommented Toga test

* Removed __test_all__.py file

* Removing unnecessary files

* Removed individual test files

* conftest.py with all data for running tests

* Consolidated test file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixed pre-commit flake8 issues

* flake8 issue

* add playwright installation to setup

* Testing parameterization and webserver to serve examples locally

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Flake8 compliance

* More flake8

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Michael Verhulst <michael@terminallabs.com>
Co-authored-by: Fabio Pliger <fabio.pliger@gmail.com>
2022-05-18 13:08:15 -05:00
Jeff Glass
b767a78b05 Provide Visible Error if <py-env> paths is used in a local HTML file (#311)
* Add onscreen error when using py-env paths in local HTTP files without file server

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove redundant code, fix error handling, add 404 error

* Lint and Format

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* manage errors loading files

* use handleFetchError for handling fetch errors in env

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabio Pliger <fabio.pliger@gmail.com>
2022-05-17 23:48:02 -05:00
woxtu
39774a83c5 Use a recommended method (#363) 2022-05-17 22:24:33 -05:00
marianoweber
c04015899b fixed REPL bugs (#372)
* fixed REPL play button alignment

* fixed REPL auto-generate

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* changed nextExecId selector

* added removeClasses to utils.ts

* fixed visual bug after error output

* changed play button alignment

Co-authored-by: Mariano Weber <info@uiremotely.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-05-17 16:20:00 -05:00
hoge1e3
eb3a31a698 fixed the bug std-err attribute cannot set stderr properly (#371) 2022-05-16 21:30:57 -05:00
Fabio Pliger
0476627f34 fix autogenerated element (#397)
* use static string in checkId to simplify behaviour and ensure ids always start with alpha char

* re-enable terser on minify

* fix example local path
2022-05-16 16:08:28 -05:00
Yannick Funk
eba42ad9b4 Add checkId() for PyButton and PyInputBox, add id check for tags with pys- Event handlers (#400)
* Add id generation to PyButton and PyInputBox components

* Refactor init handlers and add check for id
2022-05-16 16:05:11 -05:00
Javadz
ca909b4f6b Create readme.md (#374) 2022-05-16 11:13:39 -05:00
Fabio Pliger
8670f96d21 remove terser since it's breaking specific examples (#395) 2022-05-16 10:58:02 -05:00
Philipp Rudiger
1e8aa87b0a Ensure minified pyscript is captured by query selector (#393) 2022-05-16 09:40:23 -05:00
Fabio Pliger
8c65cad209 remove prod flag from build cmd and add alternative build-min cmd (#368) 2022-05-13 19:08:02 -05:00
Fabio Pliger
74d29bca8c fix paths to pyscript.net (#366) 2022-05-13 18:40:11 -05:00
Peter W
1fdec1ca21 redirect examples (#365) 2022-05-13 18:24:29 -05:00
woxtu
86eb771cdc Use substring() instead of substr() (#341) 2022-05-12 14:54:35 -05:00
NiJia Lin
a3e86f32b7 Update say_hello.html (#327)
- remove un-usage `setTimeout` package
2022-05-11 20:39:22 -05:00
woxtu
53a21b74eb Enable to generate the source map (#325) 2022-05-11 19:18:28 -05:00
Fabio Pliger
363f3751f9 support different pyodide versions (#328)
* add PyLoader class

* create global loader during app creation time and remove it when pyscript loading operations are done

* make the loader global and open/close when apps is starting. Also add concept of app config so users can set if they want to autoclose the loader of handle it themselves

* add pyconfig file

* auto add global config if there's no config set in the page

* export initializer type

* define type for config

* move initialization out of svelte file, into app config

* change runtimes from strings to objects

* fix typo
2022-05-11 16:59:13 -05:00
Julian
73a0d9b02e Fix <py-repl theme="dark"> (#320)
* fix: theme for <py-repl>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove comment

* fix: populate initial theme on auto generated repls.

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-05-11 14:57:01 -05:00
ic-768
2526d242bc Change let to const; Minor code improvement (#300)
* Change let to const; Minor code improvement

* Indentation fix
2022-05-10 16:15:32 -05:00
Fabio Pliger
71319d0969 add app loading splash screen and AppConfig (#279)
* add PyLoader class

* create global loader during app creation time and remove it when pyscript loading operations are done

* make the loader global and open/close when apps is starting. Also add concept of app config so users can set if they want to autoclose the loader of handle it themselves

* add pyconfig file

* auto add global config if there's no config set in the page

* remove changes to simple_clock example
2022-05-10 16:00:25 -05:00
Peter W
5f19756ff3 fix ci issues (#312)
* test ci

* sync fixes, ignore symlink

* remove symlink

* undo trigger tests

* only deploy latest on merge, not PR

* quotes to single
2022-05-10 12:27:06 -05:00
woxtu
6f18a66d53 Fix ESLint warnings (#294)
* Use builtin methods

* Fix formatting
2022-05-09 15:16:25 -05:00
Matt Kramer
5332aad8d6 Add pre-commit config for eslint (#259)
* Add eslint config

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-05-09 14:55:33 -05:00
Sugato Ray
ff3b994107 Adding textwrap.dedent for allowing indented html blocks (#275)
* Adding textwrap.dedent for indented html blocks
- write indented html string
- but dedent it while generating html
- textwrap.dedent is meant for this purpose

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixed indentation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixed indentation

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-05-09 14:48:11 -05:00
woxtu
a993d61885 Use async/await instead of promise chaining (#266)
* Use async/await instead of promise chaining

* Await asynchronous operations
2022-05-09 12:32:01 -05:00
woxtu
a0c7b7653a Improve type annotations (#271)
* Add js-yaml type definition

* Improve type annotations

* Store values to properties
2022-05-07 11:25:05 -05:00
Christian Clauss
4ec24a919a Remove execute bit from .css and .html files (#274)
* Remove execute bit from .css and .html files

* pyscriptjs/examples/toga/static/pyscript: Broken symlink
2022-05-07 09:27:31 -05:00
Christian Clauss
fadb4a67e7 pre-commit: Add codespell and other checks (#263) 2022-05-06 16:23:14 -05:00
Jannis Leidel
990b0b2797 Make all targets phony. (#249) 2022-05-06 14:40:27 -05:00
Bruno Odinukweze
20a70ed3a7 made py-button styling dynamic (#227)
* made py-button styling dynamic

* added comments

* removed debugging logs

* fixed linting issue with variables
2022-05-06 14:40:03 -05:00
Matt Kramer
cc6d6247a8 Add additional pre-commit hooks (#245)
* Add and run end-of-file-fixer
* Add and run trailing-whitespace
* Add and run check-yaml
* Add and run check-json
* Add and run pretty-format-yaml
* Fix comment indentation
2022-05-06 14:27:11 -05:00
woxtu
3347532f5e Add missing type annotations (#242)
* Remove redundant subscribing

* Add type annotations

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Matt Kramer <mkramer@anaconda.com>
2022-05-06 13:29:35 -05:00