Skip to content

Commit

Permalink
Add optional dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
laggykiller committed Mar 21, 2024
1 parent 1b9b5f7 commit 44a010f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ jobs:

- name: Test sdist
run: |
python -m pip install dist/apngasm_python-*.tar.gz
pip install pytest Pillow numpy &&
python -m pip install dist/apngasm_python-*.tar.gz[full,test]
pytest
- uses: actions/upload-artifact@v3
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/check_and_fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,14 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependency
run: |
pip install build ruff mypy isort Pillow numpy pytest types-Pillow
pip install git+https://github.com/wjakob/nanobind.git
- name: Install test
run: pip install .[full,test,lint]
- name: Ruff check
run: ruff check
- name: Install test
run: pip install .
- name: mypy
run: mypy
- name: ruff format
run: ruff format
- name: mypy
run: mypy
- name: isort
run: isort .
- name: nanobind stubgen
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ Documentations: https://apngasm-python.readthedocs.io/en/latest/
pip install apngasm-python
```

Optionally, you can also install `Pillow` and `numpy`
`Pillow` and `numpy` are optional dependencies. Without them,
some functions are not usable. To also install them:
```
pip install Pillow numpy
pip install apngasm-python[full]
```

## Example usage
Expand Down
20 changes: 18 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,28 @@ Repository = "https://github.com/laggykiller/apngasm-python"
Documentation = "https://apngasm-python.readthedocs.io/en/latest/"
Tracker = "https://github.com/laggykiller/apngasm-python/issues"

[project.optional-dependencies]
full = [
"Pillow",
"numpy",
]

test = [
"pytest",
]

lint = [
"ruff",
"mypy",
"isort",
"types-Pillow",
]

[build-system] # How pip and other frontends should build this project
requires = [
"py-build-cmake==0.2.0a12",
"nanobind @ git+https://github.com/wjakob/nanobind.git",
"conan>=2.0",
"wheel"
"conan>=2.0"
]
build-backend = "py_build_cmake.build"

Expand Down

0 comments on commit 44a010f

Please sign in to comment.