-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from dnv-opensource/update-dependencies
Update Dependencies
- Loading branch information
Showing
9 changed files
with
204 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: mixed-line-ending | ||
args: [--fix=auto] | ||
- id: trailing-whitespace | ||
- id: check-yaml | ||
- id: check-toml | ||
- id: check-merge-conflict | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.9.2 | ||
hooks: | ||
- id: ruff-format | ||
- id: ruff | ||
# - repo: https://github.com/pre-commit/mirrors-mypy | ||
# rev: v1.14.1 | ||
# hooks: | ||
# - id: mypy | ||
exclude: '(.venv|.*_cache)/.*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
title: farn-demo | ||
version: 0.4.1 | ||
abstract: >- | ||
Demo cases to get started with farn. | ||
type: software | ||
authors: | ||
- name: DNV SE | ||
address: 'Brooktorkai 18' | ||
post-code: '20457' | ||
city: Hamburg | ||
country: DE | ||
website: 'https://www.dnv.com/' | ||
- given-names: Frank | ||
family-names: Lumpitzsch | ||
affiliation: DNV | ||
email: [email protected] | ||
website: 'https://www.linkedin.com/in/frank-lumpitzsch-23013196/' | ||
- given-names: Claas | ||
family-names: Rostock | ||
affiliation: DNV | ||
email: [email protected] | ||
website: 'https://www.linkedin.com/in/claasrostock/?locale=en_US' | ||
- given-names: Seunghyeon | ||
family-names: Yoo | ||
affiliation: DNV | ||
email: [email protected] | ||
website: 'https://www.linkedin.com/in/seunghyeon-yoo-3625173b/' | ||
keywords: | ||
- farn | ||
- OSP | ||
- fmi | ||
license: MIT | ||
license-url: 'https://dnv-opensource.github.io/farn/LICENSE.html' | ||
url: 'https://dnv-opensource.github.io/farn/README.html' | ||
repository-code: 'https://github.com/dnv-opensource/farn' | ||
message: 'Please cite this software using these metadata.' | ||
cff-version: 1.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# farn-demo | ||
demo cases to get started with [farn][farn_docs] | ||
Demo cases to get started with [farn][farn_docs]. | ||
|
||
|
||
## Development Setup | ||
|
@@ -69,36 +69,25 @@ C:\path\of\your\choice\osp\cosim\bin | |
### 5. Clone the repository | ||
Clone the farn-demo repository into your local development directory: | ||
```sh | ||
git clone https://github.com/dnv-innersource/farn-demo path/to/your/dev/farn-demo | ||
git clone https://github.com/dnv-opensource/farn-demo path/to/your/dev/farn-demo | ||
``` | ||
Change into the project directory after cloning: | ||
```sh | ||
cd farn-demo | ||
``` | ||
|
||
### 6. Install dependencies | ||
Run `uv sync` to create a virtual environment and install all project dependencies into it: | ||
```sh | ||
uv sync | ||
``` | ||
> **Note**: Using `--no-dev` will omit installing development dependencies. | ||
### 7. (Optional) Install CUDA support | ||
Run `uv sync` with option `--extra cuda` to in addition install torch with CUDA support: | ||
```sh | ||
uv sync --extra cuda | ||
``` | ||
|
||
Alternatively, you can manually install torch with CUDA support. | ||
_Note 1_: Do this preferably _after_ running `uv sync`. That way you ensure a virtual environment exists, which is a prerequisite before you install torch with CUDA support using below `uv pip install` command. | ||
|
||
To manually install torch with CUDA support, generate a `uv pip install` command matching your local machine's operating system using the wizard on the official [PyTorch website](https://pytorch.org/get-started/locally/). | ||
_Note_: As we use `uv` as package manager, remember to replace `pip` in the command generated by the wizard with `uv pip`. | ||
|
||
If you are on Windows, the resulting `uv pip install` command will most likely look something like this: | ||
```sh | ||
uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124 | ||
``` | ||
> **Note**: `uv` will create a new virtual environment called `.venv` in the project root directory when running | ||
> `uv sync` the first time. Optionally, you can create your own virtual environment using e.g. `uv venv`, before running | ||
> `uv sync`. | ||
_Hint:_ If you are unsure which cuda version to indicate in above `uv pip install .. /cuXXX` command, you can use the shell command `nvidia-smi` on your local system to find out the cuda version supported by the current graphics driver installed on your system. When then generating the `uv pip install` command with the wizard from the [PyTorch website](https://pytorch.org/get-started/locally/), select the cuda version that matches the major version of what your graphics driver supports (major version must match, minor version may deviate). | ||
|
||
|
||
### 8. (Optional) Activate the virtual environment | ||
### 7. (Optional) Activate the virtual environment | ||
When using `uv`, there is in almost all cases no longer a need to manually activate the virtual environment. <br> | ||
`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: | ||
```sh | ||
|
@@ -117,6 +106,54 @@ To manually activate the virtual environment, run one of the "known" legacy comm | |
source .venv/bin/activate | ||
``` | ||
|
||
### 8. Install pre-commit hooks | ||
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: | ||
```sh | ||
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: | ||
```sh | ||
uv run pre-commit run --all-files | ||
``` | ||
|
||
To skip the pre-commit validation on commits (e.g. when intentionally committing broken code), run: | ||
```sh | ||
uv run git commit -m <MSG> --no-verify | ||
``` | ||
|
||
To update the hooks configured in `.pre-commit-config.yaml` to their newest versions, run: | ||
```sh | ||
uv run pre-commit autoupdate | ||
``` | ||
|
||
## Meta | ||
|
||
Copyright (c) 2024 [DNV](https://www.dnv.com) SE. All rights reserved. | ||
|
||
Frank Lumpitzsch - [@LinkedIn](https://www.linkedin.com/in/frank-lumpitzsch-23013196/) - [email protected] | ||
|
||
Claas Rostock - [@LinkedIn](https://www.linkedin.com/in/claasrostock/?locale=en_US) - [email protected] | ||
|
||
Seunghyeon Yoo - [@LinkedIn](https://www.linkedin.com/in/seunghyeon-yoo-3625173b/) - [email protected] | ||
|
||
Distributed under the MIT license. See [LICENSE](LICENSE.md) for more information. | ||
|
||
[https://github.com/dnv-opensource/farn-demo](https://github.com/dnv-opensource/farn-demo) | ||
|
||
## Contributing | ||
|
||
1. Fork it (<https://github.com/dnv-opensource/farn-demo/fork>) | ||
2. Create an issue in your GitHub repo | ||
3. Create your branch based on the issue number and type (`git checkout -b issue-name`) | ||
4. Evaluate and stage the changes you want to commit (`git add -i`) | ||
5. Commit your changes (`git commit -am 'place a descriptive commit message here'`) | ||
6. Push to the branch (`git push origin issue-name`) | ||
7. Create a new Pull Request in GitHub | ||
|
||
|
||
## farn Documentation on GitHub | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,78 @@ | ||
[project] | ||
name = "farn-demo" | ||
version = "0.4.0" | ||
description = "examples of how to use the farn package." | ||
version = "0.4.1" | ||
description = "Demo cases to get started with farn." | ||
readme = "README.md" | ||
requires-python = ">= 3.10" | ||
requires-python = ">= 3.10, < 3.14" | ||
license = { file = "LICENSE" } | ||
authors = [ | ||
{ name = "Frank Lumpitzsch", email = "[email protected]" }, | ||
{ name = "Claas Rostock", email = "[email protected]" }, | ||
{ name = "Seunghyeon Yoo", email = "[email protected]" }, | ||
] | ||
maintainers = [ | ||
{ name = "Claas Rostock", email = "[email protected]" }, | ||
] | ||
keywords = [ | ||
"farn", | ||
"OSP", | ||
"fmi", | ||
] | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: 3.13", | ||
"Operating System :: Microsoft :: Windows", | ||
"Operating System :: POSIX :: Linux", | ||
"Operating System :: MacOS", | ||
"Environment :: Console", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"Topic :: Scientific/Engineering", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
] | ||
dependencies = [ | ||
"farn>=0.4.0", | ||
"farn>=0.4.1", | ||
] | ||
|
||
[tool.uv] | ||
dev-dependencies = [ | ||
"ruff>=0.8.3", | ||
"pyright>=1.1.390", | ||
"mypy>=1.13", | ||
"sourcery>=1.27", | ||
[project.urls] | ||
Homepage = "https://github.com/dnv-opensource/farn" | ||
Documentation = "https://dnv-opensource.github.io/farn/README.html" | ||
Repository = "https://github.com/dnv-opensource/farn.git" | ||
Issues = "https://github.com/dnv-opensource/farn/issues" | ||
Changelog = "https://github.com/dnv-opensource/farn/blob/main/CHANGELOG.md" | ||
|
||
|
||
[dependency-groups] | ||
dev = [ | ||
"ruff>=0.9.2", | ||
"pyright>=1.1.392", | ||
"mypy>=1.14", | ||
"sourcery>=1.31", | ||
"pre-commit>=4.0", | ||
"pandas-stubs>=2.2", | ||
"types-psutil>=6.1", | ||
"types-lxml>=2024.11", | ||
"types-lxml>=2024.12", | ||
] | ||
|
||
[tool.uv] | ||
default-groups = [ | ||
"dev", | ||
] | ||
native-tls = true | ||
|
||
[tool.mypy] | ||
plugins = [ | ||
"numpy.typing.mypy_plugin", | ||
] | ||
mypy_path = "stubs" | ||
files = [ | ||
"src", | ||
"tests", | ||
"demos", | ||
"farn", | ||
"importSystemStructure", | ||
"ospCaseBuilder", | ||
] | ||
exclude = [ | ||
"^src/folder_to_be_excluded/", | ||
|
@@ -39,18 +83,23 @@ disable_error_code = [ | |
"import-untyped", | ||
] | ||
|
||
|
||
[tool.pyright] | ||
stubPath = "stubs" | ||
include = [ | ||
"farn", | ||
"importSystemStructure", | ||
"ospCaseBuilder", | ||
] | ||
exclude = [ | ||
"src/folder_to_be_excluded", | ||
] | ||
|
||
typeCheckingMode = "basic" | ||
useLibraryCodeForTypes = true | ||
reportMissingParameterType = "error" | ||
reportUnknownParameterType = "warning" | ||
reportUnknownMemberType = "warning" # consider to set to `false` if you work a lot with matplotlib and pandas, which are both not properly typed and known to trigger this warning | ||
reportUnknownMemberType = "warning" # consider to set to `false` if you work a lot with matplotlib and pandas, which are both not properly typed and known to trigger this warning | ||
reportMissingTypeArgument = "error" | ||
reportPropertyTypeMismatch = "error" | ||
reportFunctionMemberAccess = "warning" | ||
|
Oops, something went wrong.