-
Notifications
You must be signed in to change notification settings - Fork 19
Setup enhancements #941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fagostini
wants to merge
3
commits into
NationalGenomicsInfrastructure:master
Choose a base branch
from
fagostini:setup_enhancements
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Setup enhancements #941
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,29 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-docstring-first | ||
- id: check-json | ||
- id: pretty-format-json | ||
args: ['--autofix'] | ||
- id: check-toml | ||
- id: mixed-line-ending | ||
args: ['--fix', 'auto'] | ||
- id: name-tests-test | ||
args: ['--pytest-test-first'] | ||
- id: requirements-txt-fixer | ||
- repo: https://github.com/Lucas-C/pre-commit-hooks | ||
rev: v1.5.5 | ||
hooks: | ||
- id: remove-tabs | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.11.8 | ||
hooks: | ||
- id: ruff | ||
args: [ --fix ] | ||
- id: ruff-format |
This file contains hidden or 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 |
---|---|---|
|
@@ -22,59 +22,78 @@ git clone --recursive https://github.com/NationalGenomicsInfrastructure/genomics | |
|
||
<details> | ||
|
||
<summary>Note on `conda` environments</summary> | ||
<summary>Note on MacOS installations</summary> | ||
|
||
#### Create the environment with the correct dependencies | ||
### Fix library issues | ||
|
||
If you decide to use a conda environment, create one making sure to use the `conda_requirements.yml` file with the following command: | ||
If you are using MacOS, you might run into some issues with the libraries when running the app. | ||
|
||
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/): | ||
|
||
```bash | ||
conda env create -n <env_name> -f conda_requirements.yml | ||
brew install glib | ||
brew install pango | ||
``` | ||
|
||
where `<env_name>` is the name of the environment you want to create. Then, activate the environment with: | ||
and then symlink the libraries to `/usr/local/lib`: | ||
|
||
```bash | ||
conda activate <env_name> | ||
sudo ln -s /opt/homebrew/opt/glib/lib/libgobject-2.0.0.dylib /usr/local/lib/gobject-2.0 | ||
sudo ln -s /opt/homebrew/opt/pango/lib/libpango-1.0.dylib /usr/local/lib/pango-1.0 | ||
sudo ln -s /opt/homebrew/opt/harfbuzz/lib/libharfbuzz.dylib /usr/local/lib/harfbuzz | ||
sudo ln -s /opt/homebrew/opt/fontconfig/lib/libfontconfig.1.dylib /usr/local/lib/fontconfig-1 | ||
sudo ln -s /opt/homebrew/opt/pango/lib/libpangoft2-1.0.dylib /usr/local/lib/pangoft2-1.0 | ||
``` | ||
|
||
</details> | ||
|
||
Install the dependencies and the package (the `pip install -r requirements_dev.txt` can be skipped on a production server) | ||
|
||
#### Install via `conda` [recommended] | ||
|
||
If you are using `conda`, we recommend creating a new environment using `conda-lock` to ensure that the environment is reproducible across different systems. | ||
|
||
**Create the environment using `conda-lock` [recommended]** | ||
|
||
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). | ||
|
||
Then, run the following command in the root directory of the repository: | ||
|
||
```bash | ||
pip install -r requirements.txt | ||
pip install -r requirements_dev.txt | ||
python setup.py install | ||
conda-lock install --name <env_name> | ||
``` | ||
|
||
<details> | ||
This will create a new environment with the name `<env_name>` and install all the required dependencies. | ||
|
||
<summary>Note on MacOS installations</summary> | ||
<details> | ||
|
||
### Fix library issues | ||
<summary>Using default conda [alternative]</summary> | ||
|
||
If you are using MacOS, you might run into some issues with the libraries when running the app. | ||
#### Create the environment using `conda` | ||
|
||
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/): | ||
If you prefer to create the environment using `conda` directly, you can use the provided `conda_requirements.yml` file. | ||
|
||
```bash | ||
brew install glib | ||
brew install pango | ||
conda env create -n <env_name> -f conda_requirements.yml | ||
``` | ||
|
||
and then symlink the libraries to `/usr/local/lib`: | ||
where `<env_name>` is the name of the environment you want to create. Then, activate the environment with: | ||
|
||
```bash | ||
sudo ln -s /opt/homebrew/opt/glib/lib/libgobject-2.0.0.dylib /usr/local/lib/gobject-2.0 | ||
sudo ln -s /opt/homebrew/opt/pango/lib/libpango-1.0.dylib /usr/local/lib/pango-1.0 | ||
sudo ln -s /opt/homebrew/opt/harfbuzz/lib/libharfbuzz.dylib /usr/local/lib/harfbuzz | ||
sudo ln -s /opt/homebrew/opt/fontconfig/lib/libfontconfig.1.dylib /usr/local/lib/fontconfig-1 | ||
sudo ln -s /opt/homebrew/opt/pango/lib/libpangoft2-1.0.dylib /usr/local/lib/pangoft2-1.0 | ||
conda activate <env_name> | ||
``` | ||
|
||
</details> | ||
|
||
#### Install via `pip` [alternative] | ||
|
||
Install the dependencies and the package (the `pip install -r requirements_dev.txt` can be skipped on a production server) | ||
|
||
```bash | ||
pip install -r requirements.txt | ||
pip install -r requirements_dev.txt | ||
python setup.py install | ||
``` | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if this is enough anymore. We install pandas through conda, in addition to the packages needed for Agreements and Invoicing. |
||
|
||
### Configuration | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does one really need to change the /usr/local/lib ? I'm a bit wary when running sudo and touching what looks like system package territory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry, saw that this is just moved in the README now. The question remains but maybe it's not targeted towards you but rather @anand?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a work-around that I found to the installation issues that I had at the beginning (I added these lines in the README in the first place). However, it is possible that it is an issue related to the specific architecture of my laptop, which is arm64. I can specify in the document that this could be a solution for whoever faces the same issue on the new Macs, but that it is not something that everyone should apply to begin with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we had some issues when we first introduced these packages actually. They are needed for the pdf generation which is a fairly niche use case that most will not need to test in a developer setting. So I think usually it's fine to run it without these packages which most do I believe. Perhaps splitting them out to it's own installation instruction could be possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you could add a note that you only need to care about these packages not being installed properly on your system if you plan to test the Agreement and Invoicing parts of Genstat?