Skip to content

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
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

fagostini
Copy link
Contributor

I've added a couple of improvements to the repository and environment creation. The former is the addition of a pre-commit configuration file containing the ruff linting and formatting routines, and some other hooks that I found useful in my previous projects (there were more, but I've made a selection). The latter concerns the creation of the conda environment during which I've encountered some issues, since my laptop has a different architecture, compared to others and the deployment machine(s). Therefore, I've created a copy (environment.yml) and refactored the previous conda_requirements.yml (now this is an "extra" file that could be removed) by stating explicitly the dependencies that were otherwise passed to pip via -r requirements.txt, and by specifying the platforms on which the packages must be available/compiled. Finally, I've used the file to run conda-lock to create the conda-lock.yml file, which contains all the information on the specific versions of the packages that should be used. This file can then be employed by conda-lock to create a conda environment that ensures consistency/reproducibility across multiple systems.

Note1: There is a small caveat with the ruff pre-commit hook. The version of the tool is specified within the configuration file, and this can be updated either manually or via the pre-commit autoupdate command, but not automatically; however, the version that is used on GitHub Actions is always the latest available. So, unless we fixed the version of the Actions, when the version changes, there might be a difference between what is checked locally and what is checked with the remote action.

Note2: The additional checks that I've added to the configuration are mostly formatting checks, however, there might be some files that require some formatting not to be changes (e.g. tabs in Makefiles). Since I'm not aware of all these specific needs, as I don't have extensive knowledge of the repo, please let me know whether you think they might create issues.

fagostini and others added 2 commits May 8, 2025 14:41
Refactor `environment.yml`

Add `conda-lock.yml`

Updated README with `conda-lock` installation instructions
README.md Outdated
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
Copy link
Member

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Member

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?

README.md Outdated
Comment on lines 87 to 96
#### 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
```

Copy link
Member

Choose a reason for hiding this comment

The 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants