-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nodejs-polars): bindings for nodejs (#1703)
- Loading branch information
1 parent
d3b0f0d
commit fb4dd2b
Showing
98 changed files
with
27,223 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
name: nodejs-polars | ||
|
||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'nodejs-polars-v*' # Push events to matching nodejs-polars-v*, i.e. nodejs-polars-v1.0, nodejs-polars-v20.15.10 | ||
jobs: | ||
build-js: | ||
defaults: | ||
run: | ||
working-directory: nodejs-polars | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
settings: | ||
# MAC | ||
###### | ||
|
||
- host: macos-latest | ||
target: 'x86_64-apple-darwin' | ||
build: | | ||
npm run build | ||
- host: macos-latest | ||
target: "aarch64-apple-darwin" | ||
build: | | ||
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*; | ||
export CC=$(xcrun -f clang); | ||
export CXX=$(xcrun -f clang++); | ||
SYSROOT=$(xcrun --sdk macosx --show-sdk-path); | ||
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT"; | ||
npm run build -- --target aarch64-apple-darwin | ||
# Windows | ||
########## | ||
|
||
- host: windows-latest | ||
target: "x86_64-pc-windows-msvc" | ||
build: npm run build | ||
|
||
- host: windows-latest | ||
target: "i686-pc-windows-msvc" | ||
setup: | | ||
choco install nodejs-lts --x86 -y --force | ||
echo "C:\\Program Files (x86)\\nodejs" >> $GITHUB_PATH | ||
build: | | ||
export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=32; | ||
export CARGO_PROFILE_RELEASE_LTO=false | ||
npm run build -- --target i686-pc-windows-msvc | ||
- host: windows-latest | ||
target: "aarch64-pc-windows-msvc" | ||
build: npm run build -- --target aarch64-pc-windows-msvc | ||
|
||
# Linux | ||
######## | ||
|
||
- host: ubuntu-latest | ||
target: "x86_64-unknown-linux-gnu" | ||
build: npm run build | ||
|
||
- host: ubuntu-latest | ||
target: "aarch64-linux-android" | ||
build: | | ||
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang" | ||
export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}" | ||
npm run build -- --target aarch64-linux-android | ||
name: ${{ matrix.settings.target }} | ||
runs-on: ${{ matrix.settings.host }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
- name: Install latest Rust nightly | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly-2021-12-02 | ||
override: true | ||
target: ${{ matrix.settings.target }} | ||
|
||
- name: Generate Cargo.lock | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: generate-lockfile | ||
|
||
- name: Cache cargo registry | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cargo/registry | ||
key: ${{ matrix.settings.target }}-node@16-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: Cache cargo index | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cargo/git | ||
key: ${{ matrix.settings.target }}-node@16-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: Pull latest image | ||
run: ${{ matrix.settings.docker }} | ||
env: | ||
DOCKER_REGISTRY_URL: ghcr.io | ||
DOCKER_USERNAME: ${{ github.actor }} | ||
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
if: ${{ matrix.settings.docker }} | ||
|
||
- name: "Setup toolchain" | ||
if: ${{ matrix.settings.setup }} | ||
run: ${{ matrix.settings.setup }} | ||
|
||
- name: "Install dependencies" | ||
run: npm install --ignore-scripts | ||
|
||
- name: "Build" | ||
run: ${{ matrix.settings.build }} | ||
shell: bash | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: nodejs-polars/artifacts | ||
- name: List artifacts | ||
run: ls -R artifacts | ||
shell: bash | ||
|
||
publish: | ||
name: Publish | ||
needs: | ||
- build-js | ||
defaults: | ||
run: | ||
working-directory: nodejs-polars | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: "16" | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: "Install dependencies" | ||
run: npm install --ignore-scripts | ||
|
||
- name: Download all artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: nodejs-polars/artifacts | ||
|
||
- name: List artifacts | ||
run: ls -R artifacts | ||
shell: bash | ||
|
||
- name: Move artifacts | ||
run: npm run artifacts | ||
|
||
- name: Build TypeScript | ||
run: npm run build:ts | ||
|
||
- name: Publish to npm | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ polars/vendor | |
*.so | ||
.ENV | ||
.env | ||
AUTO_CHANGELOG.md | ||
AUTO_CHANGELOG.md | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
[*.{js,json,yml}] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true, | ||
"jest/globals": true | ||
}, | ||
"globals": { | ||
"Buffer": "readonly", | ||
"process": "writable" | ||
}, | ||
"extends": [ | ||
"eslint:recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2020, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"jest" | ||
], | ||
"rules": { | ||
"eol-last": "error", | ||
"no-inner-declarations": "off", | ||
"func-call-spacing": "off", | ||
"@typescript-eslint/func-call-spacing": [ | ||
"error" | ||
], | ||
"no-duplicate-imports": "off", | ||
"@typescript-eslint/no-duplicate-imports": [ | ||
"error" | ||
], | ||
"comma-spacing": "off", | ||
"@typescript-eslint/comma-spacing": [ | ||
"error" | ||
], | ||
"quotes": [ | ||
"error", | ||
"double", | ||
{ | ||
"allowTemplateLiterals": true, | ||
"avoidEscape": true | ||
} | ||
], | ||
"no-redeclare": "off", | ||
"no-trailing-spaces": "error", | ||
"semi": [ | ||
"error", | ||
"always" | ||
], | ||
"indent": [ | ||
"error", | ||
2, | ||
{ | ||
"MemberExpression": 1 | ||
} | ||
], | ||
"no-dupe-class-members": "off", | ||
"no-unused-vars": "off", | ||
"newline-per-chained-call": [ | ||
"error", | ||
{ | ||
"ignoreChainWithDepth": 2 | ||
} | ||
], | ||
"@typescript-eslint/member-ordering": "error", | ||
"no-multiple-empty-lines": [ | ||
"error", | ||
{ | ||
"max": 2, | ||
"maxEOF": 0 | ||
} | ||
], | ||
"padding-line-between-statements": [ | ||
"error", | ||
{ | ||
"blankLine": "always", | ||
"prev": "*", | ||
"next": "return" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/target | ||
**/*.rs.bk | ||
Cargo.lock | ||
node_modules/ | ||
.yarn/cache | ||
.yarn/install-state* | ||
.pnp.* | ||
|
||
coverage/ | ||
bin/ | ||
.vscode | ||
.cargo | ||
*.node | ||
docs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
target | ||
Cargo.lock | ||
.cargo | ||
.github | ||
npm | ||
# .eslintrc | ||
.prettierignore | ||
rustfmt.toml | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
16 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
nodeLinker: node-modules | ||
yarnPath: .yarn/releases/yarn-3.1.1.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {DataFrame} from "@polars/dataframe"; | ||
import {Series} from "@polars/series"; | ||
|
||
declare global { | ||
namespace jest { | ||
interface Matchers<R> { | ||
toSeriesEqual(b: Series<any>): R; | ||
toSeriesStrictEqual(b: Series<any>): R; | ||
toFrameEqual(b: DataFrame): R; | ||
/** | ||
* Compares two DataFrames, including the dtypes | ||
* | ||
* @example | ||
* ``` | ||
* >>> df = pl.Dataframe([pl.Series("int32": [1,2], pl.Int32)]) | ||
* >>> other = pl.Dataframe([pl.Series("int32": [1,2], pl.UInt32)]) | ||
* | ||
* >>> expect(df).toFrameEqual(other) // passes | ||
* >>> expect(df).toFrameStrictEqual(other) // fails | ||
* ``` | ||
*/ | ||
toFrameStrictEqual(b: DataFrame): R; | ||
toFrameEqualIgnoringOrder(b: DataFrame): R; | ||
} | ||
} | ||
} |
Oops, something went wrong.