Skip to content

Commit

Permalink
Move to new PEP 517 standard with poetry and more "meta" package upda…
Browse files Browse the repository at this point in the history
…tes (#270)

* Move to new PEP 517 standard with poetry

Switching to Poetry (the new defacto standard), compliant with PEP 517, for improved dependency handling, deterministic build process, and easier maintainability.

* Fix files according to pre commit hooks

* Remove VERSION file, the version can be read via importlib

* Auto reformat README

* Update publishing instructions

* Add prettier pre commit hook for better README file

* Update github actions

* Improve upon pre commit hooks
  • Loading branch information
Nachtalb authored Sep 17, 2023
1 parent 468e221 commit 734a598
Show file tree
Hide file tree
Showing 23 changed files with 1,333 additions and 370 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,23 @@ jobs:
fail-fast: false
matrix:
# python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.10"]
python-version: ["3.7", "3.11"]

steps:
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
cache: pip
cache-dependency-path: setup.cfg
python-version: "${{ matrix.python-version }}"
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Lint with pre-commit
uses: pre-commit/[email protected]
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
run: poetry install --no-dev
- name: Run demo.py
run: python demo.py
run: poetry run python demo.py
- name: Install dependencies tests
run: |
pip install .[tests]
run: poetry install
- name: Run tests
run: pytest
run: poetry run pytest
42 changes: 23 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-ast
Expand All @@ -13,50 +13,54 @@ repos:
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: check-json
- id: check-toml
- id: check-vcs-permalinks
- id: debug-statements
# - id: destroyed-symlinks
# - id: double-quote-string-fixer
- id: end-of-file-fixer
exclude: tests/test_changes/
files: \.(py|sh|rst|yml|yaml)$
# - id: name-tests-test
- id: mixed-line-ending
- id: trailing-whitespace
files: \.(py|sh|rst|yml|yaml)$
# - id: requirements-txt-fixer
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.20.1
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/asottile/pyupgrade
rev: v2.32.0
rev: v3.3.2
hooks:
- id: pyupgrade
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.11.5
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.263"
hooks:
- id: flake8
- id: ruff
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.3.1
rev: 1.5.3
hooks:
- id: nbqa-black
- id: nbqa-pyupgrade
args: [--py37-plus]
args: [--py38-plus]
- id: nbqa-isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.950
rev: v1.2.0
hooks:
- id: mypy
files: ^pixivpy3/
additional_dependencies:
- types-requests
# - ..._
args: [--strict]
args: [--show-error-codes, --pretty, --strict]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.7.1"
hooks:
- id: prettier
types_or: [markdown, toml]
args: [--prose-wrap=always]
additional_dependencies:
- "[email protected]"
- "[email protected]"
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
printWidth: 120
proseWrap: always
overrides:
- files: "*.md"
options:
printWidth: 80
Loading

0 comments on commit 734a598

Please sign in to comment.