-
Notifications
You must be signed in to change notification settings - Fork 454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python: setup imports dir as a package #262
Conversation
Just having an empty
It'd be either set in |
@skorfmann thanks for the feedback! Yep, adding an empty I was able to pass in Please take another look and let me know what you think. |
Hm, with readConfigSync it should only be the default if not set in |
Guessing |
I double checked... with this change diff --git a/packages/cdktf-cli/bin/cmds/init.ts b/packages/cdktf-cli/bin/cmds/init.ts
index c858054..9f80d01 100644
--- a/packages/cdktf-cli/bin/cmds/init.ts
+++ b/packages/cdktf-cli/bin/cmds/init.ts
@@ -8,6 +8,8 @@ import * as terraformCloudClient from './helper/terraform-cloud-client';
import * as chalk from 'chalk';
import { terraformCheck } from './terraform-check';
import { displayVersionMessage } from './version-check'
+import { readConfigSync } from '../../lib/config';
+
const chalkColour = new chalk.Instance();
@@ -75,9 +77,10 @@ This means that your Terraform state file will be stored locally on disk in a fi
}
const deps: any = await determineDeps(argv.cdktfVersion, argv.dist);
+ const config = readConfigSync();
await sscaff(templateInfo.Path, '.', {
- ...deps, ...projectInfo
+ ...deps, ...projectInfo, ...config
});
}
}
diff --git a/packages/cdktf-cli/templates/python/.hooks.sscaff.js b/packages/cdktf-cli/templates/python/.hooks.sscaff.js
index d4af60b..ef9d801 100644
--- a/packages/cdktf-cli/templates/python/.hooks.sscaff.js
+++ b/packages/cdktf-cli/templates/python/.hooks.sscaff.js
@@ -22,6 +22,8 @@ exports.post = options => {
terraformCloudConfig(options.$base, options.OrganizationName, options.WorkspaceName)
}
+ console.log(options);
+ Which outputs: {
npm_cdktf: 'cdktf@^0.0.1',
npm_cdktf_cli: 'cdktf-cli@^0.0.1',
pypi_cdktf: 'cdktf~=0.0.1',
Name: 'xxx',
Description: 'xxx',
OrganizationName: '',
WorkspaceName: '',
output: 'cdktf.out',
codeMakerOutput: '.gen',
'$base': 'turd5'
} |
Oh yeah, that makes sense when thinking about it. This will be loaded in the CLI before the template is applied. Sorry for the confusion. |
So, after having thought about this again: I think this should be part of the code making process, and not be retrofitted in the template. It'll be much simpler as well, since we have all the context we need at this point. Sorry again for the initial confusion about this. Could you adapt it accordingly? |
041a14d
to
b4ec993
Compare
Thanks for the feedback! I think we're all set... I agree it's much cleaner now. |
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.
aebc5c0
to
34c72ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks 👍
I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Running
pylint main.py
warns:This change gets rid of that warning.