Use of Poetry to enhance F´ installation #1005
ThibFrgsGmz
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
Link to F´ fork is broken |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there 👋,
I have deployed on my F´ fork the Poetry tool which presents an elegant way to manage virtual environments and dependencies for development projects.
I think it is interesting to set it up on the project because it can make the installation of F' even easier, reducing the number of commands to write that would be reduced to :
poetry install && peotry shell
.Here is a demonstration of the installation:
Installation of Peotry
Peotry is available via Pip but it is advisable to use the supplied installer which will isolate it from the rest of the system. Under GNU/Linux or macOS systems you should run the following command:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
See here for other OS.
Project configuration
Since we are instantiating Poetry on an existing project, in this case F´ , we will configure it with the command
poetry init
:$ cd fprime $ poetry init
This results in an interactive configuration of the project.
We declare information such as the project name, license and dependencies.
At the end of this configuration no restructuring of the project is done, we get a pyprojet.toml file allowing to manage it with Peotry:
This is the file that should be committed on F´ to manage it with Peotry.
Note: at the installation of the project by Peotry we will also note the creation of a locking file poetry.lock. This file contains the list of installed modules with their version number and would ensure that all developers use the same versions of the modules. The commit of this file is valuable because it will ensure that all contributors who configure the project use exactly the same versions of the dependencies that are officially used.
New installation procedure for F´ with Peotry
With the pyprojet.toml file the installation procedure of F´ is simplified.
The developer will only have to run the
poetry install
command to install F´ . This installation goes beyond a simple installation of the modules listed in the pyproject.toml file, this command will also create the virtual environment in which we will be able to develop.We can see that the virtual environment has been created and we can access its information with the
poetry env info
command:To access this virtual environment we just have to type the command
peotry shell
:So the installation of F´ would be done with two commands:
poetry install && peotry shell
.If in the future we want to add a new production or development dependency we have the following commands:
poetry add packageX
poetry add -D packageY
.By analogy for removal we have the commands
peotry remove packageX
andpeotry remove -D packageY
.What do you think at first sight of this implementation? Do you think that it would add value to the project?
In my opinion this would probably improve the user experience, but it goes far beyond that.
Beta Was this translation helpful? Give feedback.
All reactions