feat: add package traits for each dependency#431
Conversation
danthorpe
commented
Mar 21, 2026
- Adds package traits for each dependency.
- by default all traits are enabled.
|
@danthorpe Can you elaborate a bit more with a PR description of what you're doing and why? (Ideally in your own words...LLMs have a habit of being verbose and not quite describing things accurately or at least succinctly.) I know we've expressed interest in adding some traits that are on by default for dependency values that require a package dependency, but I believe that would be a much more minimal set of traits for |
|
Hi @stephencelis yeah, sure. I'm trying to add this package to a large/non-trivial swift-on-server project. We don't really have a need for many of the built-in dependencies that ship out-of-the-box, (except maybe I started a discussion in your project here, where @mbrandonw suggested/hinted that a next step would be to use package traits to gate access to the dependencies. These would all be switched on by default initially, and package consumers would be able to use Haven't discussed the granularity of these traits yet, I figure that this is the limit - but if you wanted to scale things back to reduce the available traits - that seems reasonable too. For my use case, I want to pass Let me know what you think. I can try to connect with you on Slack if you want to discuss more. |
|
Hi @danthorpe, yeah we can discuss what traits we think should be included. Off the top of my head:
I would further recommend taking a simplifying pass at this PR. Right now it introduces strange |
741c7fb to
35f7904
Compare
|
Okay, updated following your recommendations @mbrandonw. Didn't actually read the docs properly initially - didn't see that the SwiftPM automatically makes conditional directives for each trait. The reason why I defined them separately was that I was thinking we need to provide backwards compatibility so that these conditions are active on pre-Swift-6.1. Not immediately clear that it will work for that case, I'm hoping that your CI will expose any issues on older Swift versions... |
|
Hi @danthorpe, thanks for doing that. It's getting closer. However I don't think we need separate traits for |
Doing |
35f7904 to
1f7de0c
Compare
|
Okay - I think fixed everything you raised. |
|
@danthorpe Looking good! We'll discuss tomorrow and hopefully merge! |