Skip to content

Commit 4b5cfab

Browse files
committed
Merge branch 'main' into Xmader/feat/better-setTimeout
2 parents 0f990f1 + 25b8ea6 commit 4b5cfab

File tree

94 files changed

+2352
-314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2352
-314
lines changed

.eslintrc.js

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/**
2+
* @file .eslintrc.js - ESLint configuration file, following the Core Team's JS Style Guide.
3+
* @author Wes Garland <[email protected]>
4+
* @date Mar. 2022, July 2023
5+
*/
6+
7+
/**
8+
* @see {@link https://eslint.org/docs/latest/use/configure/}
9+
* @type {import('eslint').Linter.Config}
10+
*/
11+
module.exports = {
12+
extends: 'eslint:recommended',
13+
globals: {
14+
'python': true
15+
},
16+
env: {
17+
browser: true,
18+
commonjs: true,
19+
es2021: true,
20+
node: true
21+
},
22+
parserOptions: {
23+
ecmaVersion: 13,
24+
sourceType: 'script',
25+
},
26+
rules: {
27+
'indent': [ 'warn', 2, {
28+
SwitchCase: 1,
29+
ignoredNodes: ['CallExpression', 'ForStatement'],
30+
}
31+
],
32+
'linebreak-style': [ 'error', 'unix' ],
33+
'quotes': [ 'warn', 'single' ],
34+
'func-call-spacing': [ 'off', 'never' ],
35+
'no-prototype-builtins': 'off',
36+
'quotes': ['warn', 'single', 'avoid-escape'],
37+
'no-empty': [ 'warn' ],
38+
'no-multi-spaces': [ 'off' ],
39+
'prettier/prettier': [ 'off' ],
40+
'vars-on-top': [ 'error' ],
41+
'no-var': [ 'off' ],
42+
'spaced-comment': [ 'warn' ],
43+
'brace-style': [ 'off' ],
44+
'no-eval': [ 'error' ],
45+
'object-curly-spacing': [ 'warn', 'always' ],
46+
'eqeqeq': [ 'warn', 'always' ],
47+
'no-dupe-keys': [ 'warn' ],
48+
'no-constant-condition': [ 'warn' ],
49+
'no-extra-boolean-cast': [ 'warn' ],
50+
'no-sparse-arrays': [ 'off' ],
51+
'no-inner-declarations': [ 'off' ],
52+
'no-loss-of-precision': [ 'warn' ],
53+
'require-atomic-updates': [ 'warn' ],
54+
'no-dupe-keys': [ 'warn' ],
55+
'no-dupe-class-members': [ 'warn' ],
56+
'no-fallthrough': [ 'warn', { commentPattern: 'fall[ -]*through' }],
57+
'no-invalid-this': [ 'error' ],
58+
'no-return-assign': [ 'error' ],
59+
'no-return-await': [ 'warn' ],
60+
'no-unused-expressions': [ 'warn', { allowShortCircuit: true, allowTernary: true } ],
61+
'prefer-promise-reject-errors': [ 'error' ],
62+
'no-throw-literal': [ 'error' ],
63+
'semi': [ 'off', { omitLastInOneLineBlock: true }], /* does not work right with exports.X = function allmanStyle */
64+
'semi-style': [ 'warn', 'last' ],
65+
'semi-spacing': [ 'error', {'before': false, 'after': true}],
66+
'no-extra-semi': [ 'warn' ],
67+
'no-tabs': [ 'error' ],
68+
'symbol-description': [ 'error' ],
69+
'operator-linebreak': [ 'warn', 'before' ],
70+
'new-cap': [ 'warn' ],
71+
'consistent-this': [ 'error', 'that' ],
72+
'no-use-before-define': [ 'error', { functions: false, classes: false } ],
73+
'no-shadow': [ 'error' ],
74+
'no-label-var': [ 'error' ],
75+
'radix': [ 'error' ],
76+
'no-self-compare': [ 'error' ],
77+
'require-await': [ 'error' ],
78+
'require-yield': [ 'error' ],
79+
'no-promise-executor-return': [ 'off' ],
80+
'no-template-curly-in-string': [ 'warn' ],
81+
'no-unmodified-loop-condition': [ 'warn' ],
82+
'no-unused-private-class-members': [ 'warn' ],
83+
'no-use-before-define': [ 'error', { functions: false, classes: true, variables: true }],
84+
'no-implicit-coercion': [1, {
85+
disallowTemplateShorthand: false,
86+
boolean: true,
87+
number: true,
88+
string: true,
89+
allow: ['!!'] /* really only want to allow if(x) and if(!x) but not if(!!x) */
90+
}],
91+
'no-trailing-spaces': [ 'off', {
92+
skipBlankLines: true,
93+
ignoreComments: true
94+
}
95+
],
96+
'no-unused-vars': ['warn', {
97+
vars: 'all',
98+
args: 'none',
99+
ignoreRestSiblings: false
100+
}],
101+
}
102+
};
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: File a Bug Report for PythonMonkey
2+
description: Use this template to report PythonMonkey-related issues. Thank you so much for making an issue!
3+
body:
4+
- type: dropdown
5+
id: issue-type
6+
attributes:
7+
label: Issue type
8+
description: What type of issue would you like to report?
9+
multiple: false
10+
options:
11+
- Bug
12+
- Build/Install
13+
- Performance
14+
- Support
15+
- Documentation Bug / Error
16+
- Other
17+
validations:
18+
required: true
19+
20+
- type: dropdown
21+
id: source
22+
attributes:
23+
label: How did you install PythonMonkey?
24+
options:
25+
- Source
26+
- Installed from pip
27+
- Other (Please specify in additional info)
28+
29+
- type: input
30+
id: OS
31+
attributes:
32+
label: OS platform and distribution
33+
placeholder: e.g., Linux Ubuntu 22.04
34+
35+
- type: input
36+
id: Python
37+
attributes:
38+
label: Python version (`python --version`)
39+
placeholder: e.g., 3.9
40+
41+
- type: input
42+
id: PythonMonkey
43+
attributes:
44+
label: PythonMonkey version (`pip show pythonmonkey`)
45+
placeholder: 0.2.0 or 0.0.1.dev997+1eb883
46+
description: You can also get this with `pmjs --version`.
47+
48+
- type: textarea
49+
id: what-happened
50+
attributes:
51+
label: Bug Description
52+
description: Please provide a clear and concise description of what the bug is.
53+
54+
- type: textarea
55+
id: code-to-reproduce
56+
attributes:
57+
label: Standalone code to reproduce the issue
58+
description: Provide a reproducible test case that is the bare minimum necessary to generate the problem.
59+
value:
60+
render: shell
61+
62+
- type: textarea
63+
id: logs
64+
attributes:
65+
label: Relevant log output or backtrace
66+
description: Please copy and paste any relevant log output.
67+
render: shell
68+
69+
- type: textarea
70+
id: additional-info
71+
attributes:
72+
label: Additional info if applicable
73+
description: Anything else to add.
74+
render: shell
75+
76+
- type: input
77+
id: branch
78+
attributes:
79+
label: What branch of PythonMonkey were you developing on? (If applicable)
80+
placeholder: main
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Make a Feature Request for PythonMonkey
2+
description: Use this template to make feature requests for PythonMonkey. Thank you so much for making an issue!
3+
body:
4+
5+
- type: textarea
6+
id: feature-body
7+
attributes:
8+
label: Describe your feature request here.
9+
description: Feel free to include diagrams drawings or anything else to help explain it.
10+
11+
- type: textarea
12+
id: feature-code
13+
attributes:
14+
label: Code example
15+
description: Provide a code example of this feature if applicable.
16+
value:
17+
render: shell
18+

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "npm" # See documentation for possible values
9+
directory: "/python/pminit/pythonmonkey" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,9 @@ jobs:
156156
path: ./dist/
157157
- name: Run Python tests (pytest)
158158
run: |
159-
poetry run python -m pip install --force-reinstall ./dist/*
159+
poetry run python -m pip install --force-reinstall --verbose ./dist/*
160160
poetry run python -m pytest tests/python
161161
- name: Run JS tests (peter-jr)
162-
if: ${{ runner.os != 'Windows' }} # Python on Windows doesn't have the readline library
163-
# FIXME: on macOS we must make sure to use the GNU version of wc and realpath
164162
run: |
165163
poetry run bash ./peter-jr ./tests/js/
166164
sdist:
@@ -253,10 +251,10 @@ jobs:
253251
html="<html><head><title>PythonMonkey Nightly Builds</title></head><body>"
254252
html+="<h1>PythonMonkey Nightly Builds</h1>"
255253
html+="<p>To install nightly builds, run</p>"
256-
html+="<pre>pip install -i https://nightly.pythonmonkey.io/ --pre pythonmonkey</pre>"
254+
html+="<pre>pip install --extra-index-url https://nightly.pythonmonkey.io/ --pre pythonmonkey</pre>"
257255
html+="<h3>Browse files:</h3>"
258-
html+="<a href="pythonmonkey/">pythonmonkey</a>"
259-
html+="<a href="pminit/">pminit</a>"
256+
html+="<li><a href="pythonmonkey/">pythonmonkey</a></li>"
257+
html+="<li><a href="pminit/">pminit</a></li>"
260258
html+="</body></html>"
261259
echo "$html" > ./index.html
262260
- uses: actions/upload-pages-artifact@v1

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ dist
1717
*.dylib
1818
*.dll
1919
*.pyd
20+
*~
21+
# Virtual Environment
22+
.venv/

.vscode/tasks.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,24 @@
4949
"./tests/python"
5050
],
5151
},
52+
{
53+
"label": "Run JS tests",
54+
"type": "process",
55+
"command": "poetry",
56+
"args": [
57+
"run",
58+
"bash",
59+
"./peter-jr",
60+
"./tests/js/"
61+
],
62+
},
5263
{
5364
"label": "Test",
5465
"dependsOrder": "sequence",
5566
"dependsOn": [
5667
"Install development dependencies",
5768
"Run pytest",
69+
"Run JS tests",
5870
],
5971
"group": {
6072
"kind": "test",

CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ set(CMAKE_CXX_EXTENSIONS OFF)
1414

1515
# Add an external; appends to `PYTHONMONKEY_EXTERNAL_FILES` in the parent scope.
1616
function(pythonmonkey_add_external PYTHONMONKEY_EXTERNAL)
17-
add_subdirectory("externals/${PYTHONMONKEY_EXTERNAL}")
18-
set(PYTHONMONKEY_EXTERNAL_FILE "externals/${PYTHONMONKEY_EXTERNAL}/CMakeLists.txt")
17+
add_subdirectory("cmake/externals/${PYTHONMONKEY_EXTERNAL}")
18+
set(PYTHONMONKEY_EXTERNAL_FILE "cmake/externals/${PYTHONMONKEY_EXTERNAL}/CMakeLists.txt")
1919
source_group(
20-
TREE "${CMAKE_CURRENT_SOURCE_DIR}/externals/${PYTHONMONKEY_EXTERNAL}"
20+
TREE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/externals/${PYTHONMONKEY_EXTERNAL}"
2121
PREFIX "Externals\\${PYTHONMONKEY_EXTERNAL}"
2222
FILES "${PYTHONMONKEY_EXTERNAL_FILE}"
2323
)
@@ -69,7 +69,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
6969
# Add doxygen if this is the main app
7070
find_package(Doxygen)
7171
if(Doxygen_FOUND)
72-
add_subdirectory(docs)
72+
add_subdirectory(cmake/docs)
7373
else()
7474
message(STATUS "Doxygen not found. Not building docs.")
7575
endif()
@@ -81,4 +81,4 @@ add_subdirectory(src)
8181

8282
pythonmonkey_add_external("uncrustify")
8383
pythonmonkey_add_external("autopep8")
84-
add_subdirectory(format)
84+
add_subdirectory(cmake/format)

0 commit comments

Comments
 (0)