From d1153a4469d9b8ab2e0a1ba20e0d12a3f904872a Mon Sep 17 00:00:00 2001 From: pkeilbach Date: Sat, 5 Oct 2024 14:01:44 +0200 Subject: [PATCH 1/6] align version number --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3221df6..634eeb6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "htwg-practical-nlp" -version = "0.0.1" +version = "0.1.0" description = "A practical course on natural language processing @ HTWG Konstanz." readme = "README.md" authors = [{ name = "Pascal Keilbach", email = "pascal.keilbach@htwg-konstanz.de" }] From 0df676596ac9017e5cce8ac5a51655df265c168e Mon Sep 17 00:00:00 2001 From: pkeilbach Date: Sat, 5 Oct 2024 14:02:16 +0200 Subject: [PATCH 2/6] pin requirements --- pyproject.toml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 634eeb6..3ea34f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,12 +5,11 @@ description = "A practical course on natural language processing @ HTWG Konstanz readme = "README.md" authors = [{ name = "Pascal Keilbach", email = "pascal.keilbach@htwg-konstanz.de" }] dependencies = [ - "jupyter", - "mkdocs-material", - "matplotlib", - "nltk", - "pandas", - "pre-commit", - "pytest", + "jupyter~=1.1.1", + "mkdocs-material~=9.5.39", + "matplotlib~=3.9.2", + "nltk~=3.9.1", + "pandas~=2.2.3", + "pytest~=8.3.3", ] requires-python = ">=3.8" From d03010f312ff0f0d4dcc272a289a3ec3fc44cc2a Mon Sep 17 00:00:00 2001 From: pkeilbach Date: Sat, 5 Oct 2024 14:04:03 +0200 Subject: [PATCH 3/6] separate development requirements for contribution (#126) --- pyproject.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 3ea34f2..eaf9efb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,3 +13,8 @@ dependencies = [ "pytest~=8.3.3", ] requires-python = ">=3.8" + +[project.optional-dependencies] +dev = [ + "pre-commit", +] From 14fbcd1436bc42525e18c3925d5e45f2d2da496b Mon Sep 17 00:00:00 2001 From: pkeilbach Date: Sat, 5 Oct 2024 14:04:33 +0200 Subject: [PATCH 4/6] Add commands for development setup (#126) --- Makefile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 074e400..608879f 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,16 @@ -project: pre_commit nltk +project: requirements -pre_commit: requirements +requirements: pip + .venv/bin/python3 -m pip install -e . + .venv/bin/python3 -m nltk.downloader -d .venv/nltk_data popular + +dev-setup: requirements-dev .venv/bin/pre-commit install -nltk: requirements +requirements-dev: pip + .venv/bin/python3 -m pip install -e .[dev] .venv/bin/python3 -m nltk.downloader -d .venv/nltk_data popular -requirements: pip - .venv/bin/python3 -m pip install -e . - pip: venv .venv/bin/pip install --upgrade pip From 6c81761d0dc6ccaf99f2e3fcd8dcf545c96d8af0 Mon Sep 17 00:00:00 2001 From: pkeilbach Date: Sat, 5 Oct 2024 14:05:03 +0200 Subject: [PATCH 5/6] add development setup description (#126) --- CONTRIBUTING.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ef353b8..68f3a50 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,3 +42,40 @@ You can also sync your fork in the web UI or GitHub CLI. Find more details in the official [GitHub docs](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork). > 💡 Syncing your fork only updates your local copy of the repository. To update your fork on GitHub.com, you must [push your changes](https://docs.github.com/en/get-started/using-git/pushing-commits-to-a-remote-repository). + +## Development Setup + +Once you forked the course repository, you can start with the development setup. + +The development setup is intented for contributors, and will install some additional dependencies. + +You can setup the development environment as follows: + +``` +make dev-setup +``` + +## Working with Pre-commit Hooks + +One such additional dependency is the [`pre-commit` framework](https://pre-commit.com/). + +On every commit, it runs some basic code quality checks to ensure that the contributed code satisfies certain standards, e.g. the [Black code formatter](https://black.readthedocs.io/en/stable/) for Python. + +> 💡 You can check all currently implemented `pre-commit` hooks in the `pre-commit-config.yaml`. + +The hooks are executed on the staged files, and it may happen that the hooks change the staged files (e.g. formatting), so you need to change them again: + +```sh +# stage your files +git add . + +# commiting your files will trigger the pre-commit hooks +git commit -m "some cool updates" + +# assuming that your files violated some formatting rules, +# the formatter hook will try to fix them, so you need to stage them again +git add . + +# now the commit shall pass +git commit -m "some cool updates" +``` From 9b158d9b9ba63fc280d30e9f70910b82456ff1cb Mon Sep 17 00:00:00 2001 From: pkeilbach Date: Sat, 5 Oct 2024 14:14:43 +0200 Subject: [PATCH 6/6] update pre-commit section --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 68f3a50..c05b71a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,9 +61,9 @@ One such additional dependency is the [`pre-commit` framework](https://pre-commi On every commit, it runs some basic code quality checks to ensure that the contributed code satisfies certain standards, e.g. the [Black code formatter](https://black.readthedocs.io/en/stable/) for Python. -> 💡 You can check all currently implemented `pre-commit` hooks in the `pre-commit-config.yaml`. +> 💡 You can check all currently implemented `pre-commit` hooks in the [`pre-commit-config.yaml`](https://github.com/pkeilbach/htwg-practical-nlp/blob/main/.pre-commit-config.yaml). -The hooks are executed on the staged files, and it may happen that the hooks change the staged files (e.g. formatting), so you need to change them again: +The hooks are executed on the staged files, and it may happen that the hooks make changes the staged files (e.g. formatting), so you need to stage them again before finally comitting them: ```sh # stage your files