-
Notifications
You must be signed in to change notification settings - Fork 303
Add "crates.io: development update" blogpost #1471
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
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,69 @@ | ||
--- | ||
layout: post | ||
title: "crates.io: development update" | ||
author: Tobias Bieniek | ||
team: the crates.io team <https://www.rust-lang.org/governance/teams/crates-io> | ||
--- | ||
|
||
Back in July 2024, we published a [blog post](https://blog.rust-lang.org/2024/07/29/crates-io-development-update.html) about the ongoing development of crates.io. Since then, we have made a lot of progress and shipped a few new features. In this blog post, we want to give you an update on the latest changes that we have made to crates.io. | ||
|
||
## Crate deletions | ||
|
||
In [RFC #3660](https://rust-lang.github.io/rfcs/3660-crates-io-crate-deletions.html) we proposed a new feature that allows crate owners to delete their crates from crates.io under certain conditions. This can be useful if you have published a crate by mistake or if you want to remove a crate that is no longer maintained. After the RFC was accepted by all team members at the end of August, we began implementing the feature. | ||
|
||
We created a new API endpoint `DELETE /api/v1/crates/:name` that allows crate owners to delete their crates and then created the corresponding user interface. If you are the owner of a crate, you can now go to the crate page, open the "Settings" tab, and find the "Delete this crate" button at the bottom. Clicking this button will lead you to a confirmation page telling you about the potential impact of the deletion and requirements that need to be met in order to delete the crate: | ||
|
||
 | ||
|
||
As you can see from the screenshot above, a crate can only be deleted if either: the crate has been published for less than 72 hours or the crate only has a single owner, and the crate has been downloaded less than 500 times for each month it has been published, and the crate is not depended upon by any other crate on crates.io. | ||
|
||
These requirements were put in place to prevent abuse of the deletion feature and to ensure that crates that are widely used by the community are not deleted accidentally. If you have any feedback on this feature, please let us know! | ||
|
||
|
||
## OpenAPI description | ||
|
||
Around the holiday season we started experimenting with generating an [OpenAPI](https://www.openapis.org/) description for the crates.io API. This was a long-standing request from the community, and we are happy to announce that we now have an experimental OpenAPI description available at <https://crates.io/api/openapi.json>! | ||
|
||
Please note that this is still considered work-in-progress and e.g. the stability guarantees for the endpoints are not written down and the response schemas are also not fully documented yet. | ||
|
||
You can view the OpenAPI description in e.g. a Swagger UI at <https://petstore.swagger.io/> by putting `https://crates.io/api/openapi.json` in the top input field. We decided to not ship a viewer ourselves for now due to security concerns with running it on the same domain as crates.io itself. We may reconsider whether to offer it on a dedicated subdomain in the future if there is enough interest. | ||
|
||
 | ||
|
||
The OpenAPI description is generated by the [utoipa](https://github.com/juhaku/utoipa) crate, which is a tool that can be integrated with the [axum](https://github.com/tokio-rs/axum) web framework to automatically generate OpenAPI descriptions for all of your endpoints. We would like to thank [Juha Kukkonen](https://github.com/juhaku) for his great work on this tool! | ||
|
||
|
||
## Support form and "Report Crate" button | ||
|
||
Since the crates.io team is small and mostly consists of volunteers, we do not have the capacity to manually monitor all publishes. Instead, we rely on you, the Rust community, to help us catch malicious crates and users. To make it easier for you to report suspicious crates, we added a "Report Crate" button to all the crate pages. If you come across a crate that you think is malicious or violates the [code of conduct](https://www.rust-lang.org/policies/code-of-conduct) or our [usage policy](https://crates.io/policies), you can now click the "Report Crate" button and fill out the form that appears. This will send an email to the crates.io team, who will then review the crate and take appropriate action if necessary. Thank you to crates.io team member [@eth3lbert](https://github.com/eth3lbert) how worked on the majority of this. | ||
|
||
If you have any issues with the support form or the "Report Crate" button, please let us know. You can also always email us directly at [[email protected]](mailto:[email protected]) if you prefer not to use the form. | ||
|
||
|
||
## Publish notifications | ||
|
||
We have added a new feature that allows you to receive email notifications when a new version of your crate is published. This can be useful in detecting unauthorized publishes of your crate or simply to keep track of publishes from other members of your team. | ||
|
||
 | ||
|
||
This feature was another [long-standing feature request](https://github.com/rust-lang/crates.io/issues/815) from our community, and we were happy to finally implement it. After some initial pushback from a few vocal community members we also implemented a way to opt out of these notifications. If you feel that your account is secure enough, then you can go to your account settings on crates.io and disable these notifications. | ||
Turbo87 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
## Miscellaneous | ||
|
||
These were some of the more visible changes to crates.io over the past couple of months, but a lot has happened "under the hood" as well. | ||
|
||
- [RFC #3691](https://rust-lang.github.io/rfcs/3691-trusted-publishing-cratesio.html) was opened and accepted to implement "Trusted Publishing" support on crates.io, similar to other ecosystems that adopted it. This will allow you to specify on crates.io which repository/system is allowed to publish new releases of your crate, allowing you to publish crates from CI systems without having to deal with API tokens anymore. | ||
|
||
- Slightly related to the above: API tokens created on crates.io now expire after 90 days by default. It is still possible to disable the expiry or choose other expiry durations though. | ||
|
||
- The crates.io team was one of the first projects to use the [diesel](https://diesel.rs/) database access library, but since that only supported synchronous execution it was sometimes a little awkward to use in our codebase, which was increasingly moving into an async direction after our migration to [axum](https://github.com/tokio-rs/axum) a while ago. The maintainer of diesel, [Georg Semmler](https://github.com/weiznich), did a lot of work to make it possible to use diesel in an async way, resulting in the [diesel-async](https://github.com/weiznich/diesel_async) library. Over the past couple of months we incrementally ported crates.io over to `diesel-async` queries, which now allows us to take advantage of the internal query pipelining in `diesel-async` that resulted in some of our API endpoints getting a 10-15% performance boost. Thank you, Georg, for your work on these crates! | ||
|
||
- Whenever you publish a new version or yank/unyank existing versions a couple of things need to be updated. Our internal database is immediately updated, and then we synchronize the sparse and git index in background worker jobs. Previously, yanking and unyanking a high number of versions would each queue up another synchronization background job. We have now implemented automatic deduplication of redundant background jobs, making our background worker a bit more efficient. | ||
|
||
- The final big, internal change that was just merged last week is related to the testing of our frontend code. In the past we used a tool called [Mirage](https://miragejs.com/) to implement a mock version of our API, which allowed us to run our frontend test suite without having to spin up a full backend server. Unfortunately, the maintenance situation around Mirage had lately forced us to look into alternatives, and we are happy to report that we have now fully migrated to the "Industry standard API mocking" package [msw](https://mswjs.io/). If you want to know more, you can find the details in the "small" [migration pull request](https://github.com/rust-lang/crates.io/pull/10393). | ||
|
||
|
||
## Feedback | ||
|
||
We hope you enjoyed this update on the development of crates.io. If you have any feedback or questions, please let us know on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/318791-t-crates-io) or [GitHub](https://github.com/rust-lang/crates.io/discussions). We are always happy to hear from you and are looking forward to your feedback! |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+115 KB
static/images/2025-02-05-crates-io-development-update/publish-notification.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.