Skip to content

Commit 06e8c27

Browse files
committed
refactor install, add virtual environment, fix fx sdynpy links
1 parent 6bd40b9 commit 06e8c27

File tree

3 files changed

+35
-7
lines changed

3 files changed

+35
-7
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ jobs:
321321
keep_files: true
322322
commit_message: 'Deploy reports for ${{ github.ref_name }} (${{ github.sha }})'
323323

324-
matrix:
324+
pytest_matrix:
325325
runs-on: ${{ matrix.os }}
326326
strategy:
327327
matrix:

documentation/book/src/chapter_02.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,44 @@ The alternative to running the Rattlesnake as an executable is to run it as a Py
4242

4343
The first step to running Rattlesnake from its Python script is to install Python. This can be done in multiple ways. Python can be downloaded and installed from the [Python website](https://www.python.org/) directly. When installed this way, Python will not include any of the numeric or scientific libraries such as [NumPy](https://numpy.org) or [SciPy](https://scipy.org). For this reason, many users will prefer to download a scientific Python distribution which contains many numeric or scientific libraries. [Anaconda](https://www.anaconda.com/) or [WinPython](https://winpython.github.io/) are popular distributions.
4444

45-
Regardless of the distribution selected, users will need to install packages that Rattlesnake depends on. The GitHub repository contains a [requirements.txt](https://github.com/sandialabs/rattlesnake-vibration-controller/blob/main/requirements.txt) file that can be used by the Python package manager `pip` to install all required dependencies:
45+
### Virtual Enrivonment
46+
47+
It is a best practice to install Rattlesnake within a virtual environment. A virtual environment is a self-contained directory that contains a specific Python installation, along with additional packages. It allows users to create an isolated environment, ensuring that dependicies and libraries do not interfere with each other.
48+
49+
Create a virtual environment with either `pip` or `uv`. `pip` is already included with Python, whereas `uv` must be [installed](https://docs.astral.sh/uv/getting-started/installation/) separately. `uv` is significantly faster than `pip` (often 10–100x) and is recommended, though not required.
4650

47-
```sh
48-
pip install -r requirements.txt
4951
```
52+
# Option 1: pip method
53+
python -m venv .venv
54+
55+
# Option 2: uv method
56+
uv venv
57+
58+
# For both methods, prior to installation, activate the environment, depending on which shell is in use:
59+
60+
source .venv/bin/activate # bash / zsh
61+
source .venv/bin/activate.fish # fish shell
62+
.\.venv\Scripts\activate # Windows (PowerShell/CMD)
63+
```
64+
65+
### Installation
66+
67+
Regardless of the distribution and virtual environment generation method selected, users will need to install the dependencies
68+
required by Rattlesnake. The project uses a `pyproject.toml` file to manage its
69+
environment. Install the package and its dependencies directly using `pip`:
70+
71+
* For **standard users:** `pip install .`
72+
* For **developers** (includes tools like `pytest` defined in the `dev` extra):
73+
* `pip install -e .[dev]` or
74+
* `uv pip install -e .[dev]`
75+
76+
The `-e` flag installs the project in *editable mode*, ensuring that any changes you make
77+
to the source code are reflected immediately in the environment.
5078

51-
Note that if running through a corporate or university firewall, the proxy may need to be specified in `pip`. Additionally, on some networks the Python package repositories must be added as trusted hosts. Such a command may look like
79+
If running through a corporate or university firewall, the proxy may need to be specified in `pip`. Additionally, on some networks the Python package repositories must be added as trusted hosts. Such a command may look like
5280

5381
```sh
54-
pip --proxy <proxy_address> install --trusted-host pypi.org --trusted-host files.pythonhosted.org -r requirements.txt
82+
pip --proxy <proxy_address> install --trusted-host pypi.org --trusted-host files.pythonhosted.org
5583
```
5684

5785
where `<proxy_address>` is the address of the proxy.

documentation/book/src/chapter_10.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ numbering:
1616
(sec:sdynpy_hardware)=
1717
# Virtual Control using SDYNPY System Objects
1818

19-
The final option for synthetic control in Rattlesnake is to load in a SDynPy [`System`](https://sandialabs.github.io/sdynpy/_autosummary/sdynpy.core.sdynpy_system.System.html) object, which gets stored from SDynPy using the [`sdyn.System.save`](https://sandialabs.github.io/sdynpy/_autosummary/sdynpy.core.sdynpy_system.System.html#sdynpy.core.sdynpy_system.System.save) method. SDynPy `System` objects store mass, stiffness, and damping matrices. They also store transformation matrices which transform its internal system space into the physical space. This allows SDynPy `System` objects to represent both "full" physical systems as well as "reduced" systems (e.g., Craig-Bampton or Modal systems). The final part of the SDynPy `System` is the degree of freedom information that is stored with the matrices. This maps rows of the transformation matrix (or rows of the mass, stiffness, and damping matrices if the transformation is the identity matrix) to physical degrees of freedom.
19+
The final option for synthetic control in Rattlesnake is to load in a SDynPy [`System`](https://sandialabs.github.io/sdynpy/sdynpy-system/) object, which gets stored from SDynPy using the [`sdyn.System.save`](https://sandialabs.github.io/sdynpy/sdynpy-system/#api-sdynpy-system-save) method. SDynPy `System` objects store mass, stiffness, and damping matrices. They also store transformation matrices which transform its internal system space into the physical space. This allows SDynPy `System` objects to represent both "full" physical systems as well as "reduced" systems (e.g., Craig-Bampton or Modal systems). The final part of the SDynPy `System` is the degree of freedom information that is stored with the matrices. This maps rows of the transformation matrix (or rows of the mass, stiffness, and damping matrices if the transformation is the identity matrix) to physical degrees of freedom.
2020

2121
A complete example problem using a SDynPy `System` object can be found in @sec:example_sdynpy.
2222

0 commit comments

Comments
 (0)