Skip to content

Autoupdate precommit version and better docs #92

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

Merged
merged 2 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/precommit_update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Pre-commit auto-update

on:
# Run once a week, Tuesday at 4 AM
schedule:
- cron: "0 4 * * 2"

# On demand
workflow_dispatch:

jobs:
auto-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5

- uses: browniebroke/pre-commit-autoupdate-action@main

- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update/pre-commit-hooks
title: Update pre-commit hooks
commit-message: "πŸ‘· Update pre-commit hooks to latest version"
body: Update versions of pre-commit hooks to latest version.
43 changes: 27 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ To use this template, click the button "Use this template" :

It will prompt you to create a new Github repository.

Then replace the content in your freshly created repository, with your own package name, own code, and update the links to point to your own repository.
More details in the [documentation](https://astariul.github.io/pytere/latest/usage/).
Then replace the content in your freshly created repository, with your own package name, own code, and update the links to point to your own repository.

> [!IMPORTANT]
> Check the [documentation](https://astariul.github.io/pytere/latest/usage/) for a comprehensive, step-by-step guide on how to use the template.


<h2 align="center">FAQ</h2>
Expand All @@ -117,28 +119,31 @@ To contribute, install the package locally, create your own branch, add your cod

Pre-commit hooks are set to check the code added whenever you commit something.

If you never ran the hooks before, install it with :

```bash
pre-commit install
```

---
> [!NOTE]
> If you never ran the hooks before, install it with :
> ```bash
> pip install -e .[hook]
> pre-commit install
> ```

Then you can just try to commit your code. If your code does not meet the quality required by linters, it will not be committed. You can just fix your code and try to commit again !

---

You can manually run the pre-commit hooks with :

```bash
pre-commit run --all-files
```
> [!TIP]
> You can manually run the pre-commit hooks with :
> ```bash
> pre-commit run --all-files
> ```

### Tests

When you contribute, you need to make sure all the unit-tests pass. You should also add tests if necessary !

> [!NOTE]
> Install the testing dependencies with :
> ```bash
> pip install -e .[test]
> ```

You can run the tests with :

```bash
Expand All @@ -158,3 +163,9 @@ The documentation should be kept up-to-date. You can visualize the documentation
```bash
mkdocs serve
```

> [!NOTE]
> Before running this, you need to install the documentation dependencies :
> ```bash
> pip install -e .[docs]
> ```
24 changes: 19 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,16 @@ To contribute, install the package locally (see [Installation](#local)), create

Pre-commit hooks are set to check the code added whenever you commit something.

When you try to commit your code, hooks are automatically run, and if you code does not meet the quality required by linters, it will not be committed. You then have to fix your code and try to commit again !

!!! important
!!! info
If you never ran the hooks before, install it with :
```bash
pip install -e .[hook]
pre-commit install
```

!!! info
When you try to commit your code, hooks are automatically run, and if your code does not meet the quality required by linters, it will not be committed. You then have to fix your code and try to commit again !

!!! tip
You can manually run the pre-commit hooks with :
```bash
pre-commit run --all-files
Expand All @@ -103,16 +104,23 @@ When you try to commit your code, hooks are automatically run, and if you code d

When you contribute, you need to make sure all the unit-tests pass. You should also add tests if necessary !

!!! info
Install the testing dependencies with :
```bash
pip install -e .[test]
```

You can run the tests with :

```bash
pytest
```

---

!!! info
Tests are not included in the pre-commit hooks, because running the tests might be slow, and for the sake of developpers we want the pre-commit hooks to be fast !

!!! info
Pre-commit hooks will not run the tests, but it will automatically update the coverage badge !

### Documentation
Expand All @@ -124,3 +132,9 @@ You can visualize the documentation locally by running :
```bash
mkdocs serve
```

!!! info
Before running this, you need to install the documentation dependencies :
```bash
pip install -e .[docs]
```