Skip to content

Commit 364b70d

Browse files
authored
Merge pull request NationalGenomicsInfrastructure#941 from fagostini/setup_enhancements
Setup enhancements
2 parents 4a4e140 + 7ce91d4 commit 364b70d

File tree

4 files changed

+13176
-7
lines changed

4 files changed

+13176
-7
lines changed

.pre-commit-config.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
- id: check-ast
10+
- id: check-docstring-first
11+
- id: check-json
12+
- id: pretty-format-json
13+
args: ['--autofix']
14+
- id: check-toml
15+
- id: mixed-line-ending
16+
args: ['--fix', 'auto']
17+
- id: name-tests-test
18+
args: ['--pytest-test-first']
19+
- id: requirements-txt-fixer
20+
- repo: https://github.com/Lucas-C/pre-commit-hooks
21+
rev: v1.5.5
22+
hooks:
23+
- id: remove-tabs
24+
- repo: https://github.com/astral-sh/ruff-pre-commit
25+
rev: v0.11.8
26+
hooks:
27+
- id: ruff
28+
args: [ --fix ]
29+
- id: ruff-format

README.md

Lines changed: 72 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,29 @@ Clone the repository with the `--recursive` option (this will also download [nvd
2020
git clone --recursive https://github.com/NationalGenomicsInfrastructure/genomics-status.git
2121
```
2222

23+
#### Install via `conda` [recommended]
24+
25+
If you are using `conda`, we recommend creating a new environment using `conda-lock` to ensure that the environment is reproducible across different systems.
26+
27+
**Create the environment using `conda-lock` [recommended]**
28+
29+
To create a new environment using `conda-lock`, first install `conda-lock`, if you haven't already, using one of the [available methods](https://github.com/conda/conda-lock/tree/main?tab=readme-ov-file#installation).
30+
31+
Then, run the following command in the root directory of the repository:
32+
33+
```bash
34+
conda-lock install --name <env_name>
35+
```
36+
37+
This will create a new environment with the name `<env_name>` and install all the required dependencies.
38+
2339
<details>
2440

25-
<summary>Note on `conda` environments</summary>
41+
<summary>Using default conda [alternative]</summary>
2642

27-
#### Create the environment with the correct dependencies
43+
#### Create the environment using `conda`
2844

29-
If you decide to use a conda environment, create one making sure to use the `conda_requirements.yml` file with the following command:
45+
If you prefer to create the environment using `conda` directly, you can use the provided `conda_requirements.yml` file.
3046

3147
```bash
3248
conda env create -n <env_name> -f conda_requirements.yml
@@ -40,6 +56,8 @@ conda activate <env_name>
4056

4157
</details>
4258

59+
#### Install via `pip` [alternative]
60+
4361
Install the dependencies and the package (the `pip install -r requirements_dev.txt` can be skipped on a production server)
4462

4563
```bash
@@ -50,11 +68,56 @@ python setup.py install
5068

5169
<details>
5270

53-
<summary>Note on MacOS installations</summary>
71+
<summary>Troubleshoot issues on Apple Silicon installation</summary>
72+
73+
If you are using an Apple Silicon Mac, you may encounter issues with the installation of some libraries, as they may not be compatible with the ARM architecture. Either of the following solutions may help you resolve these issues. The solutions are listed in order of reccommendation.
74+
75+
### Use Dev containers
76+
77+
If you are using Visual Studio Code, you can use the Dev Containers feature to create a development environment that is compatible with your architecture. This will allow you to run the code in a container that has all the necessary dependencies installed.
78+
To do this, you need to enable the Dev Containers feature in Visual Studio Code and then open the repository in a container.
5479

55-
### Fix library issues
80+
### Avoid the problematic python packages
5681

57-
If you are using MacOS, you might run into some issues with the libraries when running the app.
82+
The problematic python packages are only necessary for the correct functionality of the "Agreement and Invoicing" parts of Genomics Status, which are normally not used in a development environment. Therefore, you can skip the installation of these packages by removing them from the `environment.yml` or `conda_requirements.yml` file.
83+
84+
**Conda-lock**
85+
If you are using `conda-lock`, delete the following lines in the `environment.yml` file:
86+
87+
```yaml
88+
- pango
89+
- open-fonts
90+
- xorg-libxrender
91+
- xorg-libxext
92+
- xorg-libxau
93+
```
94+
95+
Then, lock and install the environment again:
96+
97+
```bash
98+
conda lock -f environment.yml
99+
conda-lock install --name <env_name>
100+
```
101+
102+
**Conda**
103+
104+
If you are using the standard `conda` installation, delete the following lines in the `conda_requirements.yml` file:
105+
106+
```yaml
107+
- pango>=1.42.0
108+
- open-fonts
109+
- xorg-libxrender
110+
- xorg-libxext
111+
- xorg-libxau
112+
```
113+
114+
Then, create the environment again:
115+
116+
```bash
117+
conda env create -n <env_name> -f conda_requirements.yml
118+
```
119+
120+
### Fix library issues system-wide
58121

59122
In case you get the `OSError: cannot load library 'gobject-2.0-0'` error (or similar), install `glib` and `pango` via [Homebrew](https://brew.sh/):
60123

@@ -63,7 +126,7 @@ brew install glib
63126
brew install pango
64127
```
65128

66-
and then symlink the libraries to `/usr/local/lib`:
129+
Then, symlink the libraries to `/usr/local/lib`:
67130

68131
```bash
69132
sudo ln -s /opt/homebrew/opt/glib/lib/libgobject-2.0.0.dylib /usr/local/lib/gobject-2.0
@@ -73,6 +136,8 @@ sudo ln -s /opt/homebrew/opt/fontconfig/lib/libfontconfig.1.dylib /usr/local/lib
73136
sudo ln -s /opt/homebrew/opt/pango/lib/libpangoft2-1.0.dylib /usr/local/lib/pangoft2-1.0
74137
```
75138

139+
Finally, try to perform the installation again, either via `conda-lock/conda` or `pip`.
140+
76141
</details>
77142

78143

0 commit comments

Comments
 (0)