Skip to content

Commit

Permalink
fix(type-safe-api): add empty README.md to initial install for genera…
Browse files Browse the repository at this point in the history
…ted python projects

The poetry install that runs as part of post synthesis expects there to be some
code present, but code isn't generated until build time. This means that the
first install will fail when either generating the project for the first time or
checking out a fresh copy (since generated code is not checked in to version
control).

To fix this, we add a blank README.md file in addition to the __init__.py file
as the first install step to keep poetry happy until the generator overwrites
it.

Fixes aws#813
  • Loading branch information
jstrunk committed Aug 1, 2024
1 parent 883e782 commit 5219a86
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ export abstract class GeneratedPythonCdkInfrastructureBaseProject extends Python
// The poetry install that runs as part of post synthesis expects there to be some code present, but code isn't
// generated until build time. This means that the first install will fail when either generating the project for
// the first time or checking out a fresh copy (since generated code is not checked in to version control). We
// therefore add a blank __init__.py as our first install step to keep poetry happy until the generator overwrites
// it.
// therefore add a blank __init__.py and README.md as our first install step to keep poetry happy until the
// generator overwrites it.
["install", "install:ci"].forEach((t) =>
this.tasks
.tryFind(t)
?.prependExec(
`mkdir -p ${this.moduleName} && touch ${this.moduleName}/__init__.py`
`mkdir -p ${this.moduleName} && touch ${this.moduleName}/__init__.py README.md`
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ export abstract class GeneratedPythonRuntimeBaseProject extends PythonProject {
// The poetry install that runs as part of post synthesis expects there to be some code present, but code isn't
// generated until build time. This means that the first install will fail when either generating the project for
// the first time or checking out a fresh copy (since generated code is not checked in to version control). We
// therefore add a blank __init__.py as our first install step to keep poetry happy until the generator overwrites
// it.
// therefore add a blank __init__.py and README.md as our first install step to keep poetry happy until the
// generator overwrites it.
["install", "install:ci"].forEach((t) =>
this.tasks
.tryFind(t)
?.prependExec(
`mkdir -p ${this.moduleName} && touch ${this.moduleName}/__init__.py`
`mkdir -p ${this.moduleName} && touch ${this.moduleName}/__init__.py README.md`
)
);
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5219a86

Please sign in to comment.