Skip to content

Commit 148883c

Browse files
committed
auto copy requirements
1 parent ffa1e33 commit 148883c

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

veadk/cli/cli_deploy.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
import click
1617

1718
TEMP_PATH = "/tmp"
@@ -29,9 +30,15 @@
2930
help="Volcengine secret key",
3031
)
3132
@click.option("--vefaas-app-name", help="Expected Volcengine FaaS application name")
32-
@click.option("--veapig-instance-name", help="Expected Volcengine APIG instance name")
33-
@click.option("--veapig-service-name", help="Expected Volcengine APIG service name")
34-
@click.option("--veapig-upstream-name", help="Expected Volcengine APIG upstream name")
33+
@click.option(
34+
"--veapig-instance-name", default="", help="Expected Volcengine APIG instance name"
35+
)
36+
@click.option(
37+
"--veapig-service-name", default="", help="Expected Volcengine APIG service name"
38+
)
39+
@click.option(
40+
"--veapig-upstream-name", default="", help="Expected Volcengine APIG upstream name"
41+
)
3542
@click.option(
3643
"--short-term-memory-backend",
3744
default="local",
@@ -110,6 +117,17 @@ def deploy(
110117
shutil.copytree(user_proj_abs_path, agent_dir, dirs_exist_ok=True)
111118
logger.debug(f"Remove agent module from {user_proj_abs_path} to {agent_dir}")
112119

120+
# copy requirements.txt
121+
if (user_proj_abs_path / "requirements.txt").exists():
122+
shutil.copy(
123+
user_proj_abs_path / "requirements.txt",
124+
Path(TEMP_PATH) / tmp_dir_name / "src" / "requirements.txt",
125+
)
126+
else:
127+
logger.warning(
128+
"No requirements.txt found in the user project, we will use a default one."
129+
)
130+
113131
# load
114132
logger.debug(
115133
f"Load deploy module from {Path(TEMP_PATH) / tmp_dir_name / 'deploy.py'}"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
git+https://github.com/volcengine/veadk-python.git
1+
veadk-python

0 commit comments

Comments
 (0)