Add minimal pyproject.toml (#2804)

* Add minimal pyproject.toml

* Update README for Python compile and install

* Remove duplicate meta

* Fix pixel saturation in interpolate_quadratic (#2806)

* Fix pixel saturation in interpolate_quadratic

* Use pixel_type_t alias

* cleanup

---------

Co-authored-by: Adrià Arrufat <1671644+arrufat@users.noreply.github.com>
Co-authored-by: Davis King <davis@dlib.net>
This commit is contained in:
Rover van der Noort 2023-06-03 22:12:44 +02:00 committed by GitHub
parent 759170d3d6
commit bebba4ca98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 17 deletions

1
.gitignore vendored
View File

@ -17,3 +17,4 @@ docs/docs/python/classes.txt
docs/docs/python/functions.txt docs/docs/python/functions.txt
docs/docs/python/constants.txt docs/docs/python/constants.txt
**/.vscode **/.vscode
**/venv

View File

@ -37,12 +37,22 @@ vcpkg install dlib
## Compiling dlib Python API ## Compiling dlib Python API
Before you can run the Python example programs you must compile dlib. Type: Before you can run the Python example programs you must install the build requirement.
```bash ```bash
python setup.py install python -m venv venv
pip install build
``` ```
Then you must compile dlib and install it in your environment. Type:
```bash
python -m build --wheel
pip install dist/dlib-<version>.whl
```
Or download dlib using PyPi:
```bash
pip install dlib
```
## Running the unit test suite ## Running the unit test suite

3
pyproject.toml Normal file
View File

@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel", "cmake"]
build-backend = "setuptools.build_meta"

View File

@ -6,14 +6,10 @@ This file basically just uses CMake to compile the dlib python bindings project
located in the tools/python folder and then puts the outputs into standard located in the tools/python folder and then puts the outputs into standard
python packages. python packages.
To build the dlib: To build dlib:
python setup.py build python setup.py build
To build and install: To build and install:
python setup.py install python setup.py install
To package the wheel (after pip installing twine and wheel):
python setup.py bdist_wheel
To upload the binary wheel to PyPi
twine upload dist/*.whl
To upload the source distribution to PyPi To upload the source distribution to PyPi
python setup.py sdist python setup.py sdist
twine upload dist/dlib-*.tar.gz twine upload dist/dlib-*.tar.gz
@ -39,7 +35,7 @@ import multiprocessing
from distutils import log from distutils import log
from math import ceil,floor from math import ceil,floor
from setuptools import setup, Extension from setuptools import find_packages, setup, Extension
from setuptools.command.build_ext import build_ext from setuptools.command.build_ext import build_ext
from distutils.version import LooseVersion from distutils.version import LooseVersion
@ -234,7 +230,7 @@ setup(
# We need an older more-itertools version because v6 broke pytest (for everyone, not just dlib) # We need an older more-itertools version because v6 broke pytest (for everyone, not just dlib)
tests_require=['pytest==3.8', 'more-itertools<6.0.0'], tests_require=['pytest==3.8', 'more-itertools<6.0.0'],
#install_requires=['cmake'], # removed because the pip cmake package is busted, maybe someday it will be usable. #install_requires=['cmake'], # removed because the pip cmake package is busted, maybe someday it will be usable.
packages=['dlib'], packages=find_packages(exclude=['python_examples']),
package_dir={'': 'tools/python'}, package_dir={'': 'tools/python'},
keywords=['dlib', 'Computer Vision', 'Machine Learning'], keywords=['dlib', 'Computer Vision', 'Machine Learning'],
classifiers=[ classifiers=[
@ -248,13 +244,6 @@ setup(
'Operating System :: Microsoft :: Windows', 'Operating System :: Microsoft :: Windows',
'Programming Language :: C++', 'Programming Language :: C++',
'Programming Language :: Python', 'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Artificial Intelligence', 'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Scientific/Engineering :: Image Recognition', 'Topic :: Scientific/Engineering :: Image Recognition',