diff --git a/.gitignore b/.gitignore index 5ad181a5e..f57cab57f 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ docs/docs/python/classes.txt docs/docs/python/functions.txt docs/docs/python/constants.txt **/.vscode +**/venv diff --git a/README.md b/README.md index da1ec8700..79cc041d2 100644 --- a/README.md +++ b/README.md @@ -37,12 +37,22 @@ vcpkg install dlib ## 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 +python -m venv venv +pip install build +``` +Then you must compile dlib and install it in your environment. Type: ```bash -python setup.py install +python -m build --wheel +pip install dist/dlib-.whl ``` +Or download dlib using PyPi: +```bash +pip install dlib +``` ## Running the unit test suite diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..2fd725a0d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel", "cmake"] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 8e4330986..c32c210e2 100644 --- a/setup.py +++ b/setup.py @@ -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 python packages. -To build the dlib: +To build dlib: python setup.py build To build and 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 python setup.py sdist twine upload dist/dlib-*.tar.gz @@ -39,7 +35,7 @@ import multiprocessing from distutils import log 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 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) 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. - packages=['dlib'], + packages=find_packages(exclude=['python_examples']), package_dir={'': 'tools/python'}, keywords=['dlib', 'Computer Vision', 'Machine Learning'], classifiers=[ @@ -248,13 +244,6 @@ setup( 'Operating System :: Microsoft :: Windows', 'Programming Language :: C++', '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 :: Artificial Intelligence', 'Topic :: Scientific/Engineering :: Image Recognition',