Skip to content

Commit

Permalink
Python: setup imports dir as a package
Browse files Browse the repository at this point in the history
Running `pylint main.py` warns:

```
main.py:4:0: E0611: No name 'aws' in module 'imports' (no-name-in-module)
```

This change gets rid of that warning.
  • Loading branch information
cmclaughlin committed Jul 30, 2020
1 parent fa19d37 commit b4ec993
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/cdktf-cli/lib/get/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ export abstract class GetBase {
private async harvestPython(targetdir: string, targetName: string) {
const target = path.join(targetdir, targetName);
await fs.move(`dist/python/src/${targetName}`, target, { overwrite: true });
// Make the codeMakerOutput dir a Python package for IDEs and linting
fs.writeFileSync(path.join(targetdir, '__init__.py'), '', 'utf-8');
}

protected abstract typesPath(name: string): string;
Expand Down
3 changes: 2 additions & 1 deletion packages/cdktf-cli/templates/python/{{}}.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dist/
imports/
imports/*
!imports/__init__.py
.terraform
cdktf.out
terraform.tfstate*

0 comments on commit b4ec993

Please sign in to comment.