Open yperess opened 1 year ago
My view on this is use a package manager if you want a package manager and keep it out of west, the package manager can invoke west commands.
@yperess there are two levels of dependencies to consider:
Does this RFC cover point 2 only or both?
@yperess there are two levels of dependencies to consider:
- arch/board/soc/subsystem require a module A, for example, an STMicro board requires the ST hal
- module A requires a binary: For example, nanopb requires protoc or thrift module requires thrift package
Does this RFC cover point 2 only or both?
This proposal covers the second case. I hadn't considered checking if a module is added (I assume at build time since it'll be config/board dependent) but that's an interesting use. We would need to assign name/version to modules but that can easily be done in the module manifest. Since people can have their own version of modules (maybe their own forks out computer custom logic they would just need to make sure it matches the name). Let me think about that some more.
My view on this is use a package manager if you want a package manager and keep it out of west, the package manager can invoke west commands.
I'm not familiar with a package manager that can handle multiple types. Afaik they are usually separated by domains; for example: pip (python), npm (node), APT (Ubuntu binaries). Are you familiar with one that manages all? The issue will remain that downstream might need to override the source of these. For example, Google will not let us install from pip in CI. We have CIPD which manages our packages. So I was trying to think of a flexible way to default to the common package manager while allowing downstream to override.
Adding to the thread some people that may be interested @fabiobaltieri @andyross @mbolivar
@yperess what would improve upstream from this? I think we discussed how this could help maintaining what right now is under requirements*.txt
, maybe help out tracing what needs a certain dependency (which may be use to find what is no longer needed) and simplifying the CI setup.
@yperess what would improve upstream from this? I think we discussed how this could help maintaining what right now is under
requirements*.txt
, maybe help out tracing what needs a certain dependency (which may be use to find what is no longer needed) and simplifying the CI setup.
Upstream would benefit from:
west update
.All of this will make things easier to set up CI and generally develop for Zephyr over a long period of time.
Touched upon here as well https://github.com/zephyrproject-rtos/zephyr/issues/54276
Some copy-paste
is something like https://github.com/kdeldycke/meta-package-manager be useful to abstract the different pkg/os managers?
During Arch WG, @yperess said that it doesn't have to go into west update, it could go into its own command, etc.
I want to encourage not putting it into west update for the following reasons off the top of my head:
west update
has no knowledge of module.yml and I think the coupling should be kept loose unless there is a convincing reason why notwest update
does exactly what the documentation says and what they see in the code for the pypi package they installed@yperess as a general design request, I'd like to see more information on the layering where the changes to 'core' west are all mechanism, and the uses in zephyr are the application of those mechanisms towards some particular policy that achieves the desired goal here.
@mbolivar-nordic thanks for the feedback and your patience. I get your point about west update
and honestly I only thought of adding it there because it would be nice not to have to remember another command to run EVERY time after I run update
. For now I'm happy adding this as a standalone command. So I guess I'll amend my proposal to:
west workspace --list-requirements
for requirements of the "current" workspace. This subcommand will list all the requirements as curated by the modules. @galak I like mpm, I'll try to use their json format and see what happens.west workspace
which should:
2.1 Get the list of requirements
2.2 Check if they're all up-to-date (update if not)
2.3 Create or enter the python virtual environment (default would be .zenv
but can be overridden in the west config).I'm currently only really fuzzy on the last step of using python to enter the virtual environment. It might be impossible but someone with more Python experience should probably weigh in.
Using the name west workspace
for an extension command feels like stealing prime namespace for a builtin. Can we try to come up with something better? How about west modules
instead?
It might be impossible
It is impossible to enter a virtual environment from a west command.
Entering a virtual environment involves changing environment variables. Child processes cannot change the environments of their parents. West therefore cannot change the shell environment it runs under.
This is why the venv module creates multiple activation scripts, one per supported calling environment (bash, .bat, etc.), and it's why you have to source, not run, the scripts.
@MaureenHelm MaureenHelm assigned mbolivar-nordic 5 days ago
Not me. @yperess feel free to reopen and assign yourself
Introduction
This work intends to automate the tooling dependency management of Zephyr projects. The idea is to script https://docs.zephyrproject.org/latest/develop/getting_started/index.html in an extensible way that will work for most projects.
NOTE: this is not intended to manage zephyr modules. Those will still need to be done the same way they currently are via the West projects.
Problem description
Managing dependencies and communicating changes to these dependencies comes with unnecessary overhead that can easily be automated
Proposed change
west update
get a snapshot of all the modules + zephyr and take the union of the dependenciesMilestone 1
As step 4, print the changed dependencies
Milestone 2
Add a new top level west class
WestInstaller
that's similar to how west commands are done. The west.yml will be able to map dependencytype
to an installer. By defaultpython
type will map topip
,native
under linux can be mapped to an installer that callsapt-get
etc. This way downstream clients can remap the installers to their own trusted sources or include any custom install instructions they might need.west update
will automatically attempt to install the dependencies. This can easily be turned on/off via a west config value (we can default it tofalse
).Detailed RFC
Proposed change (Detailed)
The first step is to add the dependency list to Zephyr and the official modules. Each repo will include a PR that adds a list of dependencies which currently include the following:
python
- a single python package dependencypython-list
- a list of python dependencies that will be installed using the-r
flag inpip
native
- a native executable that needs to be available.At this point, we'll add a new flag (
west update --list-deps
) which will allow the developers to see the current snapshot of the dependencies. We'll also add a new west config value which will be defaulted tofalse
to enable dependency management inwest update
. If enabled by thewest.yml
of the project, thenwest update
will print the dependency diff at the end.The second step will be to add the top level
WestInstaller
class and aPipInstaller
andPipListInstaller
subclasses that will handlepython
andpython-list
types. If the above config value is enabled, we'll also by default create the.venv
python virtual environment or read a name for the virtual environment from another config value.The third step will be to add the
NativeInstaller
which will handle thenative
type for various operating systems (automativing https://docs.zephyrproject.org/latest/develop/getting_started/index.html#install-dependencies).