diff --git a/bin/compile b/bin/compile index db2d838bb..6e30856b0 100755 --- a/bin/compile +++ b/bin/compile @@ -269,8 +269,13 @@ mtime "pip.uninstall.time" "${start}" # This allows for people to ship a setup.py application to Heroku # (which is rare, but I vouch that it should work!) -if [ ! -f requirements.txt ] && [ ! -f Pipfile ]; then - echo "-e ." > requirements.txt +if [ ! -f requirements.txt ] && [ ! -f Pipfile ] ; then + if [ -f pyproject.toml ] ; then + # Editable installs are not supported for pyproject.toml-style projects. + echo "." > requirements.txt + else + echo "-e ." > requirements.txt + fi fi # Fix egg-links. diff --git a/bin/detect b/bin/detect index eeb965b0f..682585fc5 100755 --- a/bin/detect +++ b/bin/detect @@ -15,7 +15,7 @@ BUILD_DIR=$1 # Exit early if app is clearly not Python. -if [ ! -f "$BUILD_DIR/requirements.txt" ] && [ ! -f "$BUILD_DIR/setup.py" ] && [ ! -f "$BUILD_DIR/Pipfile" ]; then +if [ ! -f "$BUILD_DIR/requirements.txt" ] && [ ! -f "$BUILD_DIR/setup.py" ] && [ ! -f "$BUILD_DIR/Pipfile" ] && [ ! -f "$BUILD_DIR/pyproject.toml" ]; then exit 1 fi diff --git a/test/fixtures/flit-requires/foobar.py b/test/fixtures/flit-requires/foobar.py new file mode 100644 index 000000000..4b4c67818 --- /dev/null +++ b/test/fixtures/flit-requires/foobar.py @@ -0,0 +1,3 @@ +"""An amazing sample package!""" + +__version__ = '0.1' diff --git a/test/fixtures/flit-requires/pyproject.toml b/test/fixtures/flit-requires/pyproject.toml new file mode 100644 index 000000000..61cc974f1 --- /dev/null +++ b/test/fixtures/flit-requires/pyproject.toml @@ -0,0 +1,10 @@ +[build-system] +requires = ["flit"] +build-backend = "flit.buildapi" + +[tool.flit.metadata] +module = "foobar" +author = "Sir Robin" +author-email = "robin@camelot.uk" +home-page = "https://github.com/sirrobin/foobar" +requires = ["attrs >=19.1.0"] diff --git a/test/fixtures/flit/foobar.py b/test/fixtures/flit/foobar.py new file mode 100644 index 000000000..4b4c67818 --- /dev/null +++ b/test/fixtures/flit/foobar.py @@ -0,0 +1,3 @@ +"""An amazing sample package!""" + +__version__ = '0.1' diff --git a/test/fixtures/flit/pyproject.toml b/test/fixtures/flit/pyproject.toml new file mode 100644 index 000000000..3dca8c957 --- /dev/null +++ b/test/fixtures/flit/pyproject.toml @@ -0,0 +1,9 @@ +[build-system] +requires = ["flit"] +build-backend = "flit.buildapi" + +[tool.flit.metadata] +module = "foobar" +author = "Sir Robin" +author-email = "robin@camelot.uk" +home-page = "https://github.com/sirrobin/foobar" diff --git a/test/fixtures/poetry-lock/foobar.py b/test/fixtures/poetry-lock/foobar.py new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/poetry-lock/poetry.lock b/test/fixtures/poetry-lock/poetry.lock new file mode 100644 index 000000000..3eb160325 --- /dev/null +++ b/test/fixtures/poetry-lock/poetry.lock @@ -0,0 +1,19 @@ +[[package]] +category = "main" +description = "Classes Without Boilerplate" +name = "attrs" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "19.1.0" + +[package.extras] +dev = ["coverage", "hypothesis", "pympler", "pytest", "six", "zope.interface", "sphinx", "pre-commit"] +docs = ["sphinx", "zope.interface"] +tests = ["coverage", "hypothesis", "pympler", "pytest", "six", "zope.interface"] + +[metadata] +content-hash = "9c92739040d45f898575877e69198d92bb9477423fe80c60a14376bf1f3d010e" +python-versions = "^3.7" + +[metadata.hashes] +attrs = ["69c0dbf2ed392de1cb5ec704444b08a5ef81680a61cb899dc08127123af36a79", "f0b870f674851ecbfbbbd364d6b5cbdff9dcedbc7f3f5e18a6891057f21fe399"] diff --git a/test/fixtures/poetry-lock/pyproject.toml b/test/fixtures/poetry-lock/pyproject.toml new file mode 100644 index 000000000..0a3fd420a --- /dev/null +++ b/test/fixtures/poetry-lock/pyproject.toml @@ -0,0 +1,15 @@ +[tool.poetry] +name = "foobar" +version = "0.1.0" +description = "" +authors = ["Your Name "] + +[tool.poetry.dependencies] +python = "^3.6" +attrs = "^19.1.0" + +[tool.poetry.dev-dependencies] + +[build-system] +requires = ["poetry>=0.12"] +build-backend = "poetry.masonry.api" diff --git a/test/fixtures/poetry/foobar.py b/test/fixtures/poetry/foobar.py new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/poetry/pyproject.toml b/test/fixtures/poetry/pyproject.toml new file mode 100644 index 000000000..4074cf7f7 --- /dev/null +++ b/test/fixtures/poetry/pyproject.toml @@ -0,0 +1,14 @@ +[tool.poetry] +name = "foobar" +version = "0.1.0" +description = "" +authors = ["Your Name "] + +[tool.poetry.dependencies] +python = "^3.6" + +[tool.poetry.dev-dependencies] + +[build-system] +requires = ["poetry>=0.12"] +build-backend = "poetry.masonry.api" diff --git a/test/fixtures/pyproject-toml/pyproject.toml b/test/fixtures/pyproject-toml/pyproject.toml new file mode 100644 index 000000000..864b334a8 --- /dev/null +++ b/test/fixtures/pyproject-toml/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta:__legacy__" diff --git a/test/fixtures/pyproject-toml/setup.py b/test/fixtures/pyproject-toml/setup.py new file mode 100644 index 000000000..4d986d25d --- /dev/null +++ b/test/fixtures/pyproject-toml/setup.py @@ -0,0 +1,4 @@ +from setuptools import setup + + +setup(name="foobar", version="1.0.0") diff --git a/test/run-features b/test/run-features index 66fac4ea7..3c7b168ff 100755 --- a/test/run-features +++ b/test/run-features @@ -70,6 +70,31 @@ testPipenvFullVersion() { assertCapturedSuccess } +testPyProjectToml() { + compile "pyproject-toml" + assertCapturedSuccess +} + +testPoetry() { + compile "poetry" + assertCapturedSuccess +} + +testPoetryLock() { + compile "poetry-lock" + assertCapturedSuccess +} + +testFlit() { + compile "flit" + assertCapturedSuccess +} + +testFlitRequires() { + compile "flit-requires" + assertCapturedSuccess +} + testNoRequirements() { compile "no-requirements" assertCapturedError