From 9012c2101baf0ce28d9f67bb77e153bc4573f961 Mon Sep 17 00:00:00 2001 From: Tom Wenzheng Tang Date: Tue, 30 May 2023 18:09:37 -0400 Subject: [PATCH 1/9] chore: update test_script.sh to test the package as a whole --- test_script.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test_script.sh b/test_script.sh index 6c051282..4009cd41 100755 --- a/test_script.sh +++ b/test_script.sh @@ -3,5 +3,6 @@ cmake .. cmake --build . cd tests ctest --rerun-failed --output-on-failure -cd ../src -python -m pytest ../../tests/python \ No newline at end of file +cd ../../tests/python +ln -sf ../../python/pythonmonkey . +python -m pytest . From 00f157f3479a3616f4877c379e82edb37ec4c739 Mon Sep 17 00:00:00 2001 From: Tom Wenzheng Tang Date: Tue, 30 May 2023 18:14:28 -0400 Subject: [PATCH 2/9] docs: update README.md for running tests locally --- README.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1f25badc..dc4592dd 100644 --- a/README.md +++ b/README.md @@ -61,13 +61,7 @@ this package to execute our complex `dcp-client` library, which is written in JS ## Running tests 1. Compile the project -2. In the build folder `cd` into the `tests` directory and run `ctest`. - ```bash - # From the root directory we do the following (after compiling the project) - $ cd build/tests - $ ctest - ``` - Alternatively, from the root directory, run ``./test_script.sh`` +2. From the root directory, run `./test_script.sh` ## Using the library @@ -86,4 +80,4 @@ Type "help", "copyright", "credits" or "license" for more information. >>> hello = pm.eval("() => {return 'Hello from Spidermonkey!'}") >>> hello() 'Hello from Spidermonkey!' -``` \ No newline at end of file +``` From de50c5d5dc238a864131700d8925dc4f9f4681f2 Mon Sep 17 00:00:00 2001 From: Tom Wenzheng Tang Date: Tue, 30 May 2023 18:21:11 -0400 Subject: [PATCH 3/9] chore: update test_script.sh to symlink .so file into the package --- test_script.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test_script.sh b/test_script.sh index 4009cd41..00a6bfca 100755 --- a/test_script.sh +++ b/test_script.sh @@ -3,6 +3,8 @@ cmake .. cmake --build . cd tests ctest --rerun-failed --output-on-failure +cd ../../python/pythonmonkey +ln -sf ../../build/src/pythonmonkey.so . cd ../../tests/python ln -sf ../../python/pythonmonkey . python -m pytest . From eaa11b7027a91ae2dce95ec24abbebab7012fde3 Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Thu, 1 Jun 2023 20:54:35 +0000 Subject: [PATCH 4/9] chore: remove test_script.sh as we are using poetry --- test_script.sh | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100755 test_script.sh diff --git a/test_script.sh b/test_script.sh deleted file mode 100755 index 00a6bfca..00000000 --- a/test_script.sh +++ /dev/null @@ -1,10 +0,0 @@ -cd build -cmake .. -cmake --build . -cd tests -ctest --rerun-failed --output-on-failure -cd ../../python/pythonmonkey -ln -sf ../../build/src/pythonmonkey.so . -cd ../../tests/python -ln -sf ../../python/pythonmonkey . -python -m pytest . From 3d9da22a466b9404af59b175c156bbb08a5a9884 Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Thu, 1 Jun 2023 21:11:22 +0000 Subject: [PATCH 5/9] docs: update README to use poetry --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dc4592dd..001e5296 100644 --- a/README.md +++ b/README.md @@ -56,12 +56,13 @@ this package to execute our complex `dcp-client` library, which is written in JS - rust - python3.9 or later - spidermonkey 102.2.0 or later + - [Poetry](https://python-poetry.org/docs/#installation) -2. Compile pythonmonkey in ``/build`` (which can be done automatically by running ``./build_script.sh``) +2. Run `poetry install`. This command automatically compiles the project and installs the project as well as all Python dependencies to the poetry virtualenv. ## Running tests 1. Compile the project -2. From the root directory, run `./test_script.sh` +2. From the root directory, run `poetry run pytest ./tests/python` ## Using the library From 2c741ccb4c914f0f2820cd86507c144870514bc9 Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Fri, 2 Jun 2023 00:52:08 +0000 Subject: [PATCH 6/9] docs: update `Using the library` in README --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 001e5296..5cda5791 100644 --- a/README.md +++ b/README.md @@ -66,13 +66,21 @@ this package to execute our complex `dcp-client` library, which is written in JS ## Using the library -### Method 1 -After compiling the project in the `build/src` folder you will find a `.so` file named `pythonmonkey.so`. This is the shared object file that contains the pythonmonkey module. +### Install from [PyPI](https://pypi.org/project/pythonmonkey/) + +> PythonMonkey is not release-ready yet. Our first public release is scheduled for mid-June 2023. + +```bash +pip install pythonmonkey +``` + +### Use local version + +`pythonmonkey` is available in the poetry virtualenv once you compiled the project using poetry. -If you wish to use the library you can simply copy the `.so` file into the directory that you wish to use python in. ```bash # In the directory containg pythonmonkey.so -$ python +$ poetry run python ``` ```py Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux @@ -82,3 +90,5 @@ Type "help", "copyright", "credits" or "license" for more information. >>> hello() 'Hello from Spidermonkey!' ``` + +Alternatively, you can build a `wheel` package by running `poetry build --format=wheel`. From 9fe833cd339c05e13ec7aca5ac0312aece9ab19f Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Fri, 2 Jun 2023 01:08:10 +0000 Subject: [PATCH 7/9] docs: update `Use local version` in README, remove old instructions --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 5cda5791..88b4c122 100644 --- a/README.md +++ b/README.md @@ -79,8 +79,7 @@ pip install pythonmonkey `pythonmonkey` is available in the poetry virtualenv once you compiled the project using poetry. ```bash -# In the directory containg pythonmonkey.so -$ poetry run python +poetry run python ``` ```py Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux From 3950ecd1b5ceb33188df6a403cfca4500fc40d41 Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Fri, 2 Jun 2023 01:22:37 +0000 Subject: [PATCH 8/9] docs: use `$` symbol to indicate they are bash commands to be run --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 88b4c122..826ce3c7 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ this package to execute our complex `dcp-client` library, which is written in JS > PythonMonkey is not release-ready yet. Our first public release is scheduled for mid-June 2023. ```bash -pip install pythonmonkey +$ pip install pythonmonkey ``` ### Use local version @@ -79,7 +79,7 @@ pip install pythonmonkey `pythonmonkey` is available in the poetry virtualenv once you compiled the project using poetry. ```bash -poetry run python +$ poetry run python ``` ```py Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux From 5de6de897a6bfe8bd4ce135b1fb5a31a97bfc57c Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Fri, 2 Jun 2023 01:27:58 +0000 Subject: [PATCH 9/9] docs: add instructions for installing wheel package --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 826ce3c7..39d3caa7 100644 --- a/README.md +++ b/README.md @@ -90,4 +90,4 @@ Type "help", "copyright", "credits" or "license" for more information. 'Hello from Spidermonkey!' ``` -Alternatively, you can build a `wheel` package by running `poetry build --format=wheel`. +Alternatively, you can build a `wheel` package by running `poetry build --format=wheel`, and install it by `pip install dist/*.whl`.