@@ -693,7 +693,7 @@ def pip_requirements_step(path, prefix=None, required=False, tmp_dir=None):
693
693
step ("pip" , runtime , requirements , prefix , tmp_dir )
694
694
hash (requirements )
695
695
696
- def poetry_install_step (path , poetry_groups = None , prefix = None , required = False ):
696
+ def poetry_install_step (path , poetry_args = [] , prefix = None , required = False ):
697
697
pyproject_file = path
698
698
if os .path .isdir (path ):
699
699
pyproject_file = os .path .join (path , "pyproject.toml" )
@@ -703,7 +703,7 @@ def poetry_install_step(path, poetry_groups=None, prefix=None, required=False):
703
703
"poetry configuration not found: {}" .format (pyproject_file )
704
704
)
705
705
else :
706
- step ("poetry" , runtime , path , poetry_groups , prefix )
706
+ step ("poetry" , runtime , path , poetry_args , prefix )
707
707
hash (pyproject_file )
708
708
pyproject_path = os .path .dirname (pyproject_file )
709
709
poetry_lock_file = os .path .join (pyproject_path , "poetry.lock" )
@@ -807,7 +807,7 @@ def commands_step(path, commands):
807
807
prefix = claim .get ("prefix_in_zip" )
808
808
pip_requirements = claim .get ("pip_requirements" )
809
809
poetry_install = claim .get ("poetry_install" )
810
- poetry_groups = claim .get ("poetry_groups" )
810
+ additional_poetry_arg = claim .get ("additional_poetry_args" , [] )
811
811
npm_requirements = claim .get ("npm_package_json" )
812
812
runtime = claim .get ("runtime" , query .runtime )
813
813
@@ -832,7 +832,7 @@ def commands_step(path, commands):
832
832
poetry_install_step (
833
833
path ,
834
834
prefix = prefix ,
835
- poetry_groups = poetry_groups ,
835
+ poetry_args = additional_poetry_arg ,
836
836
required = True ,
837
837
)
838
838
@@ -907,11 +907,11 @@ def execute(self, build_plan, zip_stream, query):
907
907
(
908
908
runtime ,
909
909
path ,
910
- poetry_groups ,
910
+ poetry_args ,
911
911
prefix ,
912
912
) = action [1 :]
913
- log .info ("Poetry Groups : %s" , poetry_groups )
914
- with install_poetry_dependencies (query , path , poetry_groups ) as rd :
913
+ log .info ("Poetry arguments : %s" , poetry_args )
914
+ with install_poetry_dependencies (query , path , poetry_args ) as rd :
915
915
if rd :
916
916
if pf :
917
917
self ._zip_write_with_filter (zs , pf , rd , prefix , timestamp = 0 )
@@ -1106,7 +1106,7 @@ def install_pip_requirements(query, requirements_file, tmp_dir):
1106
1106
1107
1107
1108
1108
@contextmanager
1109
- def install_poetry_dependencies (query , path , poetry_groups ):
1109
+ def install_poetry_dependencies (query , path , poetry_args ):
1110
1110
# TODO:
1111
1111
# 1. Emit files instead of temp_dir
1112
1112
@@ -1195,31 +1195,16 @@ def copy_file_to_target(file, temp_dir):
1195
1195
# NOTE: poetry must be available in the build environment, which is the case with lambci/lambda:build-python* docker images but not public.ecr.aws/sam/build-python* docker images
1196
1196
# FIXME: poetry install does not currently allow to specify the target directory so we export the
1197
1197
# requirements then install them with "pip --no-deps" to avoid using pip dependency resolver
1198
- if poetry_groups is not None :
1199
- group_args = []
1200
- for group in poetry_groups :
1201
- group_args .append ("--with" )
1202
- group_args .append (group )
1203
1198
1204
- poetry_export = [
1205
- poetry_exec ,
1206
- "export" ,
1207
- "--format" ,
1208
- "requirements.txt" ,
1209
- "--output" ,
1210
- "requirements.txt" ,
1211
- "--with-credentials" ,
1212
- ] + group_args
1213
- else :
1214
- poetry_export = [
1215
- poetry_exec ,
1216
- "export" ,
1217
- "--format" ,
1218
- "requirements.txt" ,
1219
- "--output" ,
1220
- "requirements.txt" ,
1221
- "--with-credentials" ,
1222
- ]
1199
+ poetry_export = [
1200
+ poetry_exec ,
1201
+ "export" ,
1202
+ "--format" ,
1203
+ "requirements.txt" ,
1204
+ "--output" ,
1205
+ "requirements.txt" ,
1206
+ "--with-credentials" ,
1207
+ ] + poetry_args
1223
1208
1224
1209
poetry_commands = [
1225
1210
[
0 commit comments