Skip to content

Commit 23bc9cf

Browse files
committed
Update .gitignore, Makefile, README, setup.py, and GitHub workflows for improved testing and publishing
1 parent bde2dd2 commit 23bc9cf

7 files changed

Lines changed: 56 additions & 31 deletions

File tree

.github/workflows/publish.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ jobs:
1717
runs-on: ${{ matrix.os }}
1818
strategy:
1919
matrix:
20-
os: [ubuntu-22.04, windows-2022, macOS-12]
20+
os: [ubuntu-latest, windows-latest, macOS-latest, macos-13, ubuntu-24.04-arm, ]
2121

2222
steps:
23-
- uses: actions/checkout@v3
23+
- uses: actions/checkout@v4
2424
with:
2525
ref: ${{ github.event.inputs.branch }}
2626

27-
- name: Set up Python 3.10
28-
uses: actions/setup-python@v4
27+
- name: Set up Python 3.12
28+
uses: actions/setup-python@v5
2929
with:
30-
python-version: "3.10"
30+
python-version: "3.12"
3131

3232
- name: Install cibuildwheel
33-
run: python -m pip install cibuildwheel==2.15.0
33+
run: python -m pip install cibuildwheel==2.23.2
3434

3535
- name: Build wheels
3636
run: python -m cibuildwheel --output-dir wheelhouse
@@ -41,29 +41,29 @@ jobs:
4141

4242
build_sdist:
4343
name: Build source distribution
44-
runs-on: ubuntu-22.04
44+
runs-on: ubuntu-latest
4545
steps:
46-
- uses: actions/checkout@v3
46+
- uses: actions/checkout@v4
4747
with:
4848
ref: ${{ github.event.inputs.branch }}
4949

50-
- name: Set up Python 3.10
51-
uses: actions/setup-python@v4
50+
- name: Set up Python 3.12
51+
uses: actions/setup-python@v5
5252
with:
53-
python-version: "3.10"
53+
python-version: "3.12"
5454

5555
- name: Build sdist
5656
run: python setup.py sdist
5757

58-
- uses: actions/upload-artifact@v3
58+
- uses: actions/upload-artifact@v4
5959
with:
6060
path: dist/*.tar.gz
6161

6262
publish:
6363
needs: [build_wheels, build_sdist]
64-
runs-on: ubuntu-22.04
64+
runs-on: ubuntu-latest
6565
steps:
66-
- uses: actions/download-artifact@v3
66+
- uses: actions/download-artifact@v4
6767
with:
6868
name: artifact
6969
path: dist
@@ -72,11 +72,11 @@ jobs:
7272
with:
7373
user: __token__
7474
password: ${{ secrets.PYPI_TEST_TOKEN }}
75-
repository_url: https://test.pypi.org/legacy/
75+
repository-url: https://test.pypi.org/legacy/
7676
if: ${{ github.event.inputs.target == 'all' || github.event.inputs.target == 'test' }}
7777
- name: Publish package to PyPI
7878
uses: pypa/gh-action-pypi-publish@release/v1
7979
with:
8080
user: __token__
8181
password: ${{ secrets.PYPI_TOKEN }}
82-
if: ${{ github.event.inputs.target == 'all' || github.event.inputs.target == 'live' }}
82+
if: github.event.inputs.target == 'all' || github.event.inputs.target == 'live'

.github/workflows/run-tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
python-version: ["3.8", "3.9", "3.10", "3.11"]
11+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- name: Set up Python ${{ matrix.python-version }}
15-
uses: actions/setup-python@v4
15+
uses: actions/setup-python@v5
1616
with:
1717
python-version: ${{ matrix.python-version }}
1818
- name: Install dependencies
1919
run: |
2020
python -m pip install --upgrade pip
21-
pip install -U setuptools flake8 pytest
22-
python setup.py install
21+
pip install -U flake8 pytest
22+
pip install -e .
2323
- name: Test with pytest
2424
run: |
2525
python -c 'import pyduktape2; ctx = pyduktape2.DuktapeContext(); ctx.eval_js("print(\"Duktape Version: \" + Duktape.version)")'

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ pyduktape2*.so
88
pyduktape2.egg-info
99
/.idea
1010
/cython_debug
11-
pyduktape2.html
11+
pyduktape2.html
12+
.pytest_cache

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
unittest:
44
python -m unittest
55

6+
pytest:
7+
python -m pytest
8+
69
clean:
710
python setup.py clean
8-
rm -rf pyduktape2.c build/ dist/ pyduktape2.egg-info/ .eggs/ *.so pyduktape2.html cython_debug
11+
rm -rf pyduktape2.c build/ dist/ pyduktape2.egg-info/ .eggs/ *.so pyduktape2.html cython_debug .pytest_cache
912

1013
build:
1114
python setup.py build_ext --inplace

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ You can use ``set_globals`` to set Javascript global variables::
102102
import pyduktape2
103103

104104
def say_hello(to):
105-
print 'Hello, {}!'.format(to)
105+
print('Hello, {}!'.format(to))
106106

107107
context = pyduktape2.DuktapeContext()
108108
context.set_globals(sayHello=say_hello, world='World')
@@ -114,15 +114,15 @@ You can use ``get_global`` to access Javascript global variables::
114114

115115
context = pyduktape2.DuktapeContext()
116116
context.eval_js("var helloWorld = 'Hello, World!';")
117-
print context.get_global('helloWorld')
117+
print(context.get_global('helloWorld'))
118118

119119
``eval_js`` returns the value of the last expression::
120120

121121
import pyduktape2
122122

123123
context = pyduktape2.DuktapeContext()
124124
hello_world = context.eval_js("var helloWorld = 'Hello, World!'; helloWorld")
125-
print hello_world
125+
print(hello_world)
126126

127127
You can seamlessly use Python objects and functions within Javascript
128128
code. There are some limitations, though: any Python callable can
@@ -192,4 +192,4 @@ You can use Python lists and dicts from Javascript, and viceversa::
192192
}
193193
""")
194194
context.set_globals(x=dict(a=1, b=2))
195-
context.eval_js('for (var k in x) { print(k + ' = ' + x[k]); }')
195+
context.eval_js('for (var k in x) { print(k + " = " + x[k]); }')

pyproject.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[build-system]
2+
requires = ["setuptools>=18.0", "Cython>=3"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "pyduktape2"
7+
version = "0.5.0"
8+
description = "Python integration for the Duktape Javascript interpreter"
9+
readme = "README.rst"
10+
requires-python = ">=3.6"
11+
license = {text = "GPL-2.0-only"}
12+
authors = [
13+
{name = "Stefano Dissegna"}
14+
]
15+
keywords = ["javascript", "duktape", "embed"]
16+
classifiers = [
17+
"Development Status :: 2 - Pre-Alpha",
18+
"Programming Language :: Cython",
19+
"Programming Language :: Python :: 3",
20+
"Programming Language :: JavaScript",
21+
"Topic :: Software Development :: Interpreters",
22+
]
23+
24+
[project.urls]
25+
Homepage = "https://github.com/phith0n/pyduktape2"

setup.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,8 @@
1616
include_dirs=['vendor'],
1717
)
1818
],
19-
gdb_debug=True,
20-
annotate=True,
2119
compiler_directives={
2220
'language_level': 3,
23-
'boundscheck': True,
24-
'wraparound': True,
2521
}
2622
)
2723

0 commit comments

Comments
 (0)