-
Notifications
You must be signed in to change notification settings - Fork 0
Build from Source
python-template-cppjswasm is written in Python, C++, and JavaScript. While prebuilt wheels are provided for end users, it is also straightforward to build python-template-cppjswasm from either the Python source distribution or the GitHub repository.
As a convenience, python-template-cppjswasm uses a Makefile for commonly used commands. You can print the main available commands by running make with no arguments
> make
build build the library
clean clean the repository
fix run autofixers
install install library
lint run lints
test run the testspython-template-cppjswasm has a few system-level dependencies which you can install from your machine package manager. Other package managers like conda, nix, etc, should also work fine.
Clone the repo with:
git clone https://github.com/python-project-templates/python-template-cppjswasm.git
cd python-template-cppjswasmEnsure you have a C++ compiler available (e.g. g++, clang++, or MSVC on Windows).
Follow the instructions for installing Emscripten SDK for your system. This is required for building the JavaScript/WebAssembly bindings.
Python build and develop dependencies are specified in the pyproject.toml, but you can manually install them:
make requirementsNote that these dependencies would otherwise be installed normally as part of PEP517 / PEP518.
Build the python project in the usual manner:
make buildpython-template-cppjswasm has linting and auto formatting.
| Language | Linter | Autoformatter | Description |
|---|---|---|---|
| Python | ruff |
ruff |
Style |
| Python | ruff |
ruff |
Imports |
| C++ | clang-format |
clang-format |
Style |
| JavaScript | oxlint |
oxfmt |
Style |
| Markdown | mdformat |
mdformat |
Style |
| Markdown | codespell |
Spelling |
Python Linting
make lint-pyPython Autoformatting
make fix-pyC++ Linting
make lint-cppC++ Autoformatting
make fix-cppJavaScript Linting
make lint-jsJavaScript Autoformatting
make fix-jsDocumentation Linting
make lint-docsDocumentation Autoformatting
make fix-docspython-template-cppjswasm has both Python and JavaScript tests. The bulk of the functionality is tested in Python, which can be run via pytest. First, install the Python development dependencies with
make developPython
make test-pyJavaScript
make test-jsThis wiki is autogenerated. To made updates, open a PR against the original source file in docs/wiki.