Demo cases to get started with farn.
This project uses uv
as package manager.
If you haven't already, install uv, preferably using it's "Standalone installer" method:
..on Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
..on MacOS and Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
(see docs.astral.sh/uv for all / alternative installation methods.)
Once installed, you can update uv
to its latest version, anytime, by running:
uv self update
This project requires Python 3.10 or later.
If you don't already have a compatible version installed on your machine, the probably most comfortable way to install Python is through uv
:
uv python install
This will install the latest stable version of Python into the uv Python directory, i.e. as a uv-managed version of Python.
Alternatively, and if you want a standalone version of Python on your machine, you can install Python either via winget
:
winget install --id Python.Python
or you can download and install Python from the python.org website.
- Download from https://www.graphviz.org/download/
- Run the .exe file
- Choose 'Add Graphviz to the system PATH for current user'
Make sure Graphviz is properly added to your system PATH variables. The following entry needs to exist in the USER PATH environment variable - add or adjust it if necessary:
%ProgramFiles%\Graphviz\bin
- Download the latest cosim release (cosim-v0.x.0-win64.zip) from GitHub
- https://github.com/open-simulation-platform/cosim-cli/releases
Unzip the archive and copy its content into a suitable folder of your choice, e.g.
C:\path\of\your\choice\osp\cosim\
Add the bin path to USER PATH environment variable:
C:\path\of\your\choice\osp\cosim\bin
Clone the farn-demo repository into your local development directory:
git clone https://github.com/dnv-opensource/farn-demo path/to/your/dev/farn-demo
Change into the project directory after cloning:
cd farn-demo
Run uv sync
to create a virtual environment and install all project dependencies into it:
uv sync
Note: Using
--no-dev
will omit installing development dependencies.
Note:
uv
will create a new virtual environment called.venv
in the project root directory when runninguv sync
the first time. Optionally, you can create your own virtual environment using e.g.uv venv
, before runninguv sync
.
When using uv
, there is in almost all cases no longer a need to manually activate the virtual environment.
uv
will find the .venv
virtual environment in the working directory or any parent directory, and activate it on the fly whenever you run a command via uv
inside your project folder structure:
uv run <command>
However, you still can manually activate the virtual environment if needed.
When developing in an IDE, for instance, this can in some cases be necessary depending on your IDE settings.
To manually activate the virtual environment, run one of the "known" legacy commands:
..on Windows:
.venv\Scripts\activate.bat
..on Linux:
source .venv/bin/activate
The .pre-commit-config.yaml
file in the project root directory contains a configuration for pre-commit hooks.
To install the pre-commit hooks defined therein in your local git repository, run:
uv run pre-commit install
All pre-commit hooks configured in .pre-commit-config.yaml
will now run each time you commit changes.
pre-commit can also manually be invoked, at anytime, using:
uv run pre-commit run --all-files
To skip the pre-commit validation on commits (e.g. when intentionally committing broken code), run:
uv run git commit -m <MSG> --no-verify
To update the hooks configured in .pre-commit-config.yaml
to their newest versions, run:
uv run pre-commit autoupdate
Copyright (c) 2024 DNV SE. All rights reserved.
Frank Lumpitzsch - @LinkedIn - [email protected]
Claas Rostock - @LinkedIn - [email protected]
Seunghyeon Yoo - @LinkedIn - [email protected]
Distributed under the MIT license. See LICENSE for more information.
https://github.com/dnv-opensource/farn-demo
- Fork it (https://github.com/dnv-opensource/farn-demo/fork)
- Create an issue in your GitHub repo
- Create your branch based on the issue number and type (
git checkout -b issue-name
) - Evaluate and stage the changes you want to commit (
git add -i
) - Commit your changes (
git commit -am 'place a descriptive commit message here'
) - Push to the branch (
git push origin issue-name
) - Create a new Pull Request in GitHub
For more examples and usage, please refer to farn's documentation.