Skip to content

Commit

Permalink
rename libs and fix npm build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vemonet committed Nov 14, 2023
1 parent 759234f commit 2677090
Show file tree
Hide file tree
Showing 23 changed files with 105 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ jobs:
# working-directory: ./js
- name: NPM packing
run: npm run pack
working-directory: js/pkg
- name: NPM release
working-directory: ./js
- name: NPM upload
uses: actions/upload-artifact@v3
with:
name: nanopub_rs_npm
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
target/
pkg

# JS
node_modules/
pkg*/
package-lock.json
*.lock

# HTML docs generated by mdbook
lib/docs/docs

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 🔬🦀 Nanopub rs

[![Lint and Test](https://github.com/vemonet/nanopub-rs/actions/workflows/test.yml/badge.svg)](https://github.com/vemonet/nanopub-rs/actions/workflows/test.yml) [![Build](https://github.com/vemonet/nanopub-rs/actions/workflows/artifacts.yml/badge.svg)](https://github.com/vemonet/nanopub-rs/actions/workflows/artifacts.yml) [![Deploy docs to GitHub Pages](https://github.com/vemonet/nanopub-rs/actions/workflows/docs.yml/badge.svg)](https://github.com/vemonet/nanopub-rs/actions/workflows/docs.yml)
[![Lint and Test](https://github.com/vemonet/nanopub-rs/actions/workflows/test.yml/badge.svg)](https://github.com/vemonet/nanopub-rs/actions/workflows/test.yml) [![Build](https://github.com/vemonet/nanopub-rs/actions/workflows/build.yml/badge.svg)](https://github.com/vemonet/nanopub-rs/actions/workflows/build.yml) [![Deploy docs to GitHub Pages](https://github.com/vemonet/nanopub-rs/actions/workflows/docs.yml/badge.svg)](https://github.com/vemonet/nanopub-rs/actions/workflows/docs.yml)

A rust toolkit to sign and publish [Nanopublications](https://nanopub.org), with bindings to python and javascript (wasm).
A rust toolkit to sign and publish [Nanopublications](https://nanopub.net), with bindings to python and javascript (wasm).

## Nanopub signing process

Expand Down Expand Up @@ -88,4 +88,4 @@ https://github.com/Harzu/wasm-rsa

https://github.com/frehberg/wasm-sign

Building artefacts for many targets: https://github.com/oxigraph/oxigraph/blob/main/.github/workflows/artifacts.yml
Building artefacts for many targets: https://github.com/oxigraph/oxigraph/blob/main/.github/workflows/build.yml
2 changes: 1 addition & 1 deletion js/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ crate-type = ["cdylib"]
wasm-bindgen = "0.2"
js-sys = "0.3"
console_error_panic_hook = "0.1"
nanopub_rs = { path = "../lib" }
nanopub = { path = "../lib" }

[dev-dependencies]
wasm-bindgen-test = "0.3"
30 changes: 30 additions & 0 deletions js/build_package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#! /usr/bin/env node

// From https://github.com/vemonet/nanopub-rs/blob/main/js/build_package.js
const fs = require("fs");

// We copy file to the new directory
fs.mkdirSync("pkg");
for (const file of fs.readdirSync("./pkg-web")) {
fs.copyFileSync(`./pkg-web/${file}`, `./pkg/${file}`);
}
for (const file of fs.readdirSync("./pkg-node")) {
fs.copyFileSync(`./pkg-node/${file}`, `./pkg/${file}`);
}

const pkg = JSON.parse(fs.readFileSync("./pkg/package.json"));
pkg.name = "@nanopub/sign";
pkg.main = "node.js";
pkg.browser = "web.js";
pkg.files = ["*.{js,wasm,d.ts}"];
pkg.homepage = "https://github.com/vemonet/nanopub-rs/tree/main/js";
pkg.bugs = {
url: "https://github.com/vemonet/nanopub-rs/issues",
};
pkg.collaborators = undefined;
pkg.repository = {
type: "git",
url: "https://github.com/vemonet/nanopub-rs.git",
directory: "js",
};
fs.writeFileSync("./pkg/package.json", JSON.stringify(pkg, null, 2));
44 changes: 36 additions & 8 deletions js/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"version": "0.1.0",
"name": "nanopub-js",
"description": "JavaScript bindings for the Nanopub rust toolkit",
"license": "MIT",
"homepage": "https://github.com/vemonet/nanopub-rs",
"module": "nanopub_js.js",
"types": "nanopub_js.d.ts",
"collaborators": [
"Vincent Emonet <[email protected]>"
],
"description": "JavaScript bindings for the Nanopub rust toolkit",
"version": "0.1.0",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/vemonet/nanopub-rs/tree/main/js"
Expand All @@ -15,10 +18,35 @@
"nanopub_js.js",
"nanopub_js.d.ts"
],
"module": "nanopub_js.js",
"homepage": "https://github.com/vemonet/nanopub-rs",
"types": "nanopub_js.d.ts",
"sideEffects": [
"./snippets/*"
]
}
],
"scripts": {
"fmt": "prettier \"**/*.{ts,tsx,js,cjs,json,md,html}\" --ignore-path .gitignore --write",
"test": "wasm-pack build --debug --target nodejs && mocha",
"build": "rm -rf pkg && wasm-pack build --release --target web --out-name web && mv pkg pkg-web && wasm-pack build --release --target nodejs --out-name node && mv pkg pkg-node && node build_package.js && rm -r pkg-web && rm -r pkg-node",
"release": "npm run build && npm publish ./pkg",
"pack": "npm run build && npm pack ./pkg"
},
"standard": {
"ignore": [
"pkg*"
]
},
"devDependencies": {
"prettier": "^3.1.0"
},
"prettier": {
"trailingComma": "none",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"bracketSpacing": false,
"arrowParens": "avoid",
"useTabs": false,
"printWidth": 120,
"pluginSearchDirs": [
"."
]
}
}
2 changes: 1 addition & 1 deletion js/src/nanopub.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use nanopub_rs::nanopub::Nanopub;
use nanopub::nanopub::Nanopub;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(js_name = Nanopub)]
Expand Down
2 changes: 1 addition & 1 deletion lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "nanopub_rs"
name = "nanopub"
version = "0.1.0"
authors = ["Vincent Emonet <[email protected]>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[![Lint and Test](https://github.com/vemonet/nanopub-rs/actions/workflows/test.yml/badge.svg)](https://github.com/vemonet/nanopub-rs/actions/workflows/test.yml) [![Deploy docs to GitHub Pages](https://github.com/vemonet/nanopub-rs/actions/workflows/deploy-docs.yml/badge.svg)](https://github.com/vemonet/nanopub-rs/actions/workflows/deploy-docs.yml)

A rust toolkit to sign and publish [Nanopublications](https://nanopub.org).
A rust toolkit to sign and publish [Nanopublications](https://nanopub.net).

## Build

Expand Down
4 changes: 2 additions & 2 deletions lib/docs/src/00_introduction.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Introduction

The [nanopub_rs crate](https://crates.io/crates/sophia) aims to provide a comprehensive toolkit for working with Nanopublications and RDF in Rust.
The [nanopub crate](https://crates.io/crates/nanopub) aims to provide a comprehensive toolkit for working with Nanopublications and RDF in Rust.

RDF is a data model designed to exchange knowledge on the Web in an interoperable way. Each piece of knowledge in RDF (a statement) is represented by a triple, made of three terms. A set of triples forms an RDF graph. Finally, several graphs can be grouped in a collection called a dataset, where each graph is identified by a unique name.

## Code reference

Checkout the [documentation generated from the code](/nanopub-rs/doc/nanopub_rs)
Checkout the [documentation generated from the code](/nanopub-rs/doc/nanopub)
4 changes: 2 additions & 2 deletions lib/docs/src/01_getting_started.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Getting Started

`nanopub_rs` is a toolkit to sign and publish [Nanopublications](https://nanopub.org).
`nanopub` is a toolkit to sign and publish [Nanopublications](https://nanopub.net).


## Usage

```rust
use std::fs;
use nanopub_rs::nanopub::Nanopub;
use nanopub::nanopub::Nanopub;
let public_key = r#"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo2NYLBcZmpOkjgqLiT7hMxzRaK5KhYYHxxN2gCAMfmOaulAxAzPUNBJLIXjX3yQeIj6rAH4haWNAEUGPdiua/D+Pmu/Hrva3mK29lsWW9ajyZr0e12erDdaBw+3XfxMkKCZkLJjina6mi0W80e7Wa3+d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OgyCTTKyhDRCNcRIkysoL+DecDhNo4Fumf71tsqDYogfxpAQhn0re8wKBgQDXhMmmT2oXiMnYHhi2k7CJe3HUqkZgmW4W44SWqKHp0V6sjcHm0N0RT5Hz1BFFUd5Y0ZB3JLcah19myD1kKYCj7xz6oVLb8O7LeAZNlb0FsrtD7NU+Hciywo8qESiA7UYDkU6+hsmxaI01DsttMIdG4lSBbEjA7t4IQC5lyr7xiQKBgQCN87YGJ40Y5ZXCSgOZDepz9hqX2KGOIfnUv2HvXsIfiUwqTXs6HbD18xg3KL4myIBOvywSM+4ABYp+foY+Cpcq2btLIeZhiWjsKIrw71+Q/vIe0YDb1PGf6DsoYhmWBpdHzR9HN+hGjvwlsYny2L9Qbfhgxxmsuf7zeFLpQLijjwKBgH7TD28k8IOk5VKec2CNjKd600OYaA3UfCpP/OhDl/RmVtYoHWDcrBrRvkvEEd2/DZ8qw165Zl7gJs3vK+FTYvYVcfIzGPWA1KU7nkntwewmf3i7V8lT8ZTwVRsmObWU60ySJ8qKuwoBQodki2VX12NpMN1wgWe3qUUlr6gLJU4xAoGAet6nD3QKwk6TTmcGVfSWOzvpaDEzGkXjCLaxLKh9GreM/OE+h5aN2gUoFeQapG5rUwI/7Qq0xiLbRXw+OmfAoV2XKv7iI8DjdIh0F06mlEAwQ/B0CpbqkuuxphIbchtdcz/5ra233r3BMNIqBl3VDDVoJlgHPg9msOTRy13lFqc="#;

Expand Down
2 changes: 1 addition & 1 deletion lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod namespaces;
///
/// ```
/// use std::fs;
/// use nanopub_rs::nanopub::Nanopub;
/// use nanopub::nanopub::Nanopub;
/// let private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCjY1gsFxmak6SOCouJPuEzHNForkqFhgfHE3aAIAx+Y5q6UDEDM9Q0EksheNffJB4iPqsAfiFpY0ARQY92K5r8P4+a78eu9reYrb2WxZb1qPJmvR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pdHzR9HN+hGjvwlsYny2L9Qbfhgxxmsuf7zeFLpQLijjwKBgH7TD28k8IOk5VKec2CNjKd600OYaA3UfCpP/OhDl/RmVtYoHWDcrBrRvkvEEd2/DZ8qw165Zl7gJs3vK+FTYvYVcfIzGPWA1KU7nkntwewmf3i7V8lT8ZTwVRsmObWU60ySJ8qKuwoBQodki2VX12NpMN1wgWe3qUUlr6gLJU4xAoGAet6nD3QKwk6TTmcGVfSWOzvpaDEzGkXjCLaxLKh9GreM/OE+h5aN2gUoFeQapG5rUwI/7Qq0xiLbRXw+OmfAoV2XKv7iI8DjdIh0F06mlEAwQ/B0CpbqkuuxphIbchtdcz/5ra233r3BMNIqBl3VDDVoJlgHPg9msOTRy13lFqc=";
/// let np_rdf = fs::read_to_string("./tests/resources/simple1-rsa.trig").unwrap();
/// let np = Nanopub::new(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/nanopub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl Nanopub {
///
/// ```
/// use std::fs;
/// use nanopub_rs::nanopub::Nanopub;
/// use nanopub::nanopub::Nanopub;
/// let private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCjY1gsFxmak6SOCouJPuEzHNForkqFhgfHE3aAIAx+Y5q6UDEDM9Q0EksheNffJB4iPqsAfiFpY0ARQY92K5r8P4+a78eu9reYrb2WxZb1qPJmvR7XZ6sN1oHD7dd/EyQoJmQsmOKdrqaLRbzR7tZrf52yvKkwNWXcIVhW8uxe7iUgxiojZpW9srKoK/qFRpaUZSKn7Z/zgtDH9FJkYbBsGPDMqp78Kzt+sJb+U2W+wCSSy34jIUxx6QRbzvn6uexc/emFw/1DU5y7zBudhgC7mVk8vX1gUNKyjZBzlOmRcretrANgffqs5fx/TMHN1xtkA/H1u1IKBfKoyk/xThMLAgMBAAECggEAECuG0GZA3HF8OaqFgMG+W+agOvH04h4Pqv4cHjYNxnxpFcNV9nEssTKWSOvCwYy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+OmfAoV2XKv7iI8DjdIh0F06mlEAwQ/B0CpbqkuuxphIbchtdcz/5ra233r3BMNIqBl3VDDVoJlgHPg9msOTRy13lFqc=";
/// let np_rdf = fs::read_to_string("./tests/resources/simple1-rsa.trig").unwrap();
/// let np = Nanopub::new(
Expand Down
2 changes: 1 addition & 1 deletion lib/tests/nanopub_test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use nanopub_rs::nanopub::Nanopub;
use nanopub::nanopub::Nanopub;
use std::fs;

pub const ORCID: &str = "http://orcid.org/0000-0002-1267-0234";
Expand Down
6 changes: 3 additions & 3 deletions python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
name = "nanopub_rs_py"
name = "nanopub-py"
description = "Python bindings for the Nanopub rust toolkit"
repository = "https://github.com/vemonet/nanopub-rs/tree/main/python"
homepage = "https://github.com/vemonet/nanopub-rs"
version = "0.1.0"
edition = "2018"

[lib]
name = "nanopub_rs_py"
name = "nanopub_rs"
crate-type = ["cdylib"]

[dependencies]
nanopub_rs = { path = "../lib" }
nanopub = { path = "../lib" }

[dependencies.pyo3]
version = "0.17.1"
Expand Down
2 changes: 1 addition & 1 deletion python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ maturin develop
Try the python lib by running `python try.py`:

```python
from nanopub_py import Nanopub
from nanopub_rs import Nanopub
np = Nanopub(rdf="tiii")
print(np.get_rdf())
```
Expand Down
9 changes: 4 additions & 5 deletions python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ use pyo3::prelude::*;

/// Nanopub Python bindings
#[pymodule]
// fn nanopub_py(_py: Python<'_>, module: &PyModule) -> PyResult<()> {
fn nanopub_py(_py: Python<'_>, module: &PyModule) -> PyResult<()> {
module.add("__package__", "nanopub_py")?;
// fn nanopub_rs(_py: Python<'_>, module: &PyModule) -> PyResult<()> {
fn nanopub_rs(_py: Python<'_>, module: &PyModule) -> PyResult<()> {
module.add("__package__", "nanopub_rs")?;
module.add("__version__", env!("CARGO_PKG_VERSION"))?;
module.add("__author__", env!("CARGO_PKG_AUTHORS").replace(':', "\n"))?;

module.add_class::<PyNanopub>()
module.add_class::<NanopubPy>()

// module.add_class::<PyNanopub>()?;
// io::add_to_module(module)
}
8 changes: 4 additions & 4 deletions python/src/nanopub.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use nanopub_rs::nanopub::Nanopub;
use nanopub::nanopub::Nanopub;
use pyo3::prelude::*;

#[pyclass(name = "Nanopub", module = "nanopub_py")]
#[pyclass(name = "Nanopub", module = "nanopub_rs")]
#[pyo3(text_signature = "(rdf, private_key, orcid, server_url=None, publish=False)")]
// #[derive(Clone)]
pub struct PyNanopub {
pub struct NanopubPy {
np: Nanopub,
}

#[pymethods]
impl PyNanopub {
impl NanopubPy {
#[new]
fn new(
rdf: &str,
Expand Down
2 changes: 1 addition & 1 deletion python/try.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from nanopub_py import Nanopub
from nanopub_rs import Nanopub

rdf_str = """@prefix : <http://purl.org/nanopub/temp/mynanopub#> .
@prefix drugbank: <http://identifiers.org/drugbank/> .
Expand Down
2 changes: 1 addition & 1 deletion scripts/docs-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rm -rf target/doc

mdbook build

cargo doc --workspace --no-deps --exclude try-nanopub-rs --exclude nanopub-js --exclude nanopub_py --target-dir target/doc
cargo doc --workspace --no-deps --exclude try-nanopub-rs --exclude nanopub-js --exclude nanopub_rs --target-dir target/doc

echo "📖 Docs generated in the target/doc folder"

Expand Down
2 changes: 1 addition & 1 deletion scripts/docs-serve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rm -rf target/doc

mdbook build --open

cargo doc --open --workspace --no-deps --exclude try-nanopub-rs --exclude nanopub-js --exclude nanopub_py --target-dir target/doc
cargo doc --open --workspace --no-deps --exclude try-nanopub-rs --exclude nanopub-js --exclude nanopub_rs --target-dir target/doc

echo "📖 Docs generated in the target/doc folder"

Expand Down
2 changes: 1 addition & 1 deletion try/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ keywords = ["RDF", "nanopublications"]


[dependencies]
nanopub_rs = { path = "../lib" }
nanopub = { path = "../lib" }

# sophia = "0.7.2"
# regex = "1"
Expand Down
2 changes: 1 addition & 1 deletion try/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use nanopub_rs::nanopub::Nanopub;
use nanopub::nanopub::Nanopub;

fn main() {
// http://purl.org/np/RA5IWUwPmx_chibRuDOMfby6Sz8I0n76xnB3BiAm6ZP74
Expand Down

0 comments on commit 2677090

Please sign in to comment.