Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(smithereens): Mass Builder for PGFinder 2.0 #285

Merged
merged 50 commits into from
Jul 26, 2024

Conversation

ns-rse
Copy link
Collaborator

@ns-rse ns-rse commented Jun 3, 2024

Much head scratching, reading, learning, trying to document how things hang together and assistance from @TheLostLambda has led to a new component that uses static Rust copmiled to WebAassembly from Smithereens which takes a list of muropeptides and calculates the masses. The building blocks (currently only E. coli) are not actually used, as the masses of the components are internal to Smithereens.

  • All available species are duplicates (they just have different species/file names).
  • The building block components are not used, these come directly from smithereens I believe.
  • Defaults to muropeptides_masses.csv as output filename.
  • Lots of console.log() still in place.
  • Lints some files but doesn't address all errors.

Also did some minor cleaning

  • Update ruff and eslint pre-commit hooks
  • Update pyproject.toml in light of ruff config changes
  • Lint test_internal.py
  • Adds basic eslint.config.mjs and removes options from .pre-commit-configy.yaml

ToDo

There is no doubt more than the following to do but here are a few things that can be done in the future.

  • As we are now loading the building blocks and muropeptide lists directly from the web-server/host it would perhaps make sense to do the same for the mass databases too as it is considerably faster than waiting for the Python packages to install and make these available.
  • Address the linting errors, currently a number of files are ignored via the --no-warn-ignored flag in .pre-commit-config.yaml but this should be removed and all errors addressed

slackline and others added 16 commits March 20, 2024 16:20
First forays into HTML/CSS/JavaScript/Typescript!

Adding content to allow users to select and upload Fragments Library and Muropeptides Library.

The smithereens WebAssembly will be added separately once the WebUI is in place.
Default reference masses and target structures along with the necessary Python components to load them or the user
provided alternatives.
First forays into HTML/CSS/JavaScript/Typescript!

Adding content to allow users to select and upload Fragments Library and Muropeptides Library.

The smithereens WebAssembly will be added separately once the WebUI is in place.
+ Add reference masses to data dictionary
+ Add target structures to data dictionary
+ Attempting to document how to add features to the WebUI covering svelte/typescript/pgfinder (no smithereens yet)
Not quite there, don't get the tool tips showing correctly but progress!
Add radio buttons for selecting building bloc and muropeptides

Also attempts to setup logic for running Smithereens once the Fragments and Muropeptides libraries have been selected,
but not working (yet!).
Need to...

+ Split loading of mass library from fragments and muropeptides and make buttons reactive separately
+ Work out how to get the WASM imported correctly
Smithereens now takes the muropeptides list and calculates the masses.

+ All available species are duplicates (they just have different species/file names).
+ The building block components are not used, these come directly from smithereens I believe.
+ Defaults to `muropeptides_masses.csv` as output filename.
+ Lots of `console.log()` still in place.
+ Lints some files but doesn't address all errors.

Also did some minor cleaning

+ Update ruff and eslint pre-commit hooks
+ Update pyproject.toml in light of ruff config changes
+ Lint test_internal.py
+ Adds basic eslint.config.mjs and removes options from .pre-commit-configy.yaml

ToDo...

There is no doubt more than the following to do but here is a summary, TODO denotes it needs addressing as this work,
FUTURE for subsequent issues/tidying...

+ FUTURE As we are now loading the building blocks and muropeptide lists directly from the web-server/host it would
  perhaps make sense to do the same for the mass databases too as it is considerably faster than waiting for the Python
  packages to install and make these available (this should be something for a separate issue and be addressed in the
  future).
+ FUTURE Address the linting errors, currently a number of files are ignored via the `--no-warn-ignored` flag in
  `.pre-commit-config.yaml` but this should be removed and all errors addressed
@ns-rse ns-rse requested a review from TheLostLambda June 3, 2024 13:27
@ns-rse
Copy link
Collaborator Author

ns-rse commented Jun 6, 2024

Hi @TheLostLambda

I'm stuck on how to address the failures in the GUIs tests as my understanding of TypeScript is close to non-existant and the IDE isn't much help.

Similarly the failing end-to-end tests fail as its suggesting the smithereens library can't be found but I'm unsure why that is the case (clearly they're not in the correct location but I don't know where that should be).

Any thoughts/insights/suggestions welcome.

End-to-end tests fail as `/_app/immutable/workers/assets/smithereens_bg.wasm` can not be found so using `tree -fhD` to
list the current directory structure to see where the files are.

Locally they are in two locations (likely only one is being used!)

```
(pgfinder2024) ❱ fd smithereens_bg.wasm
web/smithereens/pkg/smithereens_bg.wasm
web/smithereens/pkg/smithereens_bg.wasm.d.ts
web/src/lib/pkg/smithereens_bg.wasm
web/src/lib/pkg/smithereens_bg.wasm.d.ts
```
@ns-rse ns-rse force-pushed the ns-rse/259-muropeptides-wasm-working branch from 5225143 to 1b470ef Compare June 13, 2024 08:42
@ns-rse
Copy link
Collaborator Author

ns-rse commented Jun 14, 2024

I spent a little time looking at this and the playrwright tests are failing because the test that tries to click click on a plain textbox and so its picking up the box that runs the newer Smithereens component rather than the existing functionality.

I've been having a tinker to see if I can apply .filter({ hasText: Byos }) to narrow this down but without success yet.

I'll try and find a little time to look at this over the coming weeks and am also mindful that we should probably add to the playrwight tests functionality that checks the new addition.

With the introduction of new elements in the WebUI the existing
`web/tests/search_custom_database_test.ts` was failing as the wrong elements were selected (the new added ones rather
than the existing ones).

This has been corrected by adding `data-testid` fields to the Svelte pages <div> sections that define the specific areas
to give them unique identifiers and updating the tests to use `page.getByTestID()` targets to align with these.
@ns-rse
Copy link
Collaborator Author

ns-rse commented Jun 17, 2024

I've fixed the end-to-end tests which now pass by adding labels to each relevant section via data-testid and explicitly referring to these in the web/tests/*.ts files.

The GUI tests fail for a few reasons (see full log here)...

  1. pnpm check --tsconfig ./tsconfig.json tries to check all the files under src/smithereens/pkg/ and has a lot of complaints about smithereens_bg.js.
  2. There are some errors in the types used in src/lib/smithereens.ts (arrayToConvert type is implicitly any in smithereens.ts).
  3. A complaint about ModalSettings in +page.svelte.
  4. Two identical problems with trying to use VirtFile | undefined in +page.svelte.
  5. Wrong export type in FragmentsSelector.svelte

I also have some eslint errors thrown by pre-commit, but upgrading to estlint-9.5.0 has broken things even more and these don't show in the CI log.

Still to do would be to write tests that check smithereens runs correctly, but if you have any ideas or can suggest how to fix these please @TheLostLambda I would be very grateful.

Attempting to exclude `web/src/pkg/smithereens*.js` from linting with `pnpm check` as it throws a lot of errors. The
files themselves were auto-generated when building Smithereens with WebAssembly so not something we need to be concerned
about.
@TheLostLambda
Copy link
Member

Hi @ns-rse ! Sorry for the delay! I've been on holiday for the past week and remain a little crunched for time, but I'll help how I can now! I'll push a couple of commits and write anything else here!

The last commit wasn't quite working for me, and it seems like that was
because the `"exclude"` section was nested in `"compilerOptions"` when
it's actually a top-level setting!

This seems to work for me now
@TheLostLambda
Copy link
Member

For @smesnage , the pgfinder-next / smithereens repository is now a submodule of this one, so we can have all of the code in a single link for the paper!

For @ns-rse , if you have a moment, it would be great if you could test that the installation / Rust building -> WebUI steps I added in the smithereens.md file work for you! Though it's not part of the automated build process yet, it's not at least something you can build from source and it all lives in this repo!

@ns-rse
Copy link
Collaborator Author

ns-rse commented Jul 22, 2024

Had a go at working through the instructions.

Building the Package

This fails for native compilation on both the main branch and pgfinder-2 branches.

git submodule update --init --recursive
cd smithereens
cargo build
    Updating crates.io index
    Updating git repository `https://github.com/TheLostLambda/miette`
    Updating git repository `https://github.com/TheLostLambda/knuffel.git`
  Downloaded addr2line v0.22.0
  Downloaded convert_case v0.6.0
  Downloaded bitflags v2.6.0
  Downloaded cfg_aliases v0.2.1
  Downloaded autocfg v1.3.0
  Downloaded heck v0.5.0
  Downloaded thiserror-impl v1.0.63
  Downloaded errno v0.3.9
  Downloaded toml_datetime v0.6.6
  Downloaded utf8parse v0.2.2
  Downloaded unicode-xid v0.2.4
  Downloaded thiserror v1.0.63
  Downloaded either v1.13.0
  Downloaded bytes v1.6.1
  Downloaded borsh-derive v1.5.1
  Downloaded getrandom v0.2.15
  Downloaded quote v1.0.36
  Downloaded itoa v1.0.11
  Downloaded rustc-demangle v0.1.24
  Downloaded serde_derive v1.0.204
  Downloaded tinyvec v1.8.0
  Downloaded uuid v1.10.0
  Downloaded derive_more v1.0.0-beta.6
  Downloaded indexmap v2.2.6
  Downloaded derive_more-impl v1.0.0-beta.6
  Downloaded backtrace v0.3.73
  Downloaded allocator-api2 v0.2.18
  Downloaded serde v1.0.204
  Downloaded cc v1.1.6
  Downloaded base64 v0.22.1
  Downloaded borsh v1.5.1
  Downloaded ryu v1.0.18
  Downloaded proc-macro2 v1.0.86
  Downloaded num-traits v0.2.19
  Downloaded memchr v2.7.4
  Downloaded miniz_oxide v0.7.4
  Downloaded log v0.4.22
  Downloaded hashbrown v0.14.5
  Downloaded serde_json v1.0.120
  Downloaded zerocopy v0.7.35
  Downloaded itertools v0.13.0
  Downloaded syn v2.0.72
  Downloaded gimli v0.29.0
  Downloaded object v0.36.1
  Downloaded unicode-width v0.1.13
  Downloaded libc v0.2.155
  Downloaded linux-raw-sys v0.4.14
  Downloaded 47 crates (6.1 MB) in 0.73s (largest was `linux-raw-sys` at 1.8 MB)
   Compiling proc-macro2 v1.0.86
   Compiling unicode-ident v1.0.12
   Compiling version_check v0.9.4
   Compiling libc v0.2.155
   Compiling cfg-if v1.0.0
   Compiling memchr v2.7.4
   Compiling rustix v0.38.34
   Compiling bitflags v2.6.0
   Compiling cc v1.1.6
   Compiling linux-raw-sys v0.4.14
   Compiling gimli v0.29.0
   Compiling adler v1.0.2
   Compiling unicode-width v0.1.13
   Compiling once_cell v1.19.0
   Compiling thiserror v1.0.63
   Compiling rustc-demangle v0.1.24
   Compiling syn v1.0.109
   Compiling miniz_oxide v0.7.4
   Compiling zerocopy v0.7.35
   Compiling autocfg v1.3.0
   Compiling is_ci v1.2.0
   Compiling smawk v0.3.2
   Compiling unicode-linebreak v0.1.5
   Compiling unicode-segmentation v1.11.0
   Compiling ahash v0.8.11
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling supports-color v3.0.0
   Compiling supports-hyperlinks v3.0.0
   Compiling object v0.36.1
   Compiling num-traits v0.2.19
   Compiling textwrap v0.16.1
   Compiling supports-unicode v3.0.0
   Compiling serde v1.0.204
   Compiling owo-colors v4.0.0
   Compiling allocator-api2 v0.2.18
   Compiling heck v0.5.0
   Compiling convert_case v0.6.0
   Compiling minimal-lexical v0.2.1
   Compiling unicode-xid v0.2.4
   Compiling quote v1.0.36
   Compiling rust_decimal v1.35.0
   Compiling arrayvec v0.7.4
   Compiling nom v7.1.3
   Compiling syn v2.0.72
   Compiling base64 v0.22.1
   Compiling cfg_aliases v0.1.1
   Compiling either v1.13.0
   Compiling nix v0.28.0
   Compiling static_assertions v1.1.0
   Compiling smallvec v1.13.2
   Compiling itertools v0.13.0
   Compiling nibble_vec v0.1.0
   Compiling endian-type v0.1.2
   Compiling log v0.4.22
   Compiling home v0.5.9
   Compiling radix_trie v0.2.1
   Compiling utf8parse v0.2.2
   Compiling getrandom v0.2.15
   Compiling backtrace v0.3.73
   Compiling hashbrown v0.14.5
   Compiling addr2line v0.22.0
   Compiling chumsky v0.9.3
   Compiling terminal_size v0.3.0
   Compiling fd-lock v4.0.2
   Compiling rustyline v14.0.0
   Compiling thiserror-impl v1.0.63
   Compiling miette-derive v7.2.0 (https://github.com/TheLostLambda/miette#5b3eeba9)
   Compiling serde_derive v1.0.204
   Compiling derive_more-impl v1.0.0-beta.6
   Compiling backtrace-ext v0.2.1
   Compiling knuffel-derive v3.2.0 (https://github.com/TheLostLambda/knuffel.git#744bf56c)
   Compiling miette v7.2.0 (https://github.com/TheLostLambda/miette#5b3eeba9)
   Compiling nom-miette v0.1.0 (/home/neil/work/git/hub/Mesnage-Org/pgfinder/smithereens/crates/nom-miette)
   Compiling knuffel v3.2.0 (https://github.com/TheLostLambda/knuffel.git#744bf56c)
   Compiling derive_more v1.0.0-beta.6
   Compiling polychem v0.1.0 (/home/neil/work/git/hub/Mesnage-Org/pgfinder/smithereens/crates/polychem)
error[E0432]: unresolved import `std::num::NonZero`
 --> crates/polychem/src/atoms/atomic_database.rs:2:11
  |
2 | use std::{num::NonZero, ops::Deref, str::FromStr};
  |           ^^^^^-------
  |           |    |
  |           |    help: a similar name exists in the module: `NonZeroI8`
  |           no `NonZero` in `num`

error[E0432]: unresolved import `std::num::NonZero`
 --> crates/polychem/src/atoms/count.rs:3:5
  |
3 |     num::NonZero,
  |     ^^^^^-------
  |     |    |
  |     |    help: a similar name exists in the module: `NonZeroI8`
  |     no `NonZero` in `num`

error[E0432]: unresolved import `std::num::NonZero`
 --> crates/polychem/src/atoms/mass_number.rs:1:5
  |
1 | use std::num::NonZero;
  |     ^^^^^^^^^^-------
  |     |         |
  |     |         help: a similar name exists in the module: `NonZeroI8`
  |     no `NonZero` in `num`

error[E0432]: unresolved import `std::num::NonZero`
  --> crates/polychem/src/lib.rs:10:5
   |
10 | use std::num::NonZero;
   |     ^^^^^^^^^^-------
   |     |         |
   |     |         help: a similar name exists in the module: `NonZeroI8`
   |     no `NonZero` in `num`

error[E0658]: associated type bounds are unstable
  --> crates/polychem/src/atoms/errors.rs:74:56
   |
74 |     pub(crate) fn display_vec(items: impl IntoIterator<Item: Display>) -> String {
   |                                                        ^^^^^^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information

error[E0658]: associated type bounds are unstable
   --> crates/polychem/src/polymers/errors.rs:220:44
    |
220 | pub fn comma_list(items: impl IntoIterator<Item: Display>, final_sep: &str) -> String {
    |                                            ^^^^^^^^^^^^^
    |
    = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information

error[E0658]: associated type bounds are unstable
   --> crates/polychem/src/polymers/polymer.rs:146:37
    |
146 |         residues: impl IntoIterator<Item: AsRef<str>>,
    |                                     ^^^^^^^^^^^^^^^^
    |
    = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information

error[E0658]: associated type bounds are unstable
   --> crates/polychem/src/polymers/polymer.rs:199:37
    |
199 |         residues: impl IntoIterator<Item: Borrow<ResidueId>>,
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information

error[E0658]: associated type bounds are unstable
   --> crates/polychem/src/polymers/polymer.rs:346:35
    |
346 |         groups: impl IntoIterator<Item: Borrow<FunctionalGroup<'p>>> + Copy,
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information

error[E0658]: associated type bounds are unstable
   --> crates/polychem/src/polymers/polymerizer_state.rs:118:35
    |
118 |         groups: impl IntoIterator<Item: Borrow<FunctionalGroup<'p>>>,
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information

Some errors have detailed explanations: E0432, E0658.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `polychem` (lib) due to 10 previous errors

Building the Package for Web Assembly

I found the following...

wasm-pack can then be used to build the wasm-shim package / crate which contains the code needed to run smithereens from the WebUI:

cd crates/wasm-shim/
wasm-pack build --out-name smithereens --target web

...didn't work as on a fresh clone of the sub-module there is no such crate (crates/wasm-shim/) on the main branch, rather this currently resides on the pgfinder-2 branch (although I expect it will make its way into main once you've finished work on it).

wasm-pack can then be used to build the wasm-shim package / crate which contains the code needed to run smithereens from the WebUI. This is currently on the pgfinder-2 branch:

git switch pgfinder-2
cd crates/wasm-shim/
wasm-pack build --out-name smithereens --target web

Unfortunately that failed to build for me...

❱ wasm-pack build --out-name smithereens --target web
[INFO]: Checking for the Wasm target...
[INFO]: Compiling to Wasm...
   Compiling proc-macro2 v1.0.86
   Compiling unicode-ident v1.0.12
   Compiling wasm-bindgen-shared v0.2.92
   Compiling version_check v0.9.4
   Compiling log v0.4.22
   Compiling once_cell v1.19.0
   Compiling bumpalo v3.16.0
   Compiling wasm-bindgen v0.2.92
   Compiling cfg-if v1.0.0
   Compiling zerocopy v0.7.35
   Compiling thiserror v1.0.63
   Compiling syn v1.0.109
   Compiling autocfg v1.3.0
   Compiling allocator-api2 v0.2.18
   Compiling unicode-segmentation v1.11.0
   Compiling unicode-width v0.1.13
   Compiling serde v1.0.204
   Compiling unicode-xid v0.2.4
   Compiling minimal-lexical v0.2.1
   Compiling memchr v2.7.4
   Compiling rust_decimal v1.35.0
   Compiling heck v0.5.0
   Compiling base64 v0.22.1
   Compiling either v1.13.0
   Compiling ahash v0.8.11
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling arrayvec v0.7.4
   Compiling convert_case v0.6.0
   Compiling num-traits v0.2.19
   Compiling static_assertions v1.1.0
   Compiling itertools v0.13.0
   Compiling nom v7.1.3
   Compiling quote v1.0.36
   Compiling syn v2.0.72
   Compiling wasm-bindgen-backend v0.2.92
   Compiling knuffel-derive v3.2.0 (https://github.com/TheLostLambda/knuffel.git#744bf56c)
   Compiling thiserror-impl v1.0.63
   Compiling miette-derive v7.2.0 (https://github.com/TheLostLambda/miette#5b3eeba9)
   Compiling serde_derive v1.0.204
   Compiling derive_more-impl v1.0.0-beta.6
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling miette v7.2.0 (https://github.com/TheLostLambda/miette#5b3eeba9)
   Compiling js-sys v0.3.69
   Compiling console_error_panic_hook v0.1.7
   Compiling derive_more v1.0.0-beta.6
   Compiling getrandom v0.2.15
   Compiling hashbrown v0.14.5
   Compiling nom-miette v0.1.0 (/home/neil/work/git/hub/Mesnage-Org/pgfinder/smithereens/crates/nom-miette)
   Compiling chumsky v0.9.3
   Compiling knuffel v3.2.0 (https://github.com/TheLostLambda/knuffel.git#744bf56c)
   Compiling polychem v0.1.0 (/home/neil/work/git/hub/Mesnage-Org/pgfinder/smithereens/crates/polychem)
error[E0432]: unresolved import `std::num::NonZero`
 --> crates/polychem/src/atoms/atomic_database.rs:2:11
  |
2 | use std::{num::NonZero, ops::Deref, str::FromStr};
  |           ^^^^^-------
  |           |    |
  |           |    help: a similar name exists in the module: `NonZeroI8`
  |           no `NonZero` in `num`

error[E0432]: unresolved import `std::num::NonZero`
 --> crates/polychem/src/atoms/count.rs:3:5
  |
3 |     num::NonZero,
  |     ^^^^^-------
  |     |    |
  |     |    help: a similar name exists in the module: `NonZeroI8`
  |     no `NonZero` in `num`

error[E0432]: unresolved import `std::num::NonZero`
 --> crates/polychem/src/atoms/mass_number.rs:1:5
  |
1 | use std::num::NonZero;
  |     ^^^^^^^^^^-------
  |     |         |
  |     |         help: a similar name exists in the module: `NonZeroI8`
  |     no `NonZero` in `num`

error[E0432]: unresolved import `std::num::NonZero`
  --> crates/polychem/src/lib.rs:10:5
   |
10 | use std::num::NonZero;
   |     ^^^^^^^^^^-------
   |     |         |
   |     |         help: a similar name exists in the module: `NonZeroI8`
   |     no `NonZero` in `num`

error[E0658]: associated type bounds are unstable
  --> crates/polychem/src/atoms/errors.rs:74:56
   |
74 |     pub(crate) fn display_vec(items: impl IntoIterator<Item: Display>) -> String {
   |                                                        ^^^^^^^^^^^^^
   |
   = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information

error[E0658]: associated type bounds are unstable
   --> crates/polychem/src/polymers/errors.rs:220:44
    |
220 | pub fn comma_list(items: impl IntoIterator<Item: Display>, final_sep: &str) -> String {
    |                                            ^^^^^^^^^^^^^
    |
    = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information

error[E0658]: associated type bounds are unstable
   --> crates/polychem/src/polymers/polymer.rs:146:37
    |
146 |         residues: impl IntoIterator<Item: AsRef<str>>,
    |                                     ^^^^^^^^^^^^^^^^
    |
    = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information

error[E0658]: associated type bounds are unstable
   --> crates/polychem/src/polymers/polymer.rs:199:37
    |
199 |         residues: impl IntoIterator<Item: Borrow<ResidueId>>,
    |                                     ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information

error[E0658]: associated type bounds are unstable
   --> crates/polychem/src/polymers/polymer.rs:346:35
    |
346 |         groups: impl IntoIterator<Item: Borrow<FunctionalGroup<'p>>> + Copy,
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information

error[E0658]: associated type bounds are unstable
   --> crates/polychem/src/polymers/polymerizer_state.rs:118:35
    |
118 |         groups: impl IntoIterator<Item: Borrow<FunctionalGroup<'p>>>,
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information

Some errors have detailed explanations: E0432, E0658.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `polychem` (lib) due to 10 previous errors
Error: Compiling your crate to WebAssembly failed
Caused by: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit status: 101
  full command: cd "/home/neil/work/git/hub/Mesnage-Org/pgfinder/smithereens/crates/wasm-shim" && "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"

@TheLostLambda
Copy link
Member

Hi @ns-rse !

The submodule should be initialised to the correct branch, but both of those issues look like a Rust version one!

Can you try with the latest stable release? That's a new std library feature from the last release (or maybe one before) that I've used!

@ns-rse
Copy link
Collaborator Author

ns-rse commented Jul 22, 2024

Hmm, seems I have a rustc under $HOME/.cargo/bin/rustc that may be getting in the way, will have a go at removing that and using the system version of rust-1.79.0.

Submodule definitely didn't initialise to the correct branch.

@TheLostLambda
Copy link
Member

Submodule definitely didn't initialise to the correct branch.

Eek! I'll investigate...

@TheLostLambda
Copy link
Member

Submodule definitely didn't initialise to the correct branch.

Testing a fresh clone, after initializing the submodule, I've ended up with: HEAD detached at 0a5f7fa, which does seem to have the wasm-shim directory!

Once we merge this PR, then I think cloning with git clone --recurse-submodules should work too!

@ns-rse ns-rse force-pushed the ns-rse/259-muropeptides-wasm-working branch from 527ce15 to b7d0872 Compare July 22, 2024 14:52
@ns-rse
Copy link
Collaborator Author

ns-rse commented Jul 22, 2024

Updated rustup to 1.79.0 and smithereens all builds under native and the wasm-shim builds using wasm-pack. 👍 🎉

Updated documentation to reflect this minimum version.

WebUI throws a hissy fit though...

[plugin:vite:import-analysis] Failed to resolve import "client-zip" from "src/lib/smithereens.ts?type=module&worker_file". Does the file exist?
/home/neil/work/git/hub/Mesnage-Org/pgfinder/web/src/lib/smithereens.ts:6:28
1  |  import "/@vite/env"
2  |  import { downloadZip } from "client-zip";
   |                               ^
3  |  import init, { Peptidoglycan, version } from "smithereens";
4  |  (async () => {
    at formatError (file:///home/neil/work/git/hub/Mesnage-Org/pgfinder/web/node_modules/.pnpm/vite@4.5.2_@types+node@20.5.9/node_modules/vite/dist/node/chunks/dep-52909643.js:44062:46)
    at TransformContext.error (file:///home/neil/work/git/hub/Mesnage-Org/pgfinder/web/node_modules/.pnpm/vite@4.5.2_@types+node@20.5.9/node_modules/vite/dist/node/chunks/dep-52909643.js:44058:19)
    at normalizeUrl (file:///home/neil/work/git/hub/Mesnage-Org/pgfinder/web/node_modules/.pnpm/vite@4.5.2_@types+node@20.5.9/node_modules/vite/dist/node/chunks/dep-52909643.js:41844:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///home/neil/work/git/hub/Mesnage-Org/pgfinder/web/node_modules/.pnpm/vite@4.5.2_@types+node@20.5.9/node_modules/vite/dist/node/chunks/dep-52909643.js:41998:47
    at async Promise.all (index 1)
    at async TransformContext.transform (file:///home/neil/work/git/hub/Mesnage-Org/pgfinder/web/node_modules/.pnpm/vite@4.5.2_@types+node@20.5.9/node_modules/vite/dist/node/chunks/dep-52909643.js:41914:13)
    at async Object.transform (file:///home/neil/work/git/hub/Mesnage-Org/pgfinder/web/node_modules/.pnpm/vite@4.5.2_@types+node@20.5.9/node_modules/vite/dist/node/chunks/dep-52909643.js:44352:30)
    at async loadAndTransform (file:///home/neil/work/git/hub/Mesnage-Org/pgfinder/web/node_modules/.pnpm/vite@4.5.2_@types+node@20.5.9/node_modules/vite/dist/node/chunks/dep-52909643.js:55026:29)
    at async viteTransformMiddleware (file:///home/neil/work/git/hub/Mesnage-Org/pgfinder/web/node_modules/.pnpm/vite@4.5.2_@types+node@20.5.9/node_modules/vite/dist/node/chunks/dep-52909643.js:64430:32
Click outside, press Esc key, or fix the code to dismiss.
You can also disable this overlay by setting server.hmr.overlay to false in vite.config.js.

I can see client-zip is listed in the package.json so updated with pnpm install and all was back to normal 😌 the Svelte side of things will need documenting at some point too.

@TheLostLambda
Copy link
Member

Nice! Yeah, it's a new dependency, so needing the install makes sense!

Do you mean usage docs or developer docs for the Svelte stuff?

@ns-rse
Copy link
Collaborator Author

ns-rse commented Jul 22, 2024

Do you mean usage docs or developer docs for the Svelte stuff?

The later, developer docs for Svelte. It would be useful to help people new to the framework to get up and running.

@TheLostLambda
Copy link
Member

TheLostLambda commented Jul 23, 2024

@ns-rse Fixed that CI-failing-one-Windows issue: mesonbuild/meson-python#559

All of the other lints and checks should be passing now too!

Missing things to do before merging:

  • Add Usage documentation

And to convert to issues:

  • Add Svelte developer documentation
  • Write tests for the new UI modules

@TheLostLambda
Copy link
Member

@ns-rse Might need your help in understanding some of how the documentation is generated here?

I'm utterly baffled by these image links — where to get the URLs and how to upload new images:

![Initial screenshot of PGFinder GUI](https://github.com/Mesnage-Org/pgfinder/assets/70374280/9537c200-5b48-4d50-ac72-1c8b62d83909)

@TheLostLambda
Copy link
Member

In the meantime I'll be going back to things in the img/ directory:
image

I've heard that might mean that the images don't load on GitHub, but at least that's straightforward!

@TheLostLambda TheLostLambda marked this pull request as ready for review July 26, 2024 11:50
@TheLostLambda
Copy link
Member

Going to merge things just so that we can make sure the documentation and everything is set up, public, and working for publishing the paper!

I hate to rush this bit through, but I think I've added issues for dealing with any loose-ends left behind!

Some bigger issues (but bike-sheddy ones) that we need to think about involve the versioning and naming (and changelog tracking) for essentially three separate bits of software: the CLI PGfinder, the WebUI, and the new Smithereens stuff.

@TheLostLambda TheLostLambda merged commit d78b930 into master Jul 26, 2024
12 of 13 checks passed
@TheLostLambda TheLostLambda deleted the ns-rse/259-muropeptides-wasm-working branch July 26, 2024 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants