Skip to content

Commit 4621584

Browse files
authored
Re-apply lost updates in dev guides (#202)
* Re-apply updates to build csp from source Signed-off-by: Pavithra Eswaramoorthy <[email protected]> * Add note about DCO in the Contribute.md Signed-off-by: Pavithra Eswaramoorthy <[email protected]> * Add back install notes about perl-ipc & git * Add back Using System Dependencies section Signed-off-by: Pavithra Eswaramoorthy <[email protected]> --------- Signed-off-by: Pavithra Eswaramoorthy <[email protected]>
1 parent 5c7e55f commit 4621584

File tree

2 files changed

+51
-33
lines changed

2 files changed

+51
-33
lines changed

docs/wiki/dev-guides/Build-CSP-from-Source.md

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ CSP is written in Python and C++ with Python and C++ build dependencies. While p
1010
- [Clone](#clone)
1111
- [Install build dependencies](#install-build-dependencies)
1212
- [Build](#build)
13+
- [A note about dependencies](#a-note-about-dependencies)
1314
- [Building with a system package manager](#building-with-a-system-package-manager)
1415
- [Clone](#clone-1)
1516
- [Install build dependencies](#install-build-dependencies-1)
@@ -18,6 +19,7 @@ CSP is written in Python and C++ with Python and C++ build dependencies. While p
1819
- [Install Python dependencies](#install-python-dependencies)
1920
- [Build](#build-1)
2021
- [Building on `aarch64` Linux](#building-on-aarch64-linux)
22+
- [Using System Dependencies](#using-system-dependencies)
2123
- [Lint and Autoformat](#lint-and-autoformat)
2224
- [Testing](#testing)
2325
- [Troubleshooting](#troubleshooting)
@@ -49,29 +51,16 @@ CSP has a few system-level dependencies which you can install from your machine
4951

5052
The easiest way to get started on a Linux machine is by installing the necessary dependencies in a self-contained conda environment.
5153

52-
Tweak this script to create a conda environment, install the build dependencies, build, and install a development version of CSP into the environment.
54+
Tweak this script to create a conda environment, install the build dependencies, build, and install a development version of `csp` into the environment. Note that we use [micromamba](https://mamba.readthedocs.io/en/latest/index.html) in this example, but [Anaconda](https://www.anaconda.com/download), [Miniconda](https://docs.anaconda.com/free/miniconda/index.html), [Miniforge](https://github.com/conda-forge/miniforge), etc, should all work fine.
5355

5456
### Install conda
5557

5658
```bash
57-
mkdir ~/github
58-
cd ~/github
59+
# download and install micromamba for Linux/Mac
60+
"${SHELL}" <(curl -L micro.mamba.pm/install.sh)
5961

60-
# this downloads a Linux x86_64 build, change your architecture to match your development machine
61-
# see https://conda-forge.org/miniforge/ for alternate download links
62-
63-
wget https://github.com/conda-forge/miniforge/releases/download/23.3.1-1/Mambaforge-23.3.1-1-Linux-x86_64.sh
64-
chmod 755 Mambaforge-23.3.1-1-Linux-x86_64.sh
65-
./Mambaforge-23.3.1-1-Linux-x86_64.sh -b -f -u -p csp_venv
66-
67-
. ~/github/csp_venv/etc/profile.d/conda.sh
68-
69-
# optionally, run this if you want to set up conda in your .bashrc
70-
# conda init bash
71-
72-
conda config --add channels conda-forge
73-
conda config --set channel_priority strict
74-
conda activate base
62+
# on windows powershell
63+
# Invoke-Expression ((Invoke-WebRequest -Uri https://micro.mamba.pm/install.ps1).Content)
7564
```
7665

7766
### Clone
@@ -88,31 +77,31 @@ git submodule update --init --recursive
8877
# Note the operating system, change as needed
8978
# Linux and MacOS should use the unix dev environment spec
9079
micromamba create -n csp -f conda/dev-environment-unix.yml
80+
81+
# uncomment below if the build fails because git isn't new enough
82+
#
83+
# micromamba install -y -n csp git
84+
85+
# uncomment below if the build fails because perl-ipc-system is missing
86+
# (this happens on some RHEL7 systems)
87+
#
88+
# micromamba install -y -n csp perl-ipc-system-simple
89+
9190
micromamba activate csp
9291
```
9392

9493
### Build
9594

9695
```bash
97-
make build
98-
99-
# on aarch64 linux, comment the above command and use this instead
100-
# VCPKG_FORCE_SYSTEM_BINARIES=1 make build
96+
make build-conda
10197

102-
# finally install into the csp_venv conda environment
98+
# finally install into the csp conda environment
10399
make develop
104100
```
105101

106-
If you didn’t do `conda init bash` you’ll need to re-add conda to your shell environment and activate the `csp` environment to use it:
102+
### A note about dependencies
107103

108-
```bash
109-
. ~/github/csp_venv/etc/profile.d/conda.sh
110-
conda activate csp
111-
112-
# make sure everything works
113-
cd ~/github/csp
114-
make test
115-
```
104+
In Conda, we pull our dependencies from the Conda environment by setting the environment variable `CSP_USE_VCPKG=0`. This will force the build to not pull dependencies from vcpkg. This may or may not work in other environments or with packages provided by other package managers or built from source, but there is too much variability for us to support alternative patterns.
116105

117106
## Building with a system package manager
118107

@@ -187,6 +176,8 @@ Build the python project in the usual manner:
187176
```bash
188177
make build
189178

179+
# on aarch64 linux, comment the above command and use this instead
180+
# VCPKG_FORCE_SYSTEM_BINARIES=1 make build
190181
# or
191182
# python setup.py build build_ext --inplace
192183
```
@@ -199,6 +190,10 @@ On `aarch64` Linux the VCPKG_FORCE_SYSTEM_BINARIES environment variable must be
199190
VCPKG_FORCE_SYSTEM_BINARIES=1 make build
200191
```
201192

193+
## Using System Dependencies
194+
195+
By default, we pull and build dependencies with [vcpkg](https://vcpkg.io/en/). We only support non-vendored dependencies via Conda (see [A note about dependencies](#A-note-about-dependencies) above).
196+
202197
## Lint and Autoformat
203198

204199
CSP has listing and auto formatting.
@@ -231,7 +226,7 @@ make fix-cpp
231226
make lint-py
232227
# or
233228
# python -m isort --check csp/ setup.py
234-
# python -m ruff csp/ setup.py
229+
# python -m ruff check csp/ setup.py
235230
```
236231

237232
**Python Autoformatting**
@@ -243,6 +238,24 @@ make fix-py
243238
# python -m ruff format csp/ setup.py
244239
```
245240

241+
**Documentation Linting**
242+
243+
```bash
244+
make lint-docs
245+
# or
246+
# python -m mdformat --check docs/wiki/ README.md examples/README.md
247+
# python -m codespell_lib docs/wiki/ README.md examples/README.md
248+
```
249+
250+
**Documentation Autoformatting**
251+
252+
```bash
253+
make fix-docs
254+
# or
255+
# python -m mdformat docs/wiki/ README.md examples/README.md
256+
# python -m codespell_lib --write docs/wiki/ README.md examples/README.md
257+
```
258+
246259
## Testing
247260

248261
CSP has both Python and C++ tests. The bulk of the functionality is tested in Python, which can be run via `pytest`. First, install the Python development dependencies with

docs/wiki/dev-guides/Contribute.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Contributions are welcome on this project. We distribute under the terms of the [Apache 2.0 license](https://github.com/Point72/csp/blob/main/LICENSE).
22

3+
> \[!NOTE\]
4+
> CSP requires [Developer Certificate of Origin](https://en.wikipedia.org/wiki/Developer_Certificate_of_Origin) for all contributions.
5+
> This is enforced by a [Probot GitHub App](https://probot.github.io/apps/dco/), which checks that commits are "signed".
6+
> Read [instructions to configure commit signing](Local-Development-Setup#configure-commit-signing).
7+
38
For **bug reports** or **small feature requests**, please open an issue on our [issues page](https://github.com/Point72/csp/issues).
49

510
For **questions** or to discuss **larger changes or features**, please use our [discussions page](https://github.com/Point72/csp/discussions).

0 commit comments

Comments
 (0)