Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

Commit 1a247c5

Browse files
authored
Merge pull request #52 from MDverse/setup-precommit
Setup precommit
2 parents 6bb73eb + 79c23c3 commit 1a247c5

24 files changed

+540
-271
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
10+
pre-commit:
11+
runs-on: ubuntu-24.04
12+
timeout-minutes: 15
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v6
16+
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v7
19+
with:
20+
enable-cache: true
21+
22+
- name: Install Python
23+
run: uv python install
24+
25+
- name: Install python dependencies
26+
run: uv sync --locked --dev
27+
28+
- name: Run pre-commit hooks
29+
run: uv run prek

.pre-commit-config.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Install pre-commit hooks with:
2+
# prek install
3+
exclude: "scripts/*|tmp/*|.*.mdp|"
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v6.0.0
7+
hooks:
8+
- id: end-of-file-fixer
9+
- id: mixed-line-ending
10+
- id: trailing-whitespace
11+
- id: check-json
12+
- id: check-yaml
13+
- id: check-added-large-files
14+
args: ['--maxkb=5000']
15+
16+
- repo: https://github.com/asottile/pyupgrade
17+
rev: v3.21.2
18+
hooks:
19+
- id: pyupgrade
20+
21+
- repo: https://github.com/astral-sh/ruff-pre-commit
22+
# Ruff version.
23+
rev: v0.14.13
24+
hooks:
25+
# Run the linter.
26+
- id: ruff-check
27+
types_or: [ python, pyi ]
28+
args: [ --fix ]
29+
# Run the formatter.
30+
- id: ruff-format
31+
types_or: [ python, pyi ]

CONTRIBUTING.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Contributing guidelines
2+
3+
## Setup your environment
4+
5+
1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/).
6+
7+
2. [Fork](https://github.com/mdverse/mdws/fork) this repository.
8+
9+
3. Clone your fork of thr project on your machine:
10+
11+
```sh
12+
git clone https://github.com/<your-github-username>/mdws.git
13+
```
14+
15+
4. Get into the new directory:
16+
17+
```sh
18+
cd mdws
19+
```
20+
21+
5. Install dependencies:
22+
23+
```sh
24+
uv sync --dev
25+
```
26+
27+
6. Install pre-commit hook:
28+
29+
```sh
30+
uv run prek install
31+
```
32+
33+
7. Create a new branch:
34+
35+
```sh
36+
git sw -c <your-branch-name>
37+
```
38+
39+
8. Make changes and commit:
40+
41+
```sh
42+
git add
43+
git commit -m "<your-commit-message>"
44+
git push origin "<your-branch-name>"
45+
```
46+
47+
9. Create a [pull request](https://github.com/mdverse/mdws/compare).
48+
49+
Click compare across forks if you don't see your branch.
50+
51+
## Conventional commits
52+
53+
For commit messages, please use Conventional Commits.
54+
55+
See:
56+
- [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/): reference guide
57+
- Cheatsheet of [Sample Conventional Commit Verbs](https://gkarthiks.github.io/quick-commands-cheat-sheet/conventional-commit-verbs)
58+
- [Conventional Commit](https://blog.stephane-robert.info/docs/developper/conventional-commits/) (FR)
59+
60+
Examples of valid commit messages:
61+
62+
- `feat: Valide metadata with model`
63+
- `fix(http): Resolve multiple errors on HTTP queries`
64+
- `fix: Verify directory exists before writing in (#45)`
65+
- `docs: Update installation instructions`
66+
- `style: Format code according with ruff`
67+
- `refactor: Move CLI argument management into separate module`
68+
- `test: Add unit tests for the new scraper`
69+
- `chore: Update dependencies to latest versions`
70+

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Parquet files and codebook are available on Zenodo: [10.5281/zenodo.7856523](https://doi.org/10.5281/zenodo.7856523)
44

5+
see [CONTRIBUTING](CONTRIBUTING.md) if you want to contribute to this repo.
6+
57
## Setup your environment
68

79
Install [uv](https://docs.astral.sh/uv/getting-started/installation/).
@@ -12,12 +14,6 @@ Clone this repository:
1214
git clone https://github.com/MDverse/mdws.git
1315
```
1416

15-
> [!TIP]
16-
> For maintainers only:
17-
> ```bash
18-
> git clone git@github.com:MDverse/mdws.git
19-
> ```
20-
2117
Move to the new directory:
2218

2319
```bash
@@ -34,7 +30,7 @@ uv sync
3430

3531
Have a look to the notes regarding [Zenodo](docs/zenodo.md) and how its API works.
3632

37-
Create a token here: <https://zenodo.org/account/settings/applications/tokens/new/>
33+
Create a token here: <https://zenodo.org/account/settings/applications/tokens/new/>
3834
and store it in the file `.env`:
3935

4036
```none
@@ -79,7 +75,7 @@ uv run scrape-figshare --query-file params/query_dev.yml --output-dir tmp
7975

8076
The scraping takes some time (about 5 hours). Be patient.
8177

82-
Eventually, the scraper will produce two files: `figshare_datasets.parquet` and `figshare_files.parquet` :sparkles:
78+
Eventually, the scraper will produce two files: `figshare_datasets.parquet` and `figshare_files.parquet` :sparkles:
8379

8480
## Scrape OSF
8581

@@ -265,7 +261,7 @@ bash run_all.sh
265261
Update metadata:
266262

267263
```bash
268-
uv run scripts/upload_datasets_to_zenodo.py --record 7856524 --metadata params/zenodo_metadata.json
264+
uv run scripts/upload_datasets_to_zenodo.py --record 7856524 --metadata params/zenodo_metadata.json
269265
```
270266

271267
Update files:

0 commit comments

Comments
 (0)