(options: PythonProjectOptions)
| 254 | public readonly sampleTestdir: string; |
| 255 | |
| 256 | constructor(options: PythonProjectOptions) { |
| 257 | super(options); |
| 258 | |
| 259 | if (!PYTHON_PROJECT_NAME_REGEX.test(options.name)) { |
| 260 | throw new Error( |
| 261 | "Python projects must only consist of alphanumeric characters, hyphens, and underscores.", |
| 262 | ); |
| 263 | } |
| 264 | |
| 265 | this.moduleName = options.moduleName; |
| 266 | this.version = options.version; |
| 267 | this.sampleTestdir = options.sampleTestdir ?? "tests"; |
| 268 | |
| 269 | const rcFileTypeOptions = [ |
| 270 | options.projenrcPython, |
| 271 | options.projenrcJs, |
| 272 | options.projenrcJson, |
| 273 | options.projenrcTs, |
| 274 | ]; |
| 275 | |
| 276 | if (multipleSelected(rcFileTypeOptions)) { |
| 277 | throw new Error( |
| 278 | "Only one of projenrcPython, projenrcJs, projenrcTs, and projenrcJson can be selected.", |
| 279 | ); |
| 280 | } |
| 281 | |
| 282 | const poetry = options.poetry ?? false; |
| 283 | const uv = options.uv ?? false; |
| 284 | const not_poetry_or_uv = !poetry && !uv; |
| 285 | |
| 286 | // Assume pip if not using poetry or uv |
| 287 | const pip = options.pip ?? not_poetry_or_uv; |
| 288 | |
| 289 | // Assume venv if not using poetry or uv |
| 290 | const venv = options.venv ?? not_poetry_or_uv; |
| 291 | |
| 292 | const setuptools = options.setuptools ?? false; |
| 293 | |
| 294 | const tools = { |
| 295 | poetry: poetry, |
| 296 | pip: pip, |
| 297 | venv: venv, |
| 298 | setuptools: setuptools, |
| 299 | uv: uv, |
| 300 | }; |
| 301 | |
| 302 | if (!this.parent) { |
| 303 | // default to projenrc.py if no other projenrc type was elected |
| 304 | if (options.projenrcPython ?? !anySelected(rcFileTypeOptions)) { |
| 305 | new ProjenrcPython(this, { |
| 306 | pythonExec: options.pythonExec, |
| 307 | ...options.projenrcPythonOptions, |
| 308 | }); |
| 309 | } |
| 310 | |
| 311 | if (options.projenrcJs ?? false) { |
| 312 | new ProjenrcJs(this, options.projenrcJsOptions); |
| 313 | } |
nothing calls this directly
no test coverage detected