@@ -916,6 +916,115 @@ Currently available packages:
916
916
| typing | | python >=3 |
917
917
+-------------+-------------------+--------------+
918
918
919
+ .. _knowledge:pep517 :
920
+
921
+ Python PEP517 Build Isolation
922
+ -----------------------------
923
+
924
+ `PEP517 <https://www.python.org/dev/peps/pep-0517/ >`_ paves the way for building
925
+ python wheels in a well-defined, isolated environment, and is generally a good step
926
+ forward. However, ``conda-build `` already performs this function, even distinguishing
927
+ between the ``host `` and ``build `` environments, and supporting additional,
928
+ heavyweight dependencies like compilers and other build-time language runtimes.
929
+
930
+
931
+ Common PEP517 Problems
932
+ ^^^^^^^^^^^^^^^^^^^^^^
933
+
934
+ A number of symptoms of PEP517 build isolation conflicts with ``conda-build ``
935
+ manifest in different ways.
936
+
937
+ ``ModuleNotFoundError `` during test
938
+ """""""""""""""""""""""""""""""""""
939
+
940
+ When problems occur at the interacton of ``pip `` and more exotic build tools like
941
+ e.g. ``poetry `` and ``flit ``, the expected output can leave the as-installed package in
942
+ a bad state, which might leave the following ``meta.yaml `` excerpt like this:
943
+
944
+ .. code-block :: yaml
945
+
946
+ package :
947
+ name : foopkg
948
+ version : 0.1.0
949
+
950
+ build :
951
+ script : {{ PYTHON }} -m pip install . -vv
952
+
953
+ requirements :
954
+ host :
955
+ - poetry-core
956
+ - python
957
+ run :
958
+ - python
959
+
960
+ test :
961
+ requires :
962
+ - pip
963
+ imports :
964
+ - foopkg
965
+ commands :
966
+ - pip check
967
+
968
+ To show an error like this
969
+
970
+ .. code-block :: sh
971
+
972
+ File " ~/conda/feedstock_root/build_artifacts/foopkg_1635435591741/test_tmp/run_test.py" , line 2, in < module>
973
+ import foopkg
974
+ ModuleNotFoundError: No module named ' foopkg'
975
+ import: ' foopkg'
976
+
977
+ Version ``0.0.0 `` reported
978
+ """"""""""""""""""""""""""
979
+
980
+ Further, some other tools such as ``setuptools_scm `` might leave the version
981
+ observed by e.g. ``pip check `` or ``entry_points `` at ``0.0.0 ``.
982
+
983
+
984
+ PEP517 Workarounds
985
+ ^^^^^^^^^^^^^^^^^^
986
+
987
+ .. note ::
988
+
989
+ Some workarounds are available for the above problems, but eventually this will
990
+ have to be fixed in ``conda-build `` itself
991
+
992
+ Use Deprecated Out-of-Tree Build (preferred)
993
+ """"""""""""""""""""""""""""""""""""""""""""
994
+
995
+ .. code-block :: yaml
996
+
997
+ build :
998
+ script : {{ PYTHON }} -m pip install . -vv --use-deprecated=out-of-tree-build
999
+
1000
+ This falls back to some previous ``pip `` behavior, and allows many builds to continue
1001
+ normally
1002
+
1003
+ .. hint ::
1004
+
1005
+ While this is a deprecated feature which will be removed in the future, it has
1006
+ the advantage of being a `well-known string ` for which it might be possible to
1007
+ write an automated migration once a real fix is available.
1008
+
1009
+ Delete ``pyproject.toml ``
1010
+ """""""""""""""""""""""""
1011
+
1012
+ .. code-block :: yaml
1013
+
1014
+ build :
1015
+ script :
1016
+ - {{ PYTHON }} -c "__import__('os').unlink('pyproject.toml')"
1017
+ - {{ PYTHON }} -m pip install . -vv
1018
+
1019
+ In the absence of a ``pyproject.toml ``, installation will fall back on legacy
1020
+ metadata files such as ``setup.py `` and/or ``setup.cfg ``.
1021
+
1022
+ .. warning ::
1023
+
1024
+ This relies on most PEP517-compliant tools generating these files to include in
1025
+ ``.tar.gz `` during the build process. It is unknown how long this will be
1026
+ supported, and is likely to introduce other, unknown issues as more build/test
1027
+ tools make use of ``pyproject.toml ``.
919
1028
920
1029
Noarch builds
921
1030
=============
@@ -1431,13 +1540,13 @@ Installing a pre-release build
1431
1540
Use the following command, but replace ``PACKAGE_NAME `` with the package you want
1432
1541
to install and replace ``LABEL `` with ``rc `` or ``dev ``:
1433
1542
1434
- .. code-block :: yaml
1543
+ .. code-block :: sh
1435
1544
1436
1545
conda install -c conda-forge/label/PACKAGE_NAME_LABEL -c conda-forge PACKAGE_NAME
1437
1546
1438
1547
For example, let's install matplotlib from the ``rc `` label:
1439
1548
1440
- .. code-block :: yaml
1549
+ .. code-block :: sh
1441
1550
1442
1551
conda install -c conda-forge/label/matplotlib_rc -c conda-forge matplotlib
1443
1552
@@ -1464,3 +1573,4 @@ The tl;dr here is that conda sorts as follows:
1464
1573
So make sure that you **tag ** your package in such a way that the package name
1465
1574
that conda-build spits out will sort the package uploaded with an ``rc `` label
1466
1575
higher than the package uploaded with the ``dev `` label.
1576
+
0 commit comments