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

Support pyproject.toml #834

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 7 additions & 2 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +272 to +278
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this change is needed. Editable installations are supported.

fi

# Fix egg-links.
Expand Down
2 changes: 1 addition & 1 deletion bin/detect
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/flit-requires/foobar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""An amazing sample package!"""

__version__ = '0.1'
10 changes: 10 additions & 0 deletions test/fixtures/flit-requires/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[build-system]
requires = ["flit"]
build-backend = "flit.buildapi"

[tool.flit.metadata]
module = "foobar"
author = "Sir Robin"
author-email = "[email protected]"
home-page = "https://github.com/sirrobin/foobar"
requires = ["attrs >=19.1.0"]
3 changes: 3 additions & 0 deletions test/fixtures/flit/foobar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""An amazing sample package!"""

__version__ = '0.1'
9 changes: 9 additions & 0 deletions test/fixtures/flit/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[build-system]
requires = ["flit"]
build-backend = "flit.buildapi"

[tool.flit.metadata]
module = "foobar"
author = "Sir Robin"
author-email = "[email protected]"
home-page = "https://github.com/sirrobin/foobar"
Empty file.
19 changes: 19 additions & 0 deletions test/fixtures/poetry-lock/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions test/fixtures/poetry-lock/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[tool.poetry]
name = "foobar"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]

[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"
Empty file.
14 changes: 14 additions & 0 deletions test/fixtures/poetry/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[tool.poetry]
name = "foobar"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.6"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
3 changes: 3 additions & 0 deletions test/fixtures/pyproject-toml/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta:__legacy__"
4 changes: 4 additions & 0 deletions test/fixtures/pyproject-toml/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from setuptools import setup


setup(name="foobar", version="1.0.0")
25 changes: 25 additions & 0 deletions test/run-features
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down