Skip to content

Commit

Permalink
Set PYTHONUNBUFFERED=1 for the Python provider (#510)
Browse files Browse the repository at this point in the history
* Set `PYTHONUNBUFFERED=1` for the Python provider

* update snapshot tests
  • Loading branch information
coffee-cup authored Sep 7, 2022
1 parent 150efad commit 43c6cac
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 9 deletions.
5 changes: 5 additions & 0 deletions src/providers/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ impl Provider for PythonProvider {
plan.set_start_phase(start);
}

plan.add_variables(EnvironmentVariables::from([(
"PYTHONUNBUFFERED".to_owned(),
"1".to_owned(),
)]));

if app.includes_file("poetry.lock") {
plan.add_variables(EnvironmentVariables::from([(
"NIXPACKS_POETRY_VERSION".to_string(),
Expand Down
3 changes: 2 additions & 1 deletion tests/snapshots/generate_plan_tests__python.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ expression: plan
"nixpacksVersion": "[version]",
"buildImage": "[build_image]",
"variables": {
"NIXPACKS_METADATA": "python"
"NIXPACKS_METADATA": "python",
"PYTHONUNBUFFERED": "1"
},
"phases": [
{
Expand Down
3 changes: 2 additions & 1 deletion tests/snapshots/generate_plan_tests__python_2.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ expression: plan
"nixpacksVersion": "[version]",
"buildImage": "[build_image]",
"variables": {
"NIXPACKS_METADATA": "python"
"NIXPACKS_METADATA": "python",
"PYTHONUNBUFFERED": "1"
},
"phases": [
{
Expand Down
3 changes: 2 additions & 1 deletion tests/snapshots/generate_plan_tests__python_2_runtime.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ expression: plan
"nixpacksVersion": "[version]",
"buildImage": "[build_image]",
"variables": {
"NIXPACKS_METADATA": "python"
"NIXPACKS_METADATA": "python",
"PYTHONUNBUFFERED": "1"
},
"phases": [
{
Expand Down
3 changes: 2 additions & 1 deletion tests/snapshots/generate_plan_tests__python_django.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ expression: plan
"nixpacksVersion": "[version]",
"buildImage": "[build_image]",
"variables": {
"NIXPACKS_METADATA": "python,django,postgres"
"NIXPACKS_METADATA": "python,django,postgres",
"PYTHONUNBUFFERED": "1"
},
"phases": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ expression: plan
"nixpacksVersion": "[version]",
"buildImage": "[build_image]",
"variables": {
"NIXPACKS_METADATA": "python,django"
"NIXPACKS_METADATA": "python,django",
"PYTHONUNBUFFERED": "1"
},
"phases": [
{
Expand Down
3 changes: 2 additions & 1 deletion tests/snapshots/generate_plan_tests__python_numpy.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ expression: plan
"nixpacksVersion": "[version]",
"buildImage": "[build_image]",
"variables": {
"NIXPACKS_METADATA": "python"
"NIXPACKS_METADATA": "python",
"PYTHONUNBUFFERED": "1"
},
"phases": [
{
Expand Down
3 changes: 2 additions & 1 deletion tests/snapshots/generate_plan_tests__python_poetry.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ expression: plan
"buildImage": "[build_image]",
"variables": {
"NIXPACKS_METADATA": "python,poetry",
"NIXPACKS_POETRY_VERSION": "1.1.13"
"NIXPACKS_POETRY_VERSION": "1.1.13",
"PYTHONUNBUFFERED": "1"
},
"phases": [
{
Expand Down
3 changes: 2 additions & 1 deletion tests/snapshots/generate_plan_tests__python_procfile.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ expression: plan
"nixpacksVersion": "[version]",
"buildImage": "[build_image]",
"variables": {
"NIXPACKS_METADATA": "python"
"NIXPACKS_METADATA": "python",
"PYTHONUNBUFFERED": "1"
},
"phases": [
{
Expand Down
3 changes: 2 additions & 1 deletion tests/snapshots/generate_plan_tests__python_setuptools.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ expression: plan
"nixpacksVersion": "[version]",
"buildImage": "[build_image]",
"variables": {
"NIXPACKS_METADATA": "python"
"NIXPACKS_METADATA": "python",
"PYTHONUNBUFFERED": "1"
},
"phases": [
{
Expand Down

0 comments on commit 43c6cac

Please sign in to comment.