Skip to content

Commit

Permalink
feature/issue-33-add-pre-commit (#34)
Browse files Browse the repository at this point in the history
* feature/issue-33-add-pre-commit

* added CONTRIBUTING.md

* py3.8 types

* remove dev dependencies that are used in pre-commit
  • Loading branch information
IamTugy authored Aug 10, 2024
1 parent df0d5d1 commit 6aa6be6
Show file tree
Hide file tree
Showing 10 changed files with 160 additions and 301 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,15 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- uses: pre-commit/[email protected]
with:
config: '.pre-commit-config.yaml'
verbose: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint poetry
poetry install --with dev
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: integration tests
run: poetry run pytest tests
env:
Expand Down
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
hooks:
- id: mypy
args: [--strict, --ignore-missing-imports]

- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
name: black
description: "Black: The uncompromising Python code formatter"
entry: black
language: python
minimum_pre_commit_version: 2.9.2
require_serial: true
types_or: [python, pyi]

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)

- repo: https://github.com/PyCQA/flake8
rev: 7.1.0
hooks:
- id: flake8
36 changes: 36 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## Contribute
All contributions are welcome:

- Read the [issues](https://github.com/IamTugy/pyminio/issues), Fork the [project](https://github.com/IamTugy/pyminio) and create a new Pull Request.
- Request a new feature creating a `New issue` with the `enhancement` tag.
- Find any kind of errors in the code and create a `New issue` with the details, or fork the project and do a Pull Request.
- Suggest a better or more pythonic way for existing examples.

### Work environment

After forking the project, make sure you have poetry installed,
than install the dependencies using
```bash
poetry install
```

Also install pre-commit and activate it:
```bash
pip install pre-commit
pre-commit install
```

download the [minio docker](https://hub.docker.com/r/minio/minio/) and start an instance in your computer for development and testing.

Export The same environment variables you've used to set up your local minio:
```bash
export MINIO_TEST_CONNECTION="<your API host>" # example: 127.0.0.1:9000
export MINIO_TEST_ACCESS_KEY="<your user>" # example: ROOTNAME
export MINIO_TEST_SECRET_KEY="<your password>" # example: CHANGEME123
```

to run the tests run:
```bash
poetry run pytest tests
```
#### Don't forget to write tests, and to run all the tests before making a pull request.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,18 @@ All contributions are welcome:

### Work environment

After forking the project and installing the dependencies, (like specified in the [installations](#installation) in part 2)
After forking the project, make sure you have poetry installed,
than install the dependencies using
```bash
poetry install
```

Also install pre-commit and activate it:
```bash
pip install pre-commit
pre-commit install
```

download the [minio docker](https://hub.docker.com/r/minio/minio/) and start an instance in your computer for development and testing.

Export The same environment variables you've used to set up your local minio:
Expand Down
212 changes: 2 additions & 210 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6aa6be6

Please sign in to comment.