projen: Projen python version default command fails
Hello, guys, thank you for the awesome tool, the nodejs version works perfectly, however, I’m struggling with the Python binary. Simply installed it globally using pipx install projen
and running projen
, fails with the following error:
➜ ~ projen
Traceback (most recent call last):
File "/Users/victor/.local/bin/projen", line 10, in <module>
__jsii_assembly__.invokeBinScript("projen", "projen", sys.argv[1:])
File "/Users/victor/.local/pipx/venvs/projen/lib/python3.10/site-packages/jsii/_runtime.py", line 52, in invokeBinScript
response = _kernel.invokeBinScript(pkgname, script, args)
File "/Users/victor/.local/pipx/venvs/projen/lib/python3.10/site-packages/jsii/_kernel/__init__.py", line 312, in invokeBinScript
args=_make_reference_for_native(self, args),
File "/Users/victor/.local/pipx/venvs/projen/lib/python3.10/site-packages/jsii/_kernel/__init__.py", line 204, in _make_reference_for_native
kernel.create(d.__class__, d)
File "/Users/victor/.local/pipx/venvs/projen/lib/python3.10/site-packages/jsii/_kernel/__init__.py", line 323, in create
fqn=klass.__jsii_type__ or "Object",
AttributeError: type object 'tuple' has no attribute '__jsii_type__'
I tried py3.8 and py3.10, and encounter the same result. weird that there is no such issue yet, I’m the only one having this error? Thank you for your help.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (19 by maintainers)
Commits related to this issue
- fix(python): bin script python support, test argument passing (#3762) Corrects multiple issues with running `bin` scripts from python. These were discovered in the context of this `projen` issue: ht... — committed to aws/jsii by jmalins 2 years ago
- fix(release): artifact permissions are not preserved in github actions (#2132) Fixes #2103. Due to a bug in GitHub actions, file mode permissions (such as `+x`) are lost between when the build artif... — committed to projen/projen by jmalins 2 years ago
- feat(superchain): add 'acl' package to support projen GHA (#3783) Adds the `acl` package to the superchain image. A recent [projen PR](https://github.com/projen/projen/issues/2103) added a build-tim... — committed to aws/jsii by jmalins 2 years ago
And
pipx run projen new awscdk-app-py
also works! This is great. Good work everyone and especially @jmalins 🥳@jmalins thank you very much, I’m impressed. It works!!
I was encountering the same error. It actually looks like it is tied to this change (line 52): https://github.com/aws/jsii/pull/3694/files#diff-8c3c3ced74aeb038ac90c893f7998ce488d3771561a5d253376f9177bcef707c
The arguments for the python script are not being marshaled correctly.
I corrected it in my locally deployed install, and got to the point of finding another error: a missing
+x
permission onbin/projen
in the JSII tarball bundled with python package. Once that was (manually) fixed, theprojen
executable worked as expected.I’d like to make a PR, but would still need to navigate the source to figure out where the
projen
python script is defined and where the tarball is created.I wholeheartedly agree with this sentiment. Binaries for all languages or a standalone binary should be a long-term goal.
We rely on jsii to provide cross-lang capabilities. I can see that we announce projen as an app, so
pipx
tries to run it. What I’m currently not sure about is if that’s supposed to happen (and we need to fix a bug with running it as an app) or if announcing an app was accidental (and we should stop doing that). If it’s the latter, a long term fix would depend on jsii’s capabilities in that area, or we start shipping a standalone binary.Hi @floydspace ! I’m not actually sure this is supposed to work or even possible to work with jsii.
Background: Projen is a TypeScript project with jsii bindings for Python and other languages so that you can write the configuration in the language of your project (or choice). Due to its nature jsii has limitations and running a cli might just be one of them.
tl;dr the expected way to run projen is still via node:
npx projen
I appreciate we’re probably not doing the best job explaining this in the documentation.