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 (#818)

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 #813
  • Loading branch information
jstrunk authored Aug 6, 2024
1 parent cf73714 commit 9f5d63c
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 @@ -128,13 +128,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 @@ -117,13 +117,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 9f5d63c

Please sign in to comment.