Skip to content

Trusted Library Ecosystem #1037

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

Open
5 of 11 tasks
eladb opened this issue Jan 4, 2023 · 5 comments
Open
5 of 11 tasks

Trusted Library Ecosystem #1037

eladb opened this issue Jan 4, 2023 · 5 comments
Labels
✨ enhancement New feature or request 📚 libraries Wing Libraries

Comments

@eladb
Copy link
Contributor

eladb commented Jan 4, 2023

Community Note

Please vote by adding a 👍 reaction to the issue to help us prioritize.
If you are interested to work on this issue, please leave a comment.

Feature Spec

Originally #652

A wing library is a collection of types that can be used by other wing libraries or apps.

Open-source supply-chain attacks are becoming one of the most common and dangerous attack vectors in the industry. To increase the trust, safety and quality of the wing library ecosystem, wing takes a unique approach to package publishing.

The basic idea is that "trusted" winglang libraries are normal npm packages that are published under the @winglang scope, and their code is hosted under the winglang github org. These libraries can be authored by anyone but they are always published by the winglang project and not their authors.

This serves two purposes:

  1. It simplifies publishing. The wing publishing system takes care of release management, versioning, backwards compatibility checks, changelogs, etc.
  2. It increases trust and quality of the ecosystem using a low friction peer-review system.

We need to decide on the right name that sets the right expectation: "trusted", "community", "approved", "peer-reviewed", something like that. For the sake of this document, I'll call them "trusted".

Let's walk through the user experience of installing and publishing trusted and untrusted wing libraries.

Installing wing packages

To install a trusted wing package, use:

wing install redis
# or
wing i redis
# or
wing i redis@^2

Use it like so:

bring redis;
bring cloud;

let db = new redis.Database();

new cloud.Function(inflight () => {
  db.hset("my_hash", "my_key", "my_value");
});

Under the hood, wing uses npm to install the package @winglang/redis into your package.json.

Publishing trusted wing packages

To publish a new trusted wing library, all you have to do is simply submit a pull request to the https://github.com/winglang/libs repository.

This repository includes a directory for each library, and is already set up to take care of builds, tests and releases. Just put your code in the right place and we'll take care of the rest.

Your pull request will be go through a quick review by one of our community members. The purpose of this review is to help you make your library awesome and that it meets the wing standards. Once reviewed, it will be merged and immediately released.

Out of the box best in class library publishing

The following will automatically happen for all libraries in the trusted namespace:

  1. Compile
  2. Unit test
  3. Cloud testing (runs on all supported target platforms of the library)
  4. Generation of API documentation
  5. Require a major version bump for breaking api changes (like jsii-diff).
  6. Automatic version bumps based on commit history and api breaking changes (versions are tagged automatically in the repo)
  7. Changelog
  8. Tweet on each release
  9. Discoverable/installable through the wing vscode extension
  10. Listed in the "Wing Candy Store" (online package repository), including api documentation of course
  11. wing help foo shows api docs
  12. More!

In the future, we will add support for self-service creation of new repository in the winglang github organization, and each library will have its own repository, but for now a single mono repo will make things much easier for everyone and will increase the cohesiveness of the ecosystem.

Untrusted libraries

Again, name pending.

As mentioned above, winglang libraries are simply npm (JSII) packages, so anyone can publish anything to npm.

You can then use npm to install this library:

npm i my-wing-lib

And use bring like normal:

bring "my-wing-lib" as mwl;

mwl.print_hello();

But:

$ wing compile hello.w
ERROR: trying to bring untrusted library "my-wing-lib". Use --allow-untrusted=my-wing-lib to allow.

So you'll have to explicitly opt-in to allow this library:

$ wing compile hello.w --allow-untrusted=my-wing-lib

Use Cases

  • A library ecosystem for Wing

Implementation Notes

No response

Roadmap

P1

P2

P3

  • Create dedicated page on Wing's docsite for discovering libraries
  • Add tab to Wing VS Code extension for browsing Wing trusted libraries
  • wing help foo shows API docs
  • Automatically post new winglibs on X/Twitter and the Wing slack
@eladb eladb added the ✨ enhancement New feature or request label Jan 4, 2023
@monadabot monadabot added this to Wing Jan 4, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New - not properly defined in Wing Jan 4, 2023
@staycoolcall911 staycoolcall911 moved this from 🆕 New - not properly defined to 🤝 Backlog - handoff to owners in Wing Jan 7, 2023
@github-actions github-actions bot added Stale and removed Stale labels Mar 6, 2023
@github-actions github-actions bot added the Stale label May 7, 2023
@staycoolcall911
Copy link
Contributor

This is a duplicate of #130

@staycoolcall911 staycoolcall911 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2023
@github-project-automation github-project-automation bot moved this from 🤝 Backlog - handoff to owners to ✅ Done in Wing Oct 4, 2023
@eladb eladb moved this from ✅ Done to 🏗 In progress in Wing Oct 5, 2023
@eladb eladb reopened this Oct 5, 2023
@github-project-automation github-project-automation bot moved this from 🏗 In progress to 🤝 Backlog - handoff to owners in Wing Oct 5, 2023
@staycoolcall911 staycoolcall911 added this to the KubeCon23 milestone Oct 5, 2023
@eladb
Copy link
Contributor Author

eladb commented Oct 6, 2023

I wouldn't say that this is a duplicate. This is about the "managed ecosystem" of libraries while #130 is just the mechanism in the language.

@staycoolcall911
Copy link
Contributor

Got ya

@winglang winglang deleted a comment from github-actions bot Oct 6, 2023
@winglang winglang deleted a comment from github-actions bot Oct 6, 2023
@eladb eladb changed the title Story: Wing Library Ecosystem Wing Truated Library Ecosystem Oct 6, 2023
@eladb eladb changed the title Wing Truated Library Ecosystem Trusted Library Ecosystem Oct 6, 2023
mergify bot pushed a commit that referenced this issue Nov 6, 2023
Introduces the capability to bring trusted libraries using the `bring module_name;` syntax, as a short-hand for `bring "@winglibs/module_name" as module_name;`. If the module hasn't been installed, it will be a parsing error (as it's not possible to type check usage of that module until it has been installed).

Part of #1037

## Checklist

- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [x] Tests added (always)
- [x] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
@staycoolcall911 staycoolcall911 added the 📚 libraries Wing Libraries label Nov 15, 2023
@Chriscbr
Copy link
Contributor

Chunking up some of the feature ideas above into tasks:

@staycoolcall911
Copy link
Contributor

Added a prioritized roadmap at the end of the issue description based on Chris's excellent list.

@Chriscbr Chriscbr removed their assignment Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request 📚 libraries Wing Libraries
Projects
Status: 🤝 Backlog - handoff to owners
Development

No branches or pull requests

3 participants