diff --git a/README.md b/README.md index 22b9eafa..ad426539 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # pocketpy: python interpreter in 1 file

- - - + + + C++17 @@ -42,10 +42,10 @@ These platforms are officially tested. ## Quick Start -Download the `pocketpy.h` on our [GitHub Release](https://github.com/blueloveTH/pocketpy/releases) page. +Download the `pocketpy.h` on our [GitHub Release](https://github.com/pocketpy/pocketpy/releases) page. And `#include` it in your project. -You can also use cmake to build it from source. See [CMakeLists.txt](https://github.com/blueloveTH/pocketpy/blob/main/CMakeLists.txt) for details. +You can also use cmake to build it from source. See [CMakeLists.txt](https://github.com/pocketpy/pocketpy/blob/main/CMakeLists.txt) for details. These variables can be set to control the build process: + `PK_BUILD_STATIC_LIB` - Build the static library (default, recommended) + `PK_BUILD_SHARED_LIB` - Build the shared library @@ -149,10 +149,10 @@ And these are the results of the primes benchmark on Intel i5-12400F, WSL (Ubunt | name | version | time | file | | ---- | ---- | ---- | ---- | -| c++ | gnu++11 | `0.104s ■□□□□□□□□□□□□□□□` | [benchmarks/primes.cpp](https://github.com/blueloveTH/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.cpp) | -| lua | 5.3.3 | `1.576s ■■■■■■■■■□□□□□□□` | [benchmarks/primes.lua](https://github.com/blueloveTH/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.lua) | -| pkpy | 1.2.7 | `2.385s ■■■■■■■■■■■■■□□□` | [benchmarks/primes.py](https://github.com/blueloveTH/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.py) | -| cpython | 3.8.10 | `2.871s ■■■■■■■■■■■■■■■■` | [benchmarks/primes.py](https://github.com/blueloveTH/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.py) | +| c++ | gnu++11 | `0.104s ■□□□□□□□□□□□□□□□` | [benchmarks/primes.cpp](https://github.com/pocketpy/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.cpp) | +| lua | 5.3.3 | `1.576s ■■■■■■■■■□□□□□□□` | [benchmarks/primes.lua](https://github.com/pocketpy/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.lua) | +| pkpy | 1.2.7 | `2.385s ■■■■■■■■■■■■■□□□` | [benchmarks/primes.py](https://github.com/pocketpy/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.py) | +| cpython | 3.8.10 | `2.871s ■■■■■■■■■■■■■■■■` | [benchmarks/primes.py](https://github.com/pocketpy/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.py) | ## Used By diff --git a/README_zh.md b/README_zh.md index c8933bb3..56b1c9ca 100644 --- a/README_zh.md +++ b/README_zh.md @@ -1,9 +1,9 @@ # pocketpy: python interpreter in 1 file

- - - + + + GitHub @@ -31,7 +31,7 @@ pkpy 支持任何拥有 C++17 编译器的平台。 ## 快速上手 -你可以在 [Github Release](https://github.com/blueloveTH/pocketpy/releases) 页面下载 `pocketpy.h`, +你可以在 [Github Release](https://github.com/pocketpy/pocketpy/releases) 页面下载 `pocketpy.h`, 并加入到你的工程中。请参阅 https://pocketpy.dev 以获取更详细的文档。 ```cpp diff --git a/amalgamate.py b/amalgamate.py index cc9e553b..274753c1 100644 --- a/amalgamate.py +++ b/amalgamate.py @@ -65,7 +65,7 @@ with open("amalgamated/pocketpy.h", "wt", encoding='utf-8') as f: r'''/* * Copyright (c) 2023 blueloveTH * Distributed Under The MIT License - * https://github.com/blueloveTH/pocketpy + * https://github.com/pocketpy/pocketpy */ #ifndef POCKETPY_H diff --git a/docs/bindings.md b/docs/bindings.md index 267b1baf..b2912d15 100644 --- a/docs/bindings.md +++ b/docs/bindings.md @@ -262,6 +262,6 @@ It takes a C header file and generates a python module stub (`*.pyi`) and a C++ ## Further reading -See [random.cpp](https://github.com/blueloveTH/pocketpy/blob/main/src/random.cpp) for an example used by `random` module. +See [random.cpp](https://github.com/pocketpy/pocketpy/blob/main/src/random.cpp) for an example used by `random` module. -See [collections.cpp](https://github.com/blueloveTH/pocketpy/blob/main/src/collections.cpp) for a modern implementation of `collections.deque`. \ No newline at end of file +See [collections.cpp](https://github.com/pocketpy/pocketpy/blob/main/src/collections.cpp) for a modern implementation of `collections.deque`. \ No newline at end of file diff --git a/docs/bindings_lua.md b/docs/bindings_lua.md index 930e950b..bbcad7de 100644 --- a/docs/bindings_lua.md +++ b/docs/bindings_lua.md @@ -12,7 +12,7 @@ pkpy provides a lua bridge to reuse lua bindings. It allows you to run lua code and call lua functions in python by embedding a lua virtual machine. -Add `lua_bridge.hpp` and `lua_bridge.cpp` in [3rd/lua_bridge](https://github.com/blueloveTH/pocketpy/tree/main/3rd/lua_bridge) to your project. +Add `lua_bridge.hpp` and `lua_bridge.cpp` in [3rd/lua_bridge](https://github.com/pocketpy/pocketpy/tree/main/3rd/lua_bridge) to your project. Make sure `lua.h`, `lualib.h` and `lauxlib.h` are in your include path because `lua_bridge.hpp` needs them. diff --git a/docs/features/differences.md b/docs/features/differences.md index d8045c9b..90a66194 100644 --- a/docs/features/differences.md +++ b/docs/features/differences.md @@ -35,7 +35,7 @@ The easiest way to test a feature is to [try it on your browser](https://pocketp 4. `int` does not derive from `bool`. 5. `int` is 64-bit. You can use `long` type explicitly for arbitrary sized integers. 6. `__ne__` is not required. Define `__eq__` is enough. -7. Raw string cannot have boundary quotes in it, even escaped. See [#55](https://github.com/blueloveTH/pocketpy/issues/55). +7. Raw string cannot have boundary quotes in it, even escaped. See [#55](https://github.com/pocketpy/pocketpy/issues/55). 8. In a starred unpacked assignment, e.g. `a, b, *c = x`, the starred variable can only be presented in the last position. `a, *b, c = x` is not supported. 9. A `Tab` is equivalent to 4 spaces. You can mix `Tab` and spaces in indentation, but it is not recommended. 10. `%`, `&`, `//`, `^` and `|` for `int` behave the same as C, not python. diff --git a/docs/features/long.md b/docs/features/long.md index 85848a32..b52a9084 100644 --- a/docs/features/long.md +++ b/docs/features/long.md @@ -6,7 +6,7 @@ title: Arbitrary Sized Integers Unlike cpython, pkpy's `int` is of limited precision (64-bit). For arbitrary sized integers, we provide a builtin `long` type, just like python2's `long`. -`long` is implemented via pure python in [_long.py](https://github.com/blueloveTH/pocketpy/blob/main/python/_long.py). +`long` is implemented via pure python in [_long.py](https://github.com/pocketpy/pocketpy/blob/main/python/_long.py). !!! This feature is still under development. diff --git a/docs/modules/box2d.md b/docs/modules/box2d.md index c3d05eab..22f83e77 100644 --- a/docs/modules/box2d.md +++ b/docs/modules/box2d.md @@ -39,7 +39,7 @@ It hides the details of Box2D's API and provides a high-level interface. ## APIs -https://github.com/blueloveTH/pocketpy/blob/main/include/typings/box2d.pyi +https://github.com/pocketpy/pocketpy/blob/main/include/typings/box2d.pyi ## Example diff --git a/docs/modules/c.md b/docs/modules/c.md index f7800648..4f1909df 100644 --- a/docs/modules/c.md +++ b/docs/modules/c.md @@ -5,4 +5,4 @@ label: c Interop with pointers and C structs. -https://github.com/blueloveTH/pocketpy/blob/main/include/typings/c.pyi \ No newline at end of file +https://github.com/pocketpy/pocketpy/blob/main/include/typings/c.pyi \ No newline at end of file diff --git a/docs/modules/linalg.md b/docs/modules/linalg.md index 18aef88f..b7740e05 100644 --- a/docs/modules/linalg.md +++ b/docs/modules/linalg.md @@ -7,7 +7,7 @@ Provide `mat3x3`, `vec2`, `vec3` and `vec4` types. This classes adopt `torch`'s naming convention. Methods with `_` suffix will modify the instance itself. -https://github.com/blueloveTH/pocketpy/blob/main/include/typings/linalg.pyi +https://github.com/pocketpy/pocketpy/blob/main/include/typings/linalg.pyi ```python from typing import overload diff --git a/docs/performance.md b/docs/performance.md index eb94ca12..1fb4d891 100644 --- a/docs/performance.md +++ b/docs/performance.md @@ -126,7 +126,7 @@ Testing directory: benchmarks/ ALL TESTS PASSED ``` -See [actions/runs](https://github.com/blueloveTH/pocketpy/actions/runs/6511071423/job/17686074263). +See [actions/runs](https://github.com/pocketpy/pocketpy/actions/runs/6511071423/job/17686074263). ## Primes benchmarks @@ -134,10 +134,10 @@ These are the results of the primes benchmark on Intel i5-12400F, WSL (Ubuntu 20 | name | version | time | file | | ---- | ---- | ---- | ---- | -| c++ | gnu++11 | `0.104s ■□□□□□□□□□□□□□□□` | [benchmarks/primes.cpp](https://github.com/blueloveTH/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.cpp) | -| lua | 5.3.3 | `1.576s ■■■■■■■■■□□□□□□□` | [benchmarks/primes.lua](https://github.com/blueloveTH/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.lua) | -| pkpy | 1.2.7 | `2.385s ■■■■■■■■■■■■■□□□` | [benchmarks/primes.py](https://github.com/blueloveTH/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.py) | -| cpython | 3.8.10 | `2.871s ■■■■■■■■■■■■■■■■` | [benchmarks/primes.py](https://github.com/blueloveTH/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.py) | +| c++ | gnu++11 | `0.104s ■□□□□□□□□□□□□□□□` | [benchmarks/primes.cpp](https://github.com/pocketpy/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.cpp) | +| lua | 5.3.3 | `1.576s ■■■■■■■■■□□□□□□□` | [benchmarks/primes.lua](https://github.com/pocketpy/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.lua) | +| pkpy | 1.2.7 | `2.385s ■■■■■■■■■■■■■□□□` | [benchmarks/primes.py](https://github.com/pocketpy/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.py) | +| cpython | 3.8.10 | `2.871s ■■■■■■■■■■■■■■■■` | [benchmarks/primes.py](https://github.com/pocketpy/pocketpy/blob/9481d653b60b81f4590a4d48f2be496f6962261e/benchmarks/primes.py) | ```sh $ time lua benchmarks/primes.lua diff --git a/docs/quick-start/config.md b/docs/quick-start/config.md index bf546a76..265e9042 100644 --- a/docs/quick-start/config.md +++ b/docs/quick-start/config.md @@ -27,6 +27,6 @@ You can do the following to ensure thread safety for `VM` instances: You can create a `user_config.h` in the same directory as `pocketpy.h` to override some default settings. -1. Copy [src/config.h](https://github.com/blueloveTH/pocketpy/blob/main/include/pocketpy/config.h) and rename it to `user_config.h`. +1. Copy [src/config.h](https://github.com/pocketpy/pocketpy/blob/main/include/pocketpy/config.h) and rename it to `user_config.h`. 2. Define a macro `PK_USER_CONFIG_H` in `user_config.h`. This invalidates the default `config.h` and enables your `user_config.h`. 3. Edit `user_config.h` to override default settings. diff --git a/docs/quick-start/installation.md b/docs/quick-start/installation.md index 5def2d9b..2640da62 100644 --- a/docs/quick-start/installation.md +++ b/docs/quick-start/installation.md @@ -8,7 +8,7 @@ You have two options to integrate pkpy into your project. #### Use the single header file -Download the `pocketpy.h` on our [GitHub Release](https://github.com/blueloveTH/pocketpy/releases) page. +Download the `pocketpy.h` on our [GitHub Release](https://github.com/pocketpy/pocketpy/releases) page. And `#include` it in your project. It is recommended to use the latest dev version. #### Use CMake @@ -34,7 +34,7 @@ These variables can be set to control the build process: + `PK_BUILD_STATIC_LIB` - Build the static library + `PK_BUILD_SHARED_LIB` - Build the shared library -See [CMakeLists.txt](https://github.com/blueloveTH/pocketpy/blob/main/CMakeLists.txt) for details. +See [CMakeLists.txt](https://github.com/pocketpy/pocketpy/blob/main/CMakeLists.txt) for details. It is safe to use `main` branch in production. @@ -52,7 +52,7 @@ See https://emscripten.org/docs/porting/exceptions.html. ### Get prebuilt binaries We have prebuilt binaries, -check them out on our [GitHub Actions](https://github.com/blueloveTH/pocketpy/actions/workflows/main.yml). +check them out on our [GitHub Actions](https://github.com/pocketpy/pocketpy/actions/workflows/main.yml). You can download an artifact there which contains the following files. diff --git a/docs/unity/introduction.md b/docs/unity/introduction.md index 8d35515b..8832dd9f 100644 --- a/docs/unity/introduction.md +++ b/docs/unity/introduction.md @@ -20,12 +20,12 @@ You cannot use it to run NumPy, OpenCV, or any other CPython extension modules. ### Python 3.x Syntax -PocketPython uses [pocketpy](https://github.com/blueloveTH/pocketpy) +PocketPython uses [pocketpy](https://github.com/pocketpy/pocketpy) as frontend to parse and compile Python source code. It supports most of the Python 3.x syntax. The following table shows a feature comparison of PocketPython -with respect to the original [pocketpy](https://github.com/blueloveTH/pocketpy). +with respect to the original [pocketpy](https://github.com/pocketpy/pocketpy). The features marked with `YES` are supported, and the features marked with `NO` are not supported. | Name | Example | Cpp | Unity | diff --git a/include/pocketpy/gc.h b/include/pocketpy/gc.h index fa1424e2..48479de5 100644 --- a/include/pocketpy/gc.h +++ b/include/pocketpy/gc.h @@ -39,7 +39,7 @@ struct ManagedHeap{ template PyObject* gcnew(Type type, Args&&... args){ using __T = Py_>; - // https://github.com/blueloveTH/pocketpy/issues/94#issuecomment-1594784476 + // https://github.com/pocketpy/pocketpy/issues/94#issuecomment-1594784476 PyObject* obj = new(pool64_alloc<__T>()) Py_>(type, std::forward(args)...); gen.push_back(obj); gc_counter++; @@ -49,7 +49,7 @@ struct ManagedHeap{ template PyObject* _new(Type type, Args&&... args){ using __T = Py_>; - // https://github.com/blueloveTH/pocketpy/issues/94#issuecomment-1594784476 + // https://github.com/pocketpy/pocketpy/issues/94#issuecomment-1594784476 PyObject* obj = new(pool64_alloc<__T>()) Py_>(type, std::forward(args)...); obj->gc.enabled = false; _no_gc.push_back(obj); diff --git a/src/compiler.cpp b/src/compiler.cpp index 0173a491..e230556a 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -223,7 +223,7 @@ namespace pkpy{ _compile_f_args(e->decl, false); consume(TK(":")); } - // https://github.com/blueloveTH/pocketpy/issues/37 + // https://github.com/pocketpy/pocketpy/issues/37 parse_expression(PREC_LAMBDA + 1); ctx()->emit_expr(); ctx()->emit_(OP_RETURN_VALUE, BC_NOARG, BC_KEEPLINE); diff --git a/tests/99_bugs.py b/tests/99_bugs.py index b6563d92..1140442c 100644 --- a/tests/99_bugs.py +++ b/tests/99_bugs.py @@ -1,4 +1,4 @@ -# https://github.com/blueloveTH/pocketpy/issues/37 +# https://github.com/pocketpy/pocketpy/issues/37 mp = map(lambda x: x**2, [1, 2, 3, 4, 5] ) assert list(mp) == [1, 4, 9, 16, 25]