Skip to content

Commit 7d2323a

Browse files
committed
Merge branch 'Xmader/chore/improve-pminit' into Xmader/docs/debugging-steps
2 parents a43fae4 + c2ff52c commit 7d2323a

File tree

13 files changed

+64
-26
lines changed

13 files changed

+64
-26
lines changed

.github/workflows/test-and-publish.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ defaults:
2323
jobs:
2424
build-spidermonkey-unix:
2525
strategy:
26+
fail-fast: false
2627
matrix:
2728
# Use Ubuntu 20.04 / macOS 12 + Python 3.10 to build SpiderMonkey
2829
os: [ 'ubuntu-20.04', 'macos-12', 'm2ci' ]
@@ -39,8 +40,13 @@ jobs:
3940
with:
4041
path: |
4142
./_spidermonkey_install/*
42-
key: spidermonkey-${{ runner.os }}-${{ runner.arch }}
43+
key: spidermonkey102.13-${{ runner.os }}-${{ runner.arch }}
4344
lookup-only: true # skip download
45+
- name: Setup Poetry
46+
if: ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
47+
uses: snok/install-poetry@v1
48+
with:
49+
version: 1.5.1
4450
- name: Build spidermonkey
4551
if: ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
4652
run: ./setup.sh
@@ -54,8 +60,13 @@ jobs:
5460
with:
5561
path: |
5662
./_spidermonkey_install/*
57-
key: spidermonkey-${{ runner.os }}-${{ runner.arch }}
63+
key: spidermonkey102.13-${{ runner.os }}-${{ runner.arch }}
5864
lookup-only: true # skip download
65+
- name: Setup Poetry
66+
if: ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
67+
uses: snok/install-poetry@v1
68+
with:
69+
version: 1.5.1
5970
- name: Install dependencies
6071
if: ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }}
6172
shell: powershell
@@ -124,7 +135,7 @@ jobs:
124135
with:
125136
path: |
126137
./_spidermonkey_install/*
127-
key: spidermonkey-${{ runner.os }}-${{ runner.arch }}
138+
key: spidermonkey102.13-${{ runner.os }}-${{ runner.arch }}
128139
fail-on-cache-miss: true # SpiderMonkey is expected to be cached in its dedicated job
129140
- name: Build pminit
130141
run: |

CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
3838
### Code block from: https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html
3939
include(FetchContent)
4040

41-
if(UNIX)
42-
SET(COMPILE_FLAGS "-g -ggdb -O0 -fno-rtti")
43-
elseif(WIN32)
44-
SET(COMPILE_FLAGS "")
45-
endif()
41+
SET(COMPILE_FLAGS "-ggdb -Ofast -fno-rtti") # optimize but also emit debug symbols
4642
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS}" )
4743

4844
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Read this if you want to build a local version.
6060
- [Poetry](https://python-poetry.org/docs/#installation)
6161
- [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning)
6262

63-
2. Run `poetry run pip install --verbose python/pminit ./`. This command automatically compiles the project and installs the project as well as dependencies into the poetry virtualenv.
63+
2. Run `poetry install`. This command automatically compiles the project and installs the project as well as dependencies into the poetry virtualenv.
6464

6565
If you are using VSCode, you can just press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>B</kbd> to [run build task](https://code.visualstudio.com/docs/editor/tasks#_custom-tasks) - We have [the `tasks.json` file configured for you](.vscode/tasks.json).
6666

examples/use-python-module.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@
55

66
import pythonmonkey as pm
77

8-
require = pm.createRequire(__file__)
9-
require('./use-python-module');
8+
pm.require('./use-python-module');

examples/use-require.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import pythonmonkey as pm
77

8-
require = pm.createRequire(__file__)
9-
require('./use-require/test1');
8+
pm.require('./use-require/test1');
109
print("Done")
1110

js-test-runner

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import sys, os
88
import pythonmonkey as pm
99

1010
# Main
11-
require = pm.createRequire(__file__)
12-
require('console');
11+
pm.require('console');
1312

1413
testName = os.path.realpath(sys.argv[1]);
1514
testDir = os.path.dirname(testName);

pmjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import pythonmonkey as pm
88

99
globalThis = pm.eval("globalThis;")
1010
globalThis.python.write = sys.stdout.write
11-
pm.createRequire(__file__)('./pmjs-require')
11+
pm.require('./pmjs-require')
1212

1313
pm.eval("""'use strict';
1414
const cmds = {};

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ numpy = [
5555
{version = "^2.0.0.dev0", allow-prereleases = true, source = "anaconda", python = "3.12.*"},
5656
{version = "^1.24.3", python = "<3.12"},
5757
]
58+
pminit = { path = "./python/pminit", develop = true }
5859

5960

6061
[[tool.poetry.source]]

python/pythonmonkey/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@
55
# Expose the package version
66
import importlib.metadata
77
__version__= importlib.metadata.version(__name__)
8+
9+
# Load the module by default to make `console` globally available
10+
require("console")

python/pythonmonkey/builtin_modules/internal-binding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
"""
88
See function declarations in ./internal-binding.d.ts
99
"""
10-
exports = pm.internalBinding
10+
exports = pm.internalBinding # type: ignore

0 commit comments

Comments
 (0)