Skip to content

Commit

Permalink
chore: introduce pre-commit
Browse files Browse the repository at this point in the history
* (chore): create configuration for pre-commit
* (docs): create CONTRIBUTING.md, update README.md
* (chore): update dev dependencies
  • Loading branch information
nautics889 committed Dec 23, 2023
1 parent da4dbca commit 345a78d
Show file tree
Hide file tree
Showing 5 changed files with 471 additions and 82 deletions.
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
args: [--line-length=79, --check]
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
args: [--max-line-length=79, --max-doc-length=72]
61 changes: 61 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
## Contributing

Pull requests are always welcome. For major changes, please open an issue first
to discuss what you would like to implement/change.

### Set up the development environment

1. _(Preferred)_ Install [poetry](https://python-poetry.org/docs/#installation).
2. Install development dependencies:
```bash
$ poetry install --with dev
```

### Running tests
```bash
$ poetry run pytest
```

### Running pre-commit

To install pre-commit hooks:

```bash
$ pre-commit install
```

Then you can run it manually:

```bash
$ pre-commit
```

### Linting and formatting

Formatting your code with black:
```bash
$ black . --line-length 79
```
Linting with flake8:
```bash
$ poetry run flake8 . --max-doc-length 72 --show-source
```

## Roadmap

Here's a table which illustrates current progress of endpoints implementation:

| Endpoint | Implementation | Tests | Documentation |
|:---------------------------------------------------------------------------------------------------|:---------------|:------------|:--------------|
| [Account](https://api.imgur.com/endpoints/account) | In progress | In progress | In progress |
| [Album](https://api.imgur.com/endpoints/album) | Done ✓ | Not impl. | Not impl. |
| [Comment](https://api.imgur.com/endpoints/comment) | Done ✓ | Done ✓ | In progress |
| Feed | Not impl. | Not impl. | Not impl. |
| [Gallery](https://api.imgur.com/endpoints/gallery) | Not impl. | Not impl. | Not impl. |
| [Image](https://api.imgur.com/endpoints/image) | Done ✓ | Done ✓ | Done ✓ |
| [Memegen](https://api.imgur.com/endpoints/memegen) | Not impl. | Not impl. | Not impl. |
| [Notification](https://api.imgur.com/endpoints/notification) | Not impl. | Not impl. | Not impl. |

Additionally, there are some preferable features that would be great to implement in the package:
* Method for bulk uploading images (e.g. from directory).
* Pagination with `__next__()` in some methods of `Account` endpoint.
47 changes: 2 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
A Python SDK for the Imgur API.

## Overview

The package is supposed to be in strict accordance with the [Imgur's documentation](https://apidocs.imgur.com/), i.e. description for any endpoint implemented in the SDK can also be found there.

The package does not have any third-party dependencies; it requires only Python 3.7+.
Expand Down Expand Up @@ -93,51 +94,7 @@ print(new_image.data.link)

## Contributing

Pull requests are always welcome. For major changes, please open an issue first
to discuss what you would like to implement/change.

### Set up the development environment

1. _(Preferred)_ Install [poetry](https://python-poetry.org/docs/#installation).
2. Install development dependencies:
```bash
$ poetry install --with dev
```

### Running tests
```bash
$ poetry run pytest
```

### Linting and formatting

Formatting your code with black:
```bash
$ black . --line-length 79
```
Linting with flake8:
```bash
$ poetry run flake8 . --max-doc-length 72 --show-source
```

## Roadmap

Here's a table which illustrates current progress of endpoints implementation:

| Endpoint | Implementation | Tests | Documentation |
|:---------------------------------------------------------------------------------------------------|:---------------|:------------|:--------------|
| [Account](https://api.imgur.com/endpoints/account) | In progress | In progress | In progress |
| [Album](https://api.imgur.com/endpoints/album) | Done ✓ | Not impl. | Not impl. |
| [Comment](https://api.imgur.com/endpoints/comment) | Done ✓ | Done ✓ | In progress |
| Feed | Not impl. | Not impl. | Not impl. |
| [Gallery](https://api.imgur.com/endpoints/gallery) | Not impl. | Not impl. | Not impl. |
| [Image](https://api.imgur.com/endpoints/image) | Done ✓ | Done ✓ | Done ✓ |
| [Memegen](https://api.imgur.com/endpoints/memegen) | Not impl. | Not impl. | Not impl. |
| [Notification](https://api.imgur.com/endpoints/notification) | Not impl. | Not impl. | Not impl. |

Additionally, there are some preferable features that would be great to implement in the package:
* Method for bulk uploading images (e.g. from directory).
* Pagination with `__next__()` in some methods of `Account` endpoint.
See the [contributing guidelines](CONTRIBUTING.md).

## License

Expand Down
Loading

0 comments on commit 345a78d

Please sign in to comment.