diff --git a/packages/infrastructure/test/projects/python/__snapshots__/infrastructure-py-project.test.ts.snap b/packages/infrastructure/test/projects/python/__snapshots__/infrastructure-py-project.test.ts.snap index 62dbc31ab..e290fceb7 100644 --- a/packages/infrastructure/test/projects/python/__snapshots__/infrastructure-py-project.test.ts.snap +++ b/packages/infrastructure/test/projects/python/__snapshots__/infrastructure-py-project.test.ts.snap @@ -769,6 +769,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry update", }, @@ -784,6 +787,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry check --lock && poetry install", }, @@ -1622,6 +1628,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry update", }, @@ -1637,6 +1646,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry check --lock && poetry install", }, @@ -2510,6 +2522,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry update", }, @@ -2525,6 +2540,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry check --lock && poetry install", }, @@ -3457,6 +3475,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry update", }, @@ -3472,6 +3493,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry check --lock && poetry install", }, @@ -4431,6 +4455,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry update", }, @@ -4446,6 +4473,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry check --lock && poetry install", }, @@ -5341,6 +5371,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry update", }, @@ -5356,6 +5389,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry check --lock && poetry install", }, diff --git a/packages/monorepo/src/components/nx-configurator.ts b/packages/monorepo/src/components/nx-configurator.ts index 6ee9e6248..c1d7c3264 100644 --- a/packages/monorepo/src/components/nx-configurator.ts +++ b/packages/monorepo/src/components/nx-configurator.ts @@ -197,9 +197,14 @@ export class NxConfigurator extends Component implements INxProjectCore { ["install", "install:ci"].forEach((t) => { const task = project.tasks.tryFind(t); - // Setup env - const cmd = "poetry env use python$PYTHON_VERSION"; - task?.steps[0]?.exec !== cmd && task?.prependExec(cmd); + // Setup env and ensure the projen & pdk bins are removed from the venv as we always want to use the npx variant + [ + "rm -f `poetry env info -p`/bin/projen `poetry env info -p`/bin/pdk", + "poetry env use python$PYTHON_VERSION", + ].forEach( + (cmd) => + !task?.steps.find((s) => s.exec === cmd) && task?.prependExec(cmd) + ); const pythonVersion = project.deps.tryGetDependency("python")?.version; task!.env( diff --git a/packages/monorepo/test/__snapshots__/monorepo.test.ts.snap b/packages/monorepo/test/__snapshots__/monorepo.test.ts.snap index 981330d53..27e84ffc8 100644 --- a/packages/monorepo/test/__snapshots__/monorepo.test.ts.snap +++ b/packages/monorepo/test/__snapshots__/monorepo.test.ts.snap @@ -9554,6 +9554,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry update", }, @@ -9569,6 +9572,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry check --lock && poetry install", }, @@ -10143,6 +10149,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry update", }, @@ -10158,6 +10167,9 @@ cython_debug/ { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry check --lock && poetry install", }, @@ -19564,6 +19576,9 @@ link-workspace-packages=true { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry update", }, @@ -19582,6 +19597,9 @@ link-workspace-packages=true { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "poetry check --lock && poetry install", }, diff --git a/packages/type-safe-api/test/project/__snapshots__/type-safe-api-project.test.ts.snap b/packages/type-safe-api/test/project/__snapshots__/type-safe-api-project.test.ts.snap index ed745f703..0fb03e070 100644 --- a/packages/type-safe-api/test/project/__snapshots__/type-safe-api-project.test.ts.snap +++ b/packages/type-safe-api/test/project/__snapshots__/type-safe-api-project.test.ts.snap @@ -7759,6 +7759,9 @@ pyproject.toml { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p openapi_java_python_runtime && touch openapi_java_python_runtime/__init__.py", }, @@ -7777,6 +7780,9 @@ pyproject.toml { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p openapi_java_python_runtime && touch openapi_java_python_runtime/__init__.py", }, @@ -15569,6 +15575,9 @@ mocks { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p openapi_python_python_infra && touch openapi_python_python_infra/__init__.py", }, @@ -15587,6 +15596,9 @@ mocks { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p openapi_python_python_infra && touch openapi_python_python_infra/__init__.py", }, @@ -17111,6 +17123,9 @@ pyproject.toml { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p openapi_python_python_runtime && touch openapi_python_python_runtime/__init__.py", }, @@ -17129,6 +17144,9 @@ pyproject.toml { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p openapi_python_python_runtime && touch openapi_python_python_runtime/__init__.py", }, @@ -26833,6 +26851,9 @@ pyproject.toml { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p openapi_typescript_python_runtime && touch openapi_typescript_python_runtime/__init__.py", }, @@ -26851,6 +26872,9 @@ pyproject.toml { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p openapi_typescript_python_runtime && touch openapi_typescript_python_runtime/__init__.py", }, @@ -43893,6 +43917,9 @@ pyproject.toml { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p smithy_java_python_runtime && touch smithy_java_python_runtime/__init__.py", }, @@ -43911,6 +43938,9 @@ pyproject.toml { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p smithy_java_python_runtime && touch smithy_java_python_runtime/__init__.py", }, @@ -66748,6 +66778,9 @@ mocks { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p smithy_python_python_infra && touch smithy_python_python_infra/__init__.py", }, @@ -66766,6 +66799,9 @@ mocks { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p smithy_python_python_infra && touch smithy_python_python_infra/__init__.py", }, @@ -68290,6 +68326,9 @@ pyproject.toml { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p smithy_python_python_runtime && touch smithy_python_python_runtime/__init__.py", }, @@ -68308,6 +68347,9 @@ pyproject.toml { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p smithy_python_python_runtime && touch smithy_python_python_runtime/__init__.py", }, @@ -78200,6 +78242,9 @@ pyproject.toml { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p smithy_typescript_python_runtime && touch smithy_typescript_python_runtime/__init__.py", }, @@ -78218,6 +78263,9 @@ pyproject.toml { "exec": "poetry env use python$PYTHON_VERSION", }, + { + "exec": "rm -f \`poetry env info -p\`/bin/projen \`poetry env info -p\`/bin/pdk", + }, { "exec": "mkdir -p smithy_typescript_python_runtime && touch smithy_typescript_python_runtime/__init__.py", },