-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add Platform V1 Spec #1187
base: main
Are you sure you want to change the base?
Add Platform V1 Spec #1187
Conversation
Signed-off-by: Ryan Bottriell <[email protected]>
Signed-off-by: Ryan Bottriell <[email protected]>
This allows for reusing it in the future v1/platform-style requirements Signed-off-by: Ryan Bottriell <[email protected]>
Signed-off-by: Ryan Bottriell <[email protected]>
Signed-off-by: Ryan Bottriell <[email protected]>
Signed-off-by: Ryan Bottriell <[email protected]>
b24fa83
to
6d9277b
Compare
Signed-off-by: Ryan Bottriell <[email protected]>
Signed-off-by: Ryan Bottriell <[email protected]>
Signed-off-by: Ryan Bottriell <[email protected]>
Signed-off-by: Ryan Bottriell <[email protected]>
From the meeting today:
|
|
||
As a concept, platforms are packages that only provide _opinions_ on what should exist in an environment. They contain no files or code, and have no concrete dependencies but limit what versions are allowed in order to enforce consistency across teams, applications and developers. | ||
|
||
As an example, the [VFX Reference Platform](https://vfxplatform.com/) provides "a set of tools and library version to be used as a common target platform for building software for the VFX industry". Platforms in SPK were designed to be able to describe and enforce these kind of recommendations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an example, the [VFX Reference Platform](https://vfxplatform.com/) provides "a set of tools and library version to be used as a common target platform for building software for the VFX industry". Platforms in SPK were designed to be able to describe and enforce these kind of recommendations. | |
As an example, the [VFX Reference Platform](https://vfxplatform.com/) provides "a set of tools and library versions to be used as a common target platform for building software for the VFX industry". Platforms in SPK were designed to be able to describe and enforce these kinds of recommendations. |
|
||
### Platforms are Packages | ||
|
||
At their core, platforms are a convent way to write package specs that only provide an opinion on what versions can be used and nothing else. Once defines, platforms are still built, published, and used the same way as any other package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At their core, platforms are a convent way to write package specs that only provide an opinion on what versions can be used and nothing else. Once defines, platforms are still built, published, and used the same way as any other package. | |
At their core, platforms are a convenient way to write package specs that only provide an opinion on what versions can be used and nothing else. Once defined, platforms are still built, published, and used the same way as any other package. |
atRuntime: 3 | ||
``` | ||
|
||
The `platform:` fields provides the name of the platform package. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The `platform:` fields provides the name of the platform package. The | |
The `platform:` field provides the name of the platform package. The |
|
||
Additionally, the platform spec provides a way to inherit requirements from another package. Typically, it makes the most sense to inherit from another platform, but it could be any package. | ||
|
||
By inheriting from base packages, platforms can augment and override their requirements. For example, a DCC (Digital Concent Creation) application platform can inherit the requirements from company or site-specific platform and then introduce additional constraints for the application itself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By inheriting from base packages, platforms can augment and override their requirements. For example, a DCC (Digital Concent Creation) application platform can inherit the requirements from company or site-specific platform and then introduce additional constraints for the application itself. | |
By inheriting from base packages, platforms can augment and override their requirements. For example, a DCC (Digital Content Creation) application platform can inherit the requirements from company or site-specific platforms and then introduce additional constraints for the application itself. |
- pkg: python | ||
atBuild: =3.7.10 | ||
atRuntime: 3.7 | ||
# it also has no need to constrain the version of imath that's used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# it also has no need to constrain the version of imath that's used | |
# it also has no need to constrain the version of imath that is used |
/// Return the canonical name of this request. | ||
pub fn name(&self) -> &OptName { | ||
spk_schema_foundation::spec_ops::Named::name(self) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to keep this?
self.iter().find(|c| name == c.name) | ||
} | ||
|
||
/// Retrieve a component with the provided name or build an insert new one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Retrieve a component with the provided name or build an insert new one | |
/// Retrieve a component with the provided name or insert a new one |
} | ||
|
||
/// Get a mutable reference to the first request with the given name | ||
pub fn get_mut(&mut self, name: impl AsRef<str>) -> Option<&mut R> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows the caller to violate the unique name invariant by changing the name of item returned.
/// All requests with the same name as the given name are removed | ||
/// from the list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No arguments about the implementation here but there is an invariant that names can't be repeated, so the way this is worded is a bit misleading since it implies it could be normal for there to be multiples.
I recognize that this is an existing docstring that is just being relocated.
- pkg: inherit-me2 | ||
atRuntime: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- pkg: inherit-me2
atBuild: =1.0.0
atRuntime: false
What would happen if I wrote this?
Will it be legal to say a package is required [to be a specific version] for build environments but have no influence on runtime environments?
I'm not necessarily arguing for that to be a feature, but looking at this test behavior it is treating this as deleting inherit-me2
from the list. Would the same happen if this said atBuild: false
instead of atRuntime: false
?
If it is not possible to mix and match false and not-false then I would suggest a different way of expressing deletes, like we have in v0.
The next stage in work for #1121 which adds a new way to specify platforms with static build version as well as separated build and runtime requests.
Here is the updated doc page for reference, note that there is no information about the static build version yet as it's not used by anything:
Specifying Platforms
As a concept, platforms are packages that only provide opinions on what should exist in an environment. They contain no files or code, and have no concrete dependencies but limit what versions are allowed in order to enforce consistency across teams, applications and developers.
As an example, the VFX Reference Platform provides "a set of tools and library version to be used as a common target platform for building software for the VFX industry". Platforms in SPK were designed to be able to describe and enforce these kind of recommendations.
Platforms are Packages
At their core, platforms are a convent way to write package specs that only provide an opinion on what versions can be used and nothing else. Once defines, platforms are still built, published, and used the same way as any other package.
A platform spec reduces the amount of boilerplate needed to set up a platform package compared to using the full
v0/package
recipe format. A platform spec will be filled in with appropriate defaults automatically for a platform-style package.Creating Platforms
Below is an example platform
The
platform:
fields provides the name of the platform package. Theapi:
field indicates this is a platform spec.The
requirements
field contains the list of requirements in theplatform. In each case, the requirement specifies the version request to be
used at build time vs at run time. This allows the platform to differently
constrain the requirement depending on if it's being used to define a build
environment or a runtime environment.
These requirements are placed onto the
build
andrun
components of the packagegenerated by this platform, respectively. The generated requirements will have
include: IfAlreadyPresent
added to them automatically, it does not need to bespecified for them.
Inheritance
Additionally, the platform spec provides a way to inherit requirements from another package. Typically, it makes the most sense to inherit from another platform, but it could be any package.
By inheriting from base packages, platforms can augment and override their requirements. For example, a DCC (Digital Concent Creation) application platform can inherit the requirements from company or site-specific platform and then introduce additional constraints for the application itself.
Here is an example platform spec that inherits from the 'company-platform' and makes adjustments of its own:
The
base:
field indicates which platform this one inherits from. In the case of multiple bases, each one simply overrides the previous in turn.Any
atBuild
oratRuntime
value that is specified in the platform spec will override the same value for the named requirement in the bases. Conversely, this also means that if a requirement omits either of theatBuild
oratRuntime
fields, then the value from the base will still remain.The special
false
value can be used to remove the requirement entirely.This is the complete specification of the same resulting
dcc-platform
without basing it on thecompany-platform
: