Skip to content

Commit bebba4c

Browse files
rvandernoortarrufatdavisking
authored
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>
1 parent 759170d commit bebba4c

4 files changed

Lines changed: 19 additions & 16 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ docs/docs/python/classes.txt
1717
docs/docs/python/functions.txt
1818
docs/docs/python/constants.txt
1919
**/.vscode
20+
**/venv

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,22 @@ vcpkg install dlib
3737

3838
## Compiling dlib Python API
3939

40-
Before you can run the Python example programs you must compile dlib. Type:
40+
Before you can run the Python example programs you must install the build requirement.
41+
```bash
42+
python -m venv venv
43+
pip install build
44+
```
4145

46+
Then you must compile dlib and install it in your environment. Type:
4247
```bash
43-
python setup.py install
48+
python -m build --wheel
49+
pip install dist/dlib-<version>.whl
4450
```
4551

52+
Or download dlib using PyPi:
53+
```bash
54+
pip install dlib
55+
```
4656

4757
## Running the unit test suite
4858

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel", "cmake"]
3+
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@
66
located in the tools/python folder and then puts the outputs into standard
77
python packages.
88
9-
To build the dlib:
9+
To build dlib:
1010
python setup.py build
1111
To build and install:
1212
python setup.py install
13-
To package the wheel (after pip installing twine and wheel):
14-
python setup.py bdist_wheel
15-
To upload the binary wheel to PyPi
16-
twine upload dist/*.whl
1713
To upload the source distribution to PyPi
1814
python setup.py sdist
1915
twine upload dist/dlib-*.tar.gz
@@ -39,7 +35,7 @@
3935
from distutils import log
4036
from math import ceil,floor
4137

42-
from setuptools import setup, Extension
38+
from setuptools import find_packages, setup, Extension
4339
from setuptools.command.build_ext import build_ext
4440
from distutils.version import LooseVersion
4541

@@ -234,7 +230,7 @@ def read_entire_file(fname):
234230
# We need an older more-itertools version because v6 broke pytest (for everyone, not just dlib)
235231
tests_require=['pytest==3.8', 'more-itertools<6.0.0'],
236232
#install_requires=['cmake'], # removed because the pip cmake package is busted, maybe someday it will be usable.
237-
packages=['dlib'],
233+
packages=find_packages(exclude=['python_examples']),
238234
package_dir={'': 'tools/python'},
239235
keywords=['dlib', 'Computer Vision', 'Machine Learning'],
240236
classifiers=[
@@ -248,13 +244,6 @@ def read_entire_file(fname):
248244
'Operating System :: Microsoft :: Windows',
249245
'Programming Language :: C++',
250246
'Programming Language :: Python',
251-
'Programming Language :: Python :: 2',
252-
'Programming Language :: Python :: 2.6',
253-
'Programming Language :: Python :: 2.7',
254-
'Programming Language :: Python :: 3',
255-
'Programming Language :: Python :: 3.4',
256-
'Programming Language :: Python :: 3.5',
257-
'Programming Language :: Python :: 3.6',
258247
'Topic :: Scientific/Engineering',
259248
'Topic :: Scientific/Engineering :: Artificial Intelligence',
260249
'Topic :: Scientific/Engineering :: Image Recognition',

0 commit comments

Comments
 (0)