Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp Python build system to fix multiple build problems #6

Merged
merged 3 commits into from
Jan 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ jobs:
steps:
- checkout
- run:
# TODO in-place pip install is not working
command: cd PythonAPI && python setup.py build_ext
command: python -m pip install --use-feature=in-tree-build ./PythonAPI
name: Install From Source

build-from-sdist:
Expand All @@ -19,8 +18,9 @@ jobs:
- checkout
- run:
command: |
cd PythonAPI && python setup.py sdist
python -m pip install --progress-bar off dist/*.tar.gz
python -m pip install build
python -m build --sdist ./PythonAPI
python -m pip install --progress-bar off ./PythonAPI/dist/*.tar.gz
name: Install From Distribution
- run:
command: |
Expand Down
2 changes: 1 addition & 1 deletion PythonAPI/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ all:

install:
# install pycocotools to the Python site-packages
python setup.py build_ext install
python -m pip install --use-feature=in-tree-build .
rm -rf build
8 changes: 8 additions & 0 deletions PythonAPI/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[build-system]
requires = [
"cython>=0.27.3",
"oldest-supported-numpy",
"setuptools>=43.0.0",
"wheel",
]
build-backend = "setuptools.build_meta"
18 changes: 5 additions & 13 deletions PythonAPI/setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
"""To compile and install locally run "python setup.py build_ext --inplace".
To install library to Python site-packages run "python setup.py build_ext install"
To install library to Python site-packages run "python -m pip install --use-feature=in-tree-build ."
"""
import platform
from setuptools import dist, setup, Extension

setup_requires = [
'setuptools>=18.0',
'cython>=0.27.3',
'numpy',
]
dist.Distribution().fetch_build_eggs(setup_requires)
from setuptools import setup, Extension

import numpy as np

Expand All @@ -30,11 +23,10 @@
license="FreeBSD",
packages=['pycocotools'],
package_dir={'pycocotools': 'pycocotools'},
setup_requires=setup_requires,
python_requires='>=3.5',
install_requires=[
'setuptools>=18.0',
'cython>=0.27.3',
'matplotlib>=2.1.0'
'matplotlib>=2.1.0',
'numpy',
],
version='2.0.2',
ext_modules=ext_modules
Expand Down