Suggestion: use Scarb workspaces
Use Scarb workspaces to split the lib into packages.
🧐 Motivation
The library is already pretty broad (in terms of functionality) and sure to grow. There are times were a project does not need all of the features it offers. For example, say I want to use only access control and reentrancy guard. With the current structure, I'd have to pull in the whole cairo-contracts package (thought the unused parts would not be compiled).
With the use of workspaces, I could declare only the dependencies I need inside Scarb.toml, e.g.
[dependencies]
access = { git = "https://github.com/OpenZeppelin/cairo-contracts.git" }
security = { git = "https://github.com/OpenZeppelin/cairo-contracts.git" }
Note this is just a suggestion. I can see arguments for doing it both ways, just wanted to open a discussion.
thanks! we'll reconsider after releasing
For example, say I want to use only access control and reentrancy guard
When OZ modules depend on each other, would this require the user to add "OZ dependencies" manually or does it work out of the box? e.g. Account requires Introspection, does the user need to install Introspection before using Account?
Works out of the box.
As an example, consider alexandria_math package. If in Scarb.toml, we have alexandria_math = { git = "https://github.com/keep-starknet-strange/alexandria.git" } as dependency, Scarb will resolve and install alexandria_math's dependencies as well.