-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy path.projenrc.ts
137 lines (127 loc) · 3.92 KB
/
.projenrc.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
import { monorepo } from "@aws/pdk";
import { InfrastructureTsProject } from "@aws/pdk/infrastructure";
import { javascript } from "projen";
import { PythonProject } from "projen/lib/python";
const context = {
/**
* Bedrock model id to use in rule evaluation.
*
* Default - "anthropic.claude-3-5-sonnet-20241022-v2:0"
*/
// modelId: "anthropic.claude-3-5-sonnet-20241022-v2:0",
};
const cdkVersion = "2.173.2";
const pdkVersion = "0.25.13";
const projectName = "code-expert";
const npmPrefix = "@amzn/";
const pypiPrefix = "amzn-";
const toSnakeCase = (str: string): string => {
return str
.split(/(?=[A-Z])|[\s-]+/) // Split on uppercase letters, spaces, or hyphens
.map((word) => word.toLowerCase())
.join("_");
};
const project = new monorepo.MonorepoTsProject({
devDeps: [`@aws/pdk@${pdkVersion}`],
name: npmPrefix + projectName,
packageManager: javascript.NodePackageManager.PNPM,
projenrcTs: true,
gitignore: [
".bashrc",
".profile",
".idea",
".venv",
".DS_Store",
"__pycache__",
"mermaid-filter.err",
],
prettier: true,
license: "Apache-2.0",
licenseOptions: {
disableDefaultLicenses: true,
},
});
const codeExpert = new PythonProject({
parent: project,
name: `${pypiPrefix}${projectName}-code-expert`,
outdir: `packages/${projectName}/code-expert`,
moduleName: `${toSnakeCase(pypiPrefix + projectName)}_code_expert`,
authorName: "AWS Latam PACE",
authorEmail: "[email protected]",
version: "0.1.0",
deps: [
"boto3@^1.35.37",
"Jinja2@^3.1.5",
"pydantic@^2.10.4",
"python@^3.12",
"aws-lambda-powertools@{version = '^3.4.0', extras = ['parser']}",
"lxml@^5.3.0",
"tenacity@^9.0.0",
],
devDeps: [
"boto3-stubs-lite@{version = '^1.35.37', extras = ['bedrock', 'bedrock-runtime', 'dynamodb', 'firehose', 's3', 'ssm', 'stepfunctions']}",
"moto@{version = '^5.0.16', extras = ['all']}",
"mypy@^1.11.2",
"black@^24.10.0",
"python-dotenv@^1.0.1",
],
poetry: true,
pip: false,
setuptools: false,
venv: false,
});
const demo = new PythonProject({
parent: project,
name: `${pypiPrefix}${projectName}-demo`,
outdir: `demo`,
moduleName: `${toSnakeCase(pypiPrefix + projectName)}demo`,
authorName: "AWS Latam PACE",
authorEmail: "[email protected]",
version: "0.1.0",
deps: ["boto3@^1.35.37", "python@^3.12", "streamlit@^1.41.1"],
devDeps: [
"boto3-stubs-lite@{version = '^1.35.37', extras = ['bedrock-runtime', 'dynamodb', 'firehose', 's3', 'sagemaker-a2i-runtime', 'ssm', 'stepfunctions']}",
"mypy@^1.11.2",
"black@^24.10.0",
],
poetry: true,
pip: false,
setuptools: false,
venv: false,
pytest: false,
sample: false,
});
const demoPyprojectToml = demo.tryFindObjectFile("pyproject.toml");
if (demoPyprojectToml) {
demoPyprojectToml.addOverride("tool.poetry.package-mode", false);
}
demo.tasks.removeTask("build");
const infra = new InfrastructureTsProject({
parent: project,
name: `${npmPrefix}${projectName}-infra`,
outdir: "packages/infra",
cdkVersion: cdkVersion,
deps: [
`@aws/pdk@^${pdkVersion}`,
"cdk-nag",
`@aws-cdk/aws-lambda-python-alpha@^${cdkVersion}-alpha.0`,
"@cdklabs/generative-ai-cdk-constructs@^0.1.291",
],
context: { ...context },
prettier: true,
gitignore: ["cdk.context.json"],
});
project.addImplicitDependency(infra, codeExpert);
project.synth();