8000 Merge pull request #6738 from stefanv/remove-distutils-and-setup.py · scikit-image/scikit-image@49cb3a4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 49cb3a4

Browse files
Merge pull request #6738 from stefanv/remove-distutils-and-setup.py
Bite the bullet: remove distutils and setup.py
2 parents 2550e2c + 5a130f1 commit 49cb3a4

File tree

35 files changed

+66
-1039
lines changed

35 files changed

+66
-1039
lines changed

.devpy/cmds.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,10 @@ def coverage(build_dir):
6565
"""📊 Generate coverage report
6666
"""
6767
util.run(['python', '-m', 'devpy', 'test', '--build-dir', build_dir, '--', '-o', 'python_functions=test_*', 'skimage', '--cov=skimage'], replace=True)
68+
69+
70+
@click.command()
71+
def sdist():
72+
"""📦 Build a source distribution in `dist/`.
73+
"""
74+
util.run(['python', '-m', 'build', '.', '--sdist'])

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.* export-ignore
2+
.devpy -export-ignore
3+
azure-pipelines.yml export-ignore

.github/workflows/tests.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,8 @@ jobs:
8686
source tools/github/before_install.sh
8787
set -ex
8888
if [[ $INSTALL_FROM_SDIST == "1" ]]; then
89-
pip uninstall cython -y
90-
python setup.py sdist
91-
pip install dist/scikit-image-*.tar.gz
89+
python -m build --no-isolation --skip-dependency-check --sdist .
90+
pip install dist/scikit_image-*.tar.gz
9291
else
9392
pip install -vv --no-build-isolation .;
9493
fi

.github/workflows/wheel_tests_and_release.yml

Expand all lines: .github/workflows/wheel_tests_and_release.yml
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,12 @@ jobs:
277277
run: |
278278
SK_VERSION=$(git describe --tags)
279279
source tools/github/before_install.sh
280-
python setup.py sdist
280+
python -m build --no-isolation --skip-dependency-check --sdist .
281281
ls -la ${{ github.workspace }}/dist
282282
# We prefer to release wheels before source because otherwise there is a
283283
# small window during which users who pip install scikit-image will require compilation.
284284
twine upload ${{ github.workspace }}/dist/*.whl
285-
twine upload ${{ github.workspace }}/dist/scikit-image-${SK_VERSION:1}.tar.gz
285+
twine upload ${{ github.workspace }}/dist/scikit_image-${SK_VERSION:1}.tar.gz
286286
env:
287287
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
288288
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}

INSTALL.rst

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -418,23 +418,10 @@ Platform-specific notes
418418

419419
**Windows**
420420

421-
If you experience the error ``Error:unable to find vcvarsall.bat`` it means
422-
that your computer does not have recommended compilers for Python. You can
423-
either download and install Windows compilers from `here`_ or use
424-
`MinGW compilers`_ . If using `MinGW`, make sure to correctly configure
425-
``distutils`` by modifying (or create, if not existing) the configuration file
426-
``distutils.cfg`` (located for example at
427-
``C:\Python26\Lib\distutils\distutils.cfg``) to contain::
428-
429-
[build]
430-
compiler=mingw32
431-
432421
A run-through of the compilation process for Windows is included in
433422
our `setup of Azure Pipelines`_ (a continuous integration service).
434423

435424
.. _setup of Azure Pipelines: https://github.com/scikit-image/scikit-image/blob/main/azure-pipelines.yml
436-
.. _here: https://wiki.python.org/moin/WindowsCompilers#Microsoft_Visual_C.2B-.2B-_14.0_standalone:_Visual_C.2B-.2B-_Build_Tools_2015_.28x86.2C_x64.2C_ARM.29
437-
.. _MinGW compilers: http://www.mingw.org/wiki/howto_install_the_mingw_gcc_compiler_suite
438425

439426
**Debian and Ubuntu**
440427

azure-pipelines.yml

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ jobs:
1212
strategy:
1313
maxParallel: 10
1414
matrix:
15-
Python38:
16-
PYTHON_VERSION: "3.8"
17-
ARCH: "x86"
18-
PIP_FLAGS: ""
1915
Python38-x64:
2016
PYTHON_VERSION: "3.8"
2117
ARCH: "x64"
@@ -29,7 +25,7 @@ jobs:
2925
PIP_FLAGS: "--pre"
3026
Python39:
3127
PYTHON_VERSION: "3.9"
32-
ARCH: "x86"
28+
ARCH: "x64"
3329
PIP_FLAGS: ""
3430
Python39-x64:
3531
PYTHON_VERSION: "3.9"
@@ -72,33 +68,26 @@ jobs:
7268
# https://github.com/scikit-image/scikit-image/issues/6048
7369
continueOnError: true
7470

75-
- script: |
76-
choco install --$(ARCH) -y llvm
77-
set PATH=C:\Program Files\LLVM\bin;%PATH%
78-
set PATH=C:\Program Files (x86)\LLVM\bin;%PATH%
79-
echo '##vso[task.setvariable variable=PATH]%PATH%'
80-
displayName: "Install clang-cl"
81-
8271
- bash: |
8372
set -ex
8473
PYTHON="$(python.pythonLocation)\\python.exe"
8574
8675
# Update pip
87-
$PYTHON -m pip install -U pip "setuptools>=67" wheel
88-
89-
# print out the pip cache dir followed by the variable defined above
90-
# to confirm that they match
91-
$PYTHON -m pip cache dir
92-
echo "PIP_CACHE_DIR: $PIP_CACHE_DIR"
76+
$PYTHON -m pip install -U pip
9377
9478
# Check that we have the expected version and architecture for Python
9579
$PYTHON --version
9680
$PYTHON -m pip --version
9781
$PYTHON -c "import struct; print('Void pointer width is', struct.calcsize('P') * 8)"
98-
$PYTHON -m pip list
82+
83+
# print out the pip cache dir followed by the variable defined above
84+
# to confirm that they match
85+
$PYTHON -m pip cache dir
86+
echo "PIP_CACHE_DIR: $PIP_CACHE_DIR"
9987
10088
# Install the build and runtime dependencies of the project
10189
$PYTHON -m pip install ${PIP_FLAGS} -r requirements/build.txt
90+
$PYTHON -m pip list
10291
10392
# Disable C99 complex if PyWavelets needs to be built from source.
10493
# The compiler used will be MSVC, but C99 may be detected improperly
@@ -114,8 +103,33 @@ jobs:
114103
export CXXFLAGS="-m32"
115104
fi
116105
106+
## To list all installed packages:
107+
# choco list --localonly
108+
109+
# Remove other gcc compilers
110+
111+
## This would be the best way to uninstall, but is SLOW:
112+
# choco uninstall llvm mingw rtools strawberryperl -x
113+
114+
# Remove mingw gcc
115+
rm /c/ProgramData/Chocolatey/bin/gcc
116+
rm /c/ProgramData/Chocolatey/bin/g++
117+
rm /c/ProgramData/Chocolatey/bin/c++
118+
# Remove perl gcc
119+
rm -rf /c/Strawberry
120+
121+
which ccache || true
122+
which c++ || true
123+
124+
## Uncomment the next line, and you'll remain with only MSVC.
125+
# rm -rf "/c/Program Files/LLVM"
126+
## We're compiling with clang for now because MSVC 19 and
127+
## Pythran don't play well together.
128+
129+
which clang || true
130+
117131
# Compile the package and build the wheel
118-
$PYTHON setup.py bdist_wheel
132+
$PYTHON -m build --no-isolation --skip-dependency-check --wheel
119133
120134
# Install the generated wheel package
121135
ls dist

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ build = [
6666
'Cython>=0.29.24',
6767
'pythran',
6868
'numpy>=1.21.1',
69+
'build',
6970
]
7071
data = ['pooch>=1.3.0']
7172
default = [
@@ -154,6 +155,7 @@ package = 'skimage'
154155
Build = [
155156
'devpy.build',
156157
'devpy.test',
158+
'.devpy/cmds.py:sdist',
157159
]
158160
Environments = [
159161
'devpy.shell',

requirements/build.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ ninja
77
Cython>=0.29.24
88
pythran
99
numpy>=1.21.1
10+
11+
# Developer UI
1012
git+https://github.com/scientific-python/devpy
13+
build

0 commit comments

Comments
 (0)
0