Skip to content

Commit

Permalink
Move python source into src; Improve readme; Add requirements into py…
Browse files Browse the repository at this point in the history
…project.toml
  • Loading branch information
laggykiller committed Mar 21, 2024
1 parent 6178f82 commit d33beb2
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 34 deletions.
64 changes: 34 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,14 @@ Documentations: https://rlottie-python.readthedocs.io/en/latest/
Note that rlottie is included in the wheel package, you need not install librlottie.

To install, run the following:
```
pip3 install wheel
```bash
pip3 install rlottie-python
```

Optionally, install `Pillow`:
```
pip3 install Pillow
```

## Building from source

To build wheel, run the following:
```
git clone --recursive https://github.com/laggykiller/rlottie-python.git
cd rlottie-python
pip3 install -r requirements.txt
python3 -m build .
```

To install the built wheel, run `pip3 install dist/<name_of_the_wheel_file>.whl`

If you want to install directly, run the following:
`Pillow` is optional dependency. It is required for `render_pillow_frame()`,
`save_frame()` and `save_animation()`. To also install Pillow, run:
```bash
git clone --recursive https://github.com/laggykiller/rlottie-python.git
cd rlottie-python
pip3 install -r requirements.txt
pip3 install .
```

To run tests:
```bash
pip install pytest
pytest
pip3 install rlottie-python[full]
```

## Examples
Expand Down Expand Up @@ -136,6 +110,36 @@ The `lottie` (https://pypi.org/project/lottie/) python package is also capable o

The `pyrlottie` (https://pypi.org/project/pyrlottie/) python package is also able to convert lottie and tgs files to webp/gif. However, it works by calling executables `gif2webp` and `lottie2gif` with subprocess, and it does not support macOS.

## Building from source

To build wheel, run the following:
```bash
git clone --recursive https://github.com/laggykiller/rlottie-python.git
cd rlottie-python

# To build wheel
python3 -m build .

# To install directly
pip3 install .
```

## Development
To run tests:
```bash
pip install pytest
pytest
```

To lint:
```bash
pip install ruff mypy isort
mypy
isort .
ruff check
ruff format
```

## Credits
- rlottie library: https://github.com/Samsung/rlottie
- Packaging: https://github.com/tttapa/py-build-cmake
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import os
import sys

sys.path.insert(0, os.path.abspath("../"))
sys.path.insert(0, os.path.abspath("../src"))
import rlottie_python # type: ignore # noqa: F401

project = "rlottie-python"
Expand Down
22 changes: 19 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,29 @@ Repository = "https://github.com/laggykiller/rlottie-python"
Documentation = "https://rlottie-python.readthedocs.io/en/latest/"
Tracker = "https://github.com/laggykiller/rlottie-python/issues"

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

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"]
build-backend = "py_build_cmake.build"

[tool.py-build-cmake.module] # Where to find the Python module to package
name = "rlottie_python"
directory = "."
directory = "src"

[tool.py-build-cmake.sdist] # What to include in source distributions
include = ["CMakeLists.txt", "rlottie/*"]
Expand All @@ -45,9 +61,9 @@ config = "Release"
config = "Release"

[tool.pyright]
include = ["rlottie_python", "tests", "example"]
include = ["src", "tests", "example"]
strict = ["*"]

[tool.mypy]
python_version = "3.9"
files = ["rlottie_python", "tests", "example"]
files = ["src", "tests", "example"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit d33beb2

Please sign in to comment.