python Submodule
Constructs
Pip
- Implements: IPythonDeps
Manages dependencies using a requirements.txt file and the pip CLI tool.
Initializers
import { python } from 'projen'
new python.Pip(project: Project, _options?: PipOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
_optionsOptional
- Type: PipOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds a runtime dependency. |
| Adds a dev dependency. |
| Installs dependencies (called during post-synthesis). |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addDependency
public addDependency(spec: string): void
Adds a runtime dependency.
specRequired
- Type: string
Format <module>@<semver>.
addDevDependency
public addDevDependency(spec: string): void
Adds a dev dependency.
specRequired
- Type: string
Format <module>@<semver>.
installDependencies
public installDependencies(): void
Installs dependencies (called during post-synthesis).
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { python } from 'projen'
python.Pip.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { python } from 'projen'
python.Pip.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| projen.Task | A task that installs and updates dependencies. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
installCiTaskRequired
public readonly installCiTask: Task;
- Type: projen.Task
A task that installs and updates dependencies.
Poetry
- Implements: IPythonDeps, IPythonEnv, IPythonPackaging
Manage project dependencies, virtual environments, and packaging through the poetry CLI tool.
Initializers
import { python } from 'projen'
new python.Poetry(project: Project, options: PoetryOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsRequired
- Type: PoetryOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds a runtime dependency. |
| Adds a dev dependency. |
| Installs dependencies (called during post-synthesis). |
| Initializes the virtual environment if it doesn't exist (called during post-synthesis). |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addDependency
public addDependency(spec: string): void
Adds a runtime dependency.
specRequired
- Type: string
Format <module>@<semver>.
addDevDependency
public addDevDependency(spec: string): void
Adds a dev dependency.
specRequired
- Type: string
Format <module>@<semver>.
installDependencies
public installDependencies(): void
Installs dependencies (called during post-synthesis).
setupEnvironment
public setupEnvironment(): void
Initializes the virtual environment if it doesn't exist (called during post-synthesis).
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { python } from 'projen'
python.Poetry.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { python } from 'projen'
python.Poetry.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| projen.Task | Task for installing dependencies according to the existing lockfile. |
| projen.Task | Task for updating the lockfile and installing project dependencies. |
| projen.Task | Task for publishing the package to a package repository. |
| projen.Task | Task for publishing the package to the Test PyPI repository for testing purposes. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
installCiTaskRequired
public readonly installCiTask: Task;
- Type: projen.Task
Task for installing dependencies according to the existing lockfile.
installTaskRequired
public readonly installTask: Task;
- Type: projen.Task
Task for updating the lockfile and installing project dependencies.
publishTaskRequired
public readonly publishTask: Task;
- Type: projen.Task
Task for publishing the package to a package repository.
publishTestTaskRequired
public readonly publishTestTask: Task;
- Type: projen.Task
Task for publishing the package to the Test PyPI repository for testing purposes.
PoetryPyproject
Represents configuration of a pyproject.toml file for a Poetry project.
Initializers
import { python } from 'projen'
new python.PoetryPyproject(scope: IConstruct, options: PoetryPyprojectOptions)
| Name | Type | Description |
|---|---|---|
| constructs.IConstruct | No description. |
| | No description. |
scopeRequired
- Type: constructs.IConstruct
optionsRequired
- Type: PoetryPyprojectOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { python } from 'projen'
python.PoetryPyproject.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { python } from 'projen'
python.PoetryPyproject.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| | No description. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
fileRequired
public readonly file: PyprojectTomlFile;
- Type: PyprojectTomlFile
Projenrc
Allows writing projenrc files in python.
This will install projen as a Python dependency and will add a
synth task which will run .projenrc.py.
Initializers
import { python } from 'projen'
new python.Projenrc(project: Project, options?: ProjenrcOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsOptional
- Type: ProjenrcOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
| Returns the Projenrc instance associated with a project or undefined if there is no Projenrc. |
isConstruct
import { python } from 'projen'
python.Projenrc.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { python } from 'projen'
python.Projenrc.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
of
import { python } from 'projen'
python.Projenrc.of(project: Project)
Returns the Projenrc instance associated with a project or undefined if there is no Projenrc.
projectRequired
- Type: projen.Project
The project.
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| string | The name of the projenrc file. |
| string | Path to the python executable to use. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
filePathRequired
public readonly filePath: string;
- Type: string
The name of the projenrc file.
pythonExecRequired
public readonly pythonExec: string;
- Type: string
Path to the python executable to use.
PyprojectTomlFile
Represents configuration of a pyproject.toml file.
https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
Initializers
import { python } from 'projen'
new python.PyprojectTomlFile(scope: IConstruct, config: PyprojectToml)
| Name | Type | Description |
|---|---|---|
| constructs.IConstruct | No description. |
| | No description. |
scopeRequired
- Type: constructs.IConstruct
configRequired
- Type: PyprojectToml
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Writes the file to the project's output directory. |
| Syntactic sugar for addOverride(path, undefined). |
| Adds an override to the synthesized object file. |
| Adds to an array in the synthesized object file. |
| Applies an RFC 6902 JSON-patch to the synthesized object file. See https://datatracker.ietf.org/doc/html/rfc6902 for more information. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Writes the file to the project's output directory.
addDeletionOverride
public addDeletionOverride(path: string): void
Syntactic sugar for addOverride(path, undefined).
pathRequired
- Type: string
The path of the value to delete.
addOverride
public addOverride(path: string, value: any): void
Adds an override to the synthesized object file.
If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal . in the property name, prefix with a \. In most
programming languages you will need to write this as "\\." because the
\ itself will need to be escaped.
For example,
project.tsconfig.file.addOverride('compilerOptions.alwaysStrict', true);
project.tsconfig.file.addOverride('compilerOptions.lib', ['dom', 'dom.iterable', 'esnext']);
would add the overrides
"compilerOptions": {
"alwaysStrict": true,
"lib": [
"dom",
"dom.iterable",
"esnext"
]
...
}
...
pathRequired
- Type: string
The path of the property, you can use dot notation to override values in complex types.
Any intermediate keys will be created as needed.
valueRequired
- Type: any
The value.
Could be primitive or complex.
addToArray
public addToArray(path: string, values: ...any[]): void
Adds to an array in the synthesized object file.
If the array is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal . in the property name, prefix with a \. In most
programming languages you will need to write this as "\\." because the
\ itself will need to be escaped.
For example, with the following object file
"compilerOptions": {
"exclude": ["node_modules"],
"lib": ["es2020"]
...
}
...
project.tsconfig.file.addToArray('compilerOptions.exclude', 'coverage');
project.tsconfig.file.addToArray('compilerOptions.lib', 'dom', 'dom.iterable', 'esnext');
would result in the following object file
"compilerOptions": {
"exclude": ["node_modules", "coverage"],
"lib": ["es2020", "dom", "dom.iterable", "esnext"]
...
}
...
pathRequired
- Type: string
The path of the property, you can use dot notation to att to arrays in complex types.
Any intermediate keys will be created as needed.
valuesRequired
- Type: ...any[]
The values to add.
Could be primitive or complex.
patch
public patch(patches: ...JsonPatch[]): void
Applies an RFC 6902 JSON-patch to the synthesized object file. See https://datatracker.ietf.org/doc/html/rfc6902 for more information.
For example, with the following object file
"compilerOptions": {
"exclude": ["node_modules"],
"lib": ["es2020"]
...
}
...
project.tsconfig.file.patch(JsonPatch.add("/compilerOptions/exclude/-", "coverage"));
project.tsconfig.file.patch(JsonPatch.replace("/compilerOptions/lib", ["dom", "dom.iterable", "esnext"]));
would result in the following object file
"compilerOptions": {
"exclude": ["node_modules", "coverage"],
"lib": ["dom", "dom.iterable", "esnext"]
...
}
...
patchesRequired
- Type: ...projen.JsonPatch[]
The patch operations to apply.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { python } from 'projen'
python.PyprojectTomlFile.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { python } from 'projen'
python.PyprojectTomlFile.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| string | The absolute path of this file. |
| string | The file path, relative to the project's outdir. |
| boolean | Indicates if the file has been changed during synthesis. |
| string | The projen marker, used to identify files as projen-generated. |
| boolean | Indicates if the file should be marked as executable. |
| boolean | Indicates if the file should be read-only or read-write. |
| boolean | Indicates if empty objects and arrays are omitted from the output object. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
absolutePathRequired
public readonly absolutePath: string;
- Type: string
The absolute path of this file.
pathRequired
public readonly path: string;
- Type: string
The file path, relative to the project's outdir.
changedOptional
public readonly changed: boolean;
- Type: boolean
Indicates if the file has been changed during synthesis.
This property is
only available in postSynthesize() hooks. If this is undefined, the
file has not been synthesized yet.
markerOptional
public readonly marker: string;
- Type: string
The projen marker, used to identify files as projen-generated.
Value is undefined if the project is being ejected.
executableRequired
public readonly executable: boolean;
- Type: boolean
Indicates if the file should be marked as executable.
readonlyRequired
public readonly readonly: boolean;
- Type: boolean
Indicates if the file should be read-only or read-write.
omitEmptyRequired
public readonly omitEmpty: boolean;
- Type: boolean
Indicates if empty objects and arrays are omitted from the output object.
Pytest
Initializers
import { python } from 'projen'
new python.Pytest(project: Project, options?: PytestOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsOptional
- Type: PytestOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { python } from 'projen'
python.Pytest.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { python } from 'projen'
python.Pytest.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| string | No description. |
| string[] | No description. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
testdirRequired
testdir- Deprecated: Use
sampleTestdiron the project instead.
public readonly testdir: string;
- Type: string
testMatchRequired
public readonly testMatch: string[];
- Type: string[]
PytestSample
Python test code sample.
Initializers
import { python } from 'projen'
new python.PytestSample(project: Project, options: PytestSampleOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsRequired
- Type: PytestSampleOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { python } from 'projen'
python.PytestSample.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { python } from 'projen'
python.PytestSample.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
PythonProject
Python project.
Initializers
import { python } from 'projen'
new python.PythonProject(options: PythonProjectOptions)
| Name | Type | Description |
|---|---|---|
| | No description. |
optionsRequired
- Type: PythonProjectOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Exclude the matching files from pre-synth cleanup. |
| Adds a .gitignore pattern. |
| Exclude these files from the bundled package. |
| Adds a new task to this project. |
| Prints a "tip" message during synthesis. |
| Marks the provided file(s) as being generated. |
| Called after all components are synthesized. |
| Called before all components are synthesized. |
| Removes a task from a project. |
| Returns the shell command to execute in order to run a task. |
| Synthesize all project files into outdir. |
| Finds a file at the specified relative path within this project and all its subprojects. |
| Finds a json file by name. |
| Finds an object file (like JsonFile, YamlFile, etc.) by name. |
| Finds a file at the specified relative path within this project and removes it. |
| Adds a runtime dependency. |
| Adds a dev dependency. |
toString
public toString(): string
Returns a string representation of this construct.
addExcludeFromCleanup
public addExcludeFromCleanup(globs: ...string[]): void
Exclude the matching files from pre-synth cleanup.
Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.
globsRequired
- Type: ...string[]
The glob patterns to match.
addGitIgnore
public addGitIgnore(pattern: string): void
Adds a .gitignore pattern.
patternRequired
- Type: string
The glob pattern to ignore.
addPackageIgnore
public addPackageIgnore(_pattern: string): void
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject delegates this to .npmignore.
_patternRequired
- Type: string
The glob pattern to exclude.
addTask
public addTask(name: string, props?: TaskOptions): Task
Adds a new task to this project.
This will fail if the project already has a task with this name.
nameRequired
- Type: string
The task name to add.
propsOptional
- Type: projen.TaskOptions
Task properties.
addTip
addTippublic addTip(message: string): void
Prints a "tip" message during synthesis.
messageRequired
- Type: string
The message.
annotateGenerated
public annotateGenerated(glob: string): void
Marks the provided file(s) as being generated.
This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.
https://github.com/github/linguist/blob/master/docs/overrides.md
globRequired
- Type: string
the glob pattern to match (could be a file path).
postSynthesize
public postSynthesize(): void
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before all components are synthesized.
removeTask
public removeTask(name: string): Task
Removes a task from a project.
nameRequired
- Type: string
The name of the task to remove.
runTaskCommand
public runTaskCommand(task: Task): string
Returns the shell command to execute in order to run a task.
By default, this is npx projen@<version> <task>
taskRequired
- Type: projen.Task
The task for which the command is required.
synth
public synth(): void
Synthesize all project files into outdir.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and all its subprojects.
filePathRequired
- Type: string
The file path.
If this path is relative, it will be resolved from the root of this project.
tryFindJsonFile
tryFindJsonFilepublic tryFindJsonFile(filePath: string): JsonFile
Finds a json file by name.
filePathRequired
- Type: string
The file path.
tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePathRequired
- Type: string
The file path.
tryRemoveFile
public tryRemoveFile(filePath: string): FileBase
Finds a file at the specified relative path within this project and removes it.
filePathRequired
- Type: string
The file path.
If this path is relative, it will be resolved from the root of this project.
addDependency
public addDependency(spec: string): void
Adds a runtime dependency.
specRequired
- Type: string
Format <module>@<semver>.
addDevDependency
public addDevDependency(spec: string): void
Adds a dev dependency.
specRequired
- Type: string
Format <module>@<semver>.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a project. |
| Find the closest ancestor project for given construct. |
isConstruct
import { python } from 'projen'
python.PythonProject.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isProject
import { python } from 'projen'
python.PythonProject.isProject(x: any)
Test whether the given construct is a project.
xRequired
- Type: any
of
import { python } from 'projen'
python.PythonProject.of(construct: IConstruct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
constructRequired
- Type: constructs.IConstruct
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Task | No description. |
| boolean | Whether to commit the managed files by default. |
| projen.Task | No description. |
| projen.Component[] | Returns all the components within this project. |
| projen.Dependencies | Project dependencies. |
| boolean | Whether or not the project is being ejected. |
| projen.FileBase[] | All files in this project. |
| projen.GitAttributesFile | The .gitattributes file for this repository. |
| projen.IgnoreFile | .gitignore. |
| projen.Logger | Logging utilities. |
| string | Project name. |
| string | Absolute output directory of this project. |
| projen.Task | No description. |
| projen.Task | No description. |
| projen.Task | No description. |
| projen.ProjectBuild | Manages the build process of the project. |
| string | The command to use in order to run the projen CLI. |
| projen.Project | The root project. |
| projen.Project[] | Returns all the subprojects within this project. |
| projen.Tasks | Project tasks. |
| projen.Task | No description. |
| projen.Task | This is the "default" task, the one that executes "projen". |
| projen.InitProject | The options used when this project is bootstrapped via projen new. |
| projen.Project | A parent project. |
| projen.ProjectType | No description. |
| projen.github.AutoApprove | Auto approve set up for this project. |
| projen.vscode.DevContainer | Access for .devcontainer.json (used for GitHub Codespaces). |
| projen.github.GitHub | Access all github components. |
| projen.Gitpod | Access for Gitpod. |
| projen.vscode.VsCode | Access all VSCode components. |
| | API for managing dependencies. |
| | API for managing the Python runtime environment. |
| string | Python module name (the project name, with any hyphens or periods replaced with underscores). |
| string | Directory where sample tests are located. |
| string | Version of the package for distribution (should follow semver). |
| | API for managing packaging the project as a library. |
| | Pytest component. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
buildTaskRequired
public readonly buildTask: Task;
- Type: projen.Task
commitGeneratedRequired
public readonly commitGenerated: boolean;
- Type: boolean
Whether to commit the managed files by default.
compileTaskRequired
public readonly compileTask: Task;
- Type: projen.Task
componentsRequired
public readonly components: Component[];
- Type: projen.Component[]
Returns all the components within this project.
depsRequired
public readonly deps: Dependencies;
- Type: projen.Dependencies
Project dependencies.
ejectedRequired
public readonly ejected: boolean;
- Type: boolean
Whether or not the project is being ejected.
filesRequired
public readonly files: FileBase[];
- Type: projen.FileBase[]
All files in this project.
gitattributesRequired
public readonly gitattributes: GitAttributesFile;
- Type: projen.GitAttributesFile
The .gitattributes file for this repository.
gitignoreRequired
public readonly gitignore: IgnoreFile;
- Type: projen.IgnoreFile
.gitignore.
loggerRequired
public readonly logger: Logger;
- Type: projen.Logger
Logging utilities.
nameRequired
public readonly name: string;
- Type: string
Project name.
outdirRequired
public readonly outdir: string;
- Type: string
Absolute output directory of this project.
packageTaskRequired
public readonly packageTask: Task;
- Type: projen.Task
postCompileTaskRequired
public readonly postCompileTask: Task;
- Type: projen.Task
preCompileTaskRequired
public readonly preCompileTask: Task;
- Type: projen.Task
projectBuildRequired
public readonly projectBuild: ProjectBuild;
- Type: projen.ProjectBuild
Manages the build process of the project.
projenCommandRequired
public readonly projenCommand: string;
- Type: string
The command to use in order to run the projen CLI.
rootRequired
public readonly root: Project;
- Type: projen.Project
The root project.
subprojectsRequired
public readonly subprojects: Project[];
- Type: projen.Project[]
Returns all the subprojects within this project.
tasksRequired
public readonly tasks: Tasks;
- Type: projen.Tasks
Project tasks.
testTaskRequired
public readonly testTask: Task;
- Type: projen.Task
defaultTaskOptional
public readonly defaultTask: Task;
- Type: projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
initProjectOptional
public readonly initProject: InitProject;
- Type: projen.InitProject
The options used when this project is bootstrapped via projen new.
It includes the original set of options passed to the CLI and also the JSII FQN of the project type.
parentOptional
public readonly parent: Project;
- Type: projen.Project
A parent project.
If undefined, this is the root project.
projectTypeRequired
public readonly projectType: ProjectType;
- Type: projen.ProjectType
autoApproveOptional
public readonly autoApprove: AutoApprove;
- Type: projen.github.AutoApprove
Auto approve set up for this project.
devContainerOptional
public readonly devContainer: DevContainer;
- Type: projen.vscode.DevContainer
Access for .devcontainer.json (used for GitHub Codespaces).
This will be undefined if devContainer boolean is false
githubOptional
public readonly github: GitHub;
- Type: projen.github.GitHub
Access all github components.
This will be undefined for subprojects.
gitpodOptional
public readonly gitpod: Gitpod;
- Type: projen.Gitpod
Access for Gitpod.
This will be undefined if gitpod boolean is false
vscodeOptional
public readonly vscode: VsCode;
- Type: projen.vscode.VsCode
Access all VSCode components.
This will be undefined for subprojects.
depsManagerRequired
public readonly depsManager: IPythonDeps;
- Type: IPythonDeps
API for managing dependencies.
envManagerRequired
public readonly envManager: IPythonEnv;
- Type: IPythonEnv
API for managing the Python runtime environment.
moduleNameRequired
public readonly moduleName: string;
- Type: string
Python module name (the project name, with any hyphens or periods replaced with underscores).
sampleTestdirRequired
public readonly sampleTestdir: string;
- Type: string
- Default: "tests"
Directory where sample tests are located.
versionRequired
public readonly version: string;
- Type: string
Version of the package for distribution (should follow semver).
packagingManagerOptional
public readonly packagingManager: IPythonPackaging;
- Type: IPythonPackaging
API for managing packaging the project as a library.
Only applies when the projectType is LIB.
pytestOptional
public readonly pytest: Pytest;
- Type: Pytest
Pytest component.
Constants
| Name | Type | Description |
|---|---|---|
| string | The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
- Type: string
The name of the default task (the task executed when projen is run without arguments).
Normally this task should synthesize the project files.
PythonSample
Python code sample.
Initializers
import { python } from 'projen'
new python.PythonSample(project: Project, options: PythonSampleOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsRequired
- Type: PythonSampleOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { python } from 'projen'
python.PythonSample.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { python } from 'projen'
python.PythonSample.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
RequirementsFile
Specifies a list of packages to be installed using pip.
https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format
Initializers
import { python } from 'projen'
new python.RequirementsFile(project: Project, filePath: string, options: RequirementsFileOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| string | No description. |
| | No description. |
projectRequired
- Type: projen.Project
filePathRequired
- Type: string
optionsRequired
- Type: RequirementsFileOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Writes the file to the project's output directory. |
| Adds the specified packages provided in semver format. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Writes the file to the project's output directory.
addPackages
public addPackages(packages: ...string[]): void
Adds the specified packages provided in semver format.
Comment lines (start with #) are ignored.
packagesRequired
- Type: ...string[]
Package version in format <module>@<semver>.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { python } from 'projen'
python.RequirementsFile.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { python } from 'projen'
python.RequirementsFile.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| string | The absolute path of this file. |
| string | The file path, relative to the project's outdir. |
| boolean | Indicates if the file has been changed during synthesis. |
| string | The projen marker, used to identify files as projen-generated. |
| boolean | Indicates if the file should be marked as executable. |
| boolean | Indicates if the file should be read-only or read-write. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
absolutePathRequired
public readonly absolutePath: string;
- Type: string
The absolute path of this file.
pathRequired
public readonly path: string;
- Type: string
The file path, relative to the project's outdir.
changedOptional
public readonly changed: boolean;
- Type: boolean
Indicates if the file has been changed during synthesis.
This property is
only available in postSynthesize() hooks. If this is undefined, the
file has not been synthesized yet.
markerOptional
public readonly marker: string;
- Type: string
The projen marker, used to identify files as projen-generated.
Value is undefined if the project is being ejected.
executableRequired
public readonly executable: boolean;
- Type: boolean
Indicates if the file should be marked as executable.
readonlyRequired
public readonly readonly: boolean;
- Type: boolean
Indicates if the file should be read-only or read-write.
SetupPy
Python packaging script where package metadata can be placed.
Initializers
import { python } from 'projen'
new python.SetupPy(project: Project, options: SetupPyOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsRequired
- Type: SetupPyOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Writes the file to the project's output directory. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Writes the file to the project's output directory.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { python } from 'projen'
python.SetupPy.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { python } from 'projen'
python.SetupPy.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| string | The absolute path of this file. |
| string | The file path, relative to the project's outdir. |
| boolean | Indicates if the file has been changed during synthesis. |
| string | The projen marker, used to identify files as projen-generated. |
| boolean | Indicates if the file should be marked as executable. |
| boolean | Indicates if the file should be read-only or read-write. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
absolutePathRequired
public readonly absolutePath: string;
- Type: string
The absolute path of this file.
pathRequired
public readonly path: string;
- Type: string
The file path, relative to the project's outdir.
changedOptional
public readonly changed: boolean;
- Type: boolean
Indicates if the file has been changed during synthesis.
This property is
only available in postSynthesize() hooks. If this is undefined, the
file has not been synthesized yet.
markerOptional
public readonly marker: string;
- Type: string
The projen marker, used to identify files as projen-generated.
Value is undefined if the project is being ejected.
executableRequired
public readonly executable: boolean;
- Type: boolean
Indicates if the file should be marked as executable.
readonlyRequired
public readonly readonly: boolean;
- Type: boolean
Indicates if the file should be read-only or read-write.
Setuptools
- Implements: IPythonPackaging
Manages packaging through setuptools with a setup.py script.
Initializers
import { python } from 'projen'
new python.Setuptools(project: Project, options: SetuptoolsOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsRequired
- Type: SetuptoolsOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { python } from 'projen'
python.Setuptools.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { python } from 'projen'
python.Setuptools.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| projen.Task | A task that uploads the package to a package repository. |
| projen.Task | A task that uploads the package to the Test PyPI repository. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
publishTaskRequired
public readonly publishTask: Task;
- Type: projen.Task
A task that uploads the package to a package repository.
publishTestTaskRequired
public readonly publishTestTask: Task;
- Type: projen.Task
A task that uploads the package to the Test PyPI repository.
Uv
- Implements: IPythonDeps, IPythonEnv, IPythonPackaging
Manage project dependencies, virtual environments, and packaging through uv.
Initializers
import { python } from 'projen'
new python.Uv(scope: IConstruct, options: UvOptions)
| Name | Type | Description |
|---|---|---|
| constructs.IConstruct | No description. |
| | No description. |
scopeRequired
- Type: constructs.IConstruct
optionsRequired
- Type: UvOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds a runtime dependency. |
| Adds a dev dependency. |
| Installs dependencies (called during post-synthesis). |
| Initializes the virtual environment if it doesn't exist (called during post-synthesis). |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
addDependency
public addDependency(spec: string): void
Adds a runtime dependency.
specRequired
- Type: string
addDevDependency
public addDevDependency(spec: string): void
Adds a dev dependency.
specRequired
- Type: string
installDependencies
public installDependencies(): void
Installs dependencies (called during post-synthesis).
setupEnvironment
public setupEnvironment(): void
Initializes the virtual environment if it doesn't exist (called during post-synthesis).
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { python } from 'projen'
python.Uv.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { python } from 'projen'
python.Uv.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| | The pyproject.toml file. |
| projen.Task | A task that installs and updates dependencies. |
| projen.Task | No description. |
| projen.Task | A task that uploads the package to a package repository. |
| projen.Task | No description. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
fileRequired
public readonly file: PyprojectTomlFile;
- Type: PyprojectTomlFile
The pyproject.toml file.
installCiTaskRequired
public readonly installCiTask: Task;
- Type: projen.Task
A task that installs and updates dependencies.
installTaskRequired
public readonly installTask: Task;
- Type: projen.Task
publishTaskRequired
public readonly publishTask: Task;
- Type: projen.Task
A task that uploads the package to a package repository.
publishTestTaskRequired
public readonly publishTestTask: Task;
- Type: projen.Task
Venv
- Implements: IPythonEnv
Manages a virtual environment through the Python venv module.
Initializers
import { python } from 'projen'
new python.Venv(project: Project, options?: VenvOptions)
| Name | Type | Description |
|---|---|---|
| projen.Project | No description. |
| | No description. |
projectRequired
- Type: projen.Project
optionsOptional
- Type: VenvOptions
Methods
| Name | Description |
|---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Initializes the virtual environment if it doesn't exist (called during post-synthesis). |
toString
public toString(): string
Returns a string representation of this construct.
postSynthesize
public postSynthesize(): void
Called after synthesis.
Order is not guaranteed.
preSynthesize
public preSynthesize(): void
Called before synthesis.
synthesize
public synthesize(): void
Synthesizes files to the project output directory.
setupEnvironment
public setupEnvironment(): void
Initializes the virtual environment if it doesn't exist (called during post-synthesis).
Static Functions
| Name | Description |
|---|---|
| Checks if x is a construct. |
| Test whether the given construct is a component. |
isConstruct
import { python } from 'projen'
python.Venv.isConstruct(x: any)
Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
xRequired
- Type: any
Any object.
isComponent
import { python } from 'projen'
python.Venv.isComponent(x: any)
Test whether the given construct is a component.
xRequired
- Type: any
Properties
| Name | Type | Description |
|---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
nodeRequired
public readonly node: Node;
- Type: constructs.Node
The tree node.
projectRequired
public readonly project: Project;
- Type: projen.Project
Structs
BuildSystem
Declares any Python level dependencies that must be installed in order to run the project’s build system successfully.
Initializer
import { python } from 'projen'
const buildSystem: python.BuildSystem = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | List of strings following the version specifier specification, representing dependencies required to execute the build system. |
| string[] | list of directories to prepend to sys.path when loading the build backend, relative to project root. |
| string | String is formatted following the same module:object syntax as a setuptools entry point. |
requiresRequired
public readonly requires: string[];
- Type: string[]
List of strings following the version specifier specification, representing dependencies required to execute the build system.
backendPathOptional
public readonly backendPath: string[];
- Type: string[]
list of directories to prepend to sys.path when loading the build backend, relative to project root.
buildBackendOptional
public readonly buildBackend: string;
- Type: string
String is formatted following the same module:object syntax as a setuptools entry point.
It’s also legal to leave out the :object part.
PipOptions
Options for pip.
Initializer
import { python } from 'projen'
const pipOptions: python.PipOptions = { ... }
PoetryOptions
Initializer
import { python } from 'projen'
const poetryOptions: python.PoetryOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | Author's e-mail. |
| string | Author's name. |
| string | Version of the package. |
| string[] | A list of PyPI trove classifiers that describe the project. |
| string | A short description of the package. |
| string | A URL to the website of the project. |
| string | License of this package as an SPDX identifier. |
| string | Package name. |
| | Additional options to set for poetry if using poetry. |
| {[ key: string ]: any} | Additional fields to pass in the setup() function if using setuptools. |
| | Additional options to set for uv if using uv. |
| string | Path to the python executable to use. |
authorEmailRequired
public readonly authorEmail: string;
- Type: string
- Default: $GIT_USER_EMAIL
Author's e-mail.
authorNameRequired
public readonly authorName: string;
- Type: string
- Default: $GIT_USER_NAME
Author's name.
versionRequired
public readonly version: string;
- Type: string
- Default: "0.1.0"
Version of the package.
classifiersOptional
public readonly classifiers: string[];
- Type: string[]
A list of PyPI trove classifiers that describe the project.
descriptionOptional
public readonly description: string;
- Type: string
A short description of the package.
homepageOptional
public readonly homepage: string;
- Type: string
A URL to the website of the project.
licenseOptional
public readonly license: string;
- Type: string
License of this package as an SPDX identifier.
packageNameOptional
public readonly packageName: string;
- Type: string
Package name.
poetryOptionsOptional
public readonly poetryOptions: PoetryPyprojectOptionsWithoutDeps;
Additional options to set for poetry if using poetry.
setupConfigOptional
public readonly setupConfig: {[ key: string ]: any};
- Type: {[ key: string ]: any}
Additional fields to pass in the setup() function if using setuptools.
uvOptionsOptional
public readonly uvOptions: UvOptions;
- Type: UvOptions
Additional options to set for uv if using uv.
pythonExecOptional
public readonly pythonExec: string;
- Type: string
- Default: "python"
Path to the python executable to use.
PoetryPyprojectOptions
Poetry-specific options.
Initializer
import { python } from 'projen'
const poetryPyprojectOptions: python.PoetryPyprojectOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | The authors of the package. |
| string[] | A list of PyPI trove classifiers that describe the project. |
| string | A short description of the package (required). |
| string | A URL to the documentation of the project. |
| string[] | A list of patterns that will be excluded in the final package. |
| {[ key: string ]: string[]} | Package extras. |
| string | A URL to the website of the project. |
| string[] | A list of patterns that will be included in the final package. |
| string[] | A list of keywords (max: 5) that the package is related to. |
| string | License of this package as an SPDX identifier. |
| string[] | the maintainers of the package. |
| string | Name of the package (required). |
| boolean | Package mode (optional). |
| any[] | A list of packages and modules to include in the final distribution. |
| any | Plugins. |
| string | The name of the readme file of the package. |
| string | A URL to the repository of the project. |
| {[ key: string ]: any} | The scripts or executables that will be installed when installing the package. |
| any[] | Source registries from which packages are retrieved. |
| {[ key: string ]: string} | Project custom URLs, in addition to homepage, repository and documentation. |
| string | Version of the package (required). |
| {[ key: string ]: any} | A list of dependencies for the project. |
| {[ key: string ]: any} | A list of development dependencies for the project. |
authorsOptional
public readonly authors: string[];
- Type: string[]
The authors of the package.
Must be in the form "name
classifiersOptional
public readonly classifiers: string[];
- Type: string[]
A list of PyPI trove classifiers that describe the project.
descriptionOptional
public readonly description: string;
- Type: string
A short description of the package (required).
documentationOptional
public readonly documentation: string;
- Type: string
A URL to the documentation of the project.
excludeOptional
public readonly exclude: string[];
- Type: string[]
A list of patterns that will be excluded in the final package.
If a VCS is being used for a package, the exclude field will be seeded with the VCS’ ignore settings (.gitignore for git for example).
extrasOptional
public readonly extras: {[ key: string ]: string[]};
- Type: {[ key: string ]: string[]}
Package extras.
homepageOptional
public readonly homepage: string;
- Type: string
A URL to the website of the project.
includeOptional
public readonly include: string[];
- Type: string[]
A list of patterns that will be included in the final package.
keywordsOptional
public readonly keywords: string[];
- Type: string[]
A list of keywords (max: 5) that the package is related to.
licenseOptional
public readonly license: string;
- Type: string
License of this package as an SPDX identifier.
If the project is proprietary and does not use a specific license, you can set this value as "Proprietary".
maintainersOptional
public readonly maintainers: string[];
- Type: string[]
the maintainers of the package.
Must be in the form "name
nameOptional
public readonly name: string;
- Type: string
Name of the package (required).
packageModeOptional
public readonly packageMode: boolean;
- Type: boolean
- Default: true
Package mode (optional).
Example
false
packagesOptional
public readonly packages: any[];
- Type: any[]
A list of packages and modules to include in the final distribution.
pluginsOptional
public readonly plugins: any;
- Type: any
Plugins.
Must be specified as a table.
readmeOptional
public readonly readme: string;
- Type: string
The name of the readme file of the package.
repositoryOptional
public readonly repository: string;
- Type: string
A URL to the repository of the project.
scriptsOptional
public readonly scripts: {[ key: string ]: any};
- Type: {[ key: string ]: any}
The scripts or executables that will be installed when installing the package.
sourceOptional
public readonly source: any[];
- Type: any[]
Source registries from which packages are retrieved.
urlsOptional
public readonly urls: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Project custom URLs, in addition to homepage, repository and documentation.
E.g. "Bug Tracker"
versionOptional
public readonly version: string;
- Type: string
Version of the package (required).
dependenciesOptional
public readonly dependencies: {[ key: string ]: any};
- Type: {[ key: string ]: any}
A list of dependencies for the project.
The python version for which your package is compatible is also required.
Example
{ requests: "^2.13.0" }
devDependenciesOptional
public readonly devDependencies: {[ key: string ]: any};
- Type: {[ key: string ]: any}
A list of development dependencies for the project.
Example
{ requests: "^2.13.0" }
PoetryPyprojectOptionsWithoutDeps
Poetry-specific options.
Initializer
import { python } from 'projen'
const poetryPyprojectOptionsWithoutDeps: python.PoetryPyprojectOptionsWithoutDeps = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string[] | The authors of the package. |
| string[] | A list of PyPI trove classifiers that describe the project. |
| string | A short description of the package (required). |
| string | A URL to the documentation of the project. |
| string[] | A list of patterns that will be excluded in the final package. |
| {[ key: string ]: string[]} | Package extras. |
| string | A URL to the website of the project. |
| string[] | A list of patterns that will be included in the final package. |
| string[] | A list of keywords (max: 5) that the package is related to. |
| string | License of this package as an SPDX identifier. |
| string[] | the maintainers of the package. |
| string | Name of the package (required). |
| boolean | Package mode (optional). |
| any[] | A list of packages and modules to include in the final distribution. |
| any | Plugins. |
| string | The name of the readme file of the package. |
| string | A URL to the repository of the project. |
| {[ key: string ]: any} | The scripts or executables that will be installed when installing the package. |
| any[] | Source registries from which packages are retrieved. |
| {[ key: string ]: string} | Project custom URLs, in addition to homepage, repository and documentation. |
| string | Version of the package (required). |
authorsOptional
public readonly authors: string[];
- Type: string[]
The authors of the package.
Must be in the form "name
classifiersOptional
public readonly classifiers: string[];
- Type: string[]
A list of PyPI trove classifiers that describe the project.
descriptionOptional
public readonly description: string;
- Type: string
A short description of the package (required).
documentationOptional
public readonly documentation: string;
- Type: string
A URL to the documentation of the project.
excludeOptional
public readonly exclude: string[];
- Type: string[]
A list of patterns that will be excluded in the final package.
If a VCS is being used for a package, the exclude field will be seeded with the VCS’ ignore settings (.gitignore for git for example).
extrasOptional
public readonly extras: {[ key: string ]: string[]};
- Type: {[ key: string ]: string[]}
Package extras.
homepageOptional
public readonly homepage: string;
- Type: string
A URL to the website of the project.
includeOptional
public readonly include: string[];
- Type: string[]
A list of patterns that will be included in the final package.
keywordsOptional
public readonly keywords: string[];
- Type: string[]
A list of keywords (max: 5) that the package is related to.
licenseOptional
public readonly license: string;
- Type: string
License of this package as an SPDX identifier.
If the project is proprietary and does not use a specific license, you can set this value as "Proprietary".
maintainersOptional
public readonly maintainers: string[];
- Type: string[]
the maintainers of the package.
Must be in the form "name
nameOptional
public readonly name: string;
- Type: string
Name of the package (required).
packageModeOptional
public readonly packageMode: boolean;
- Type: boolean
- Default: true
Package mode (optional).
Example
false
packagesOptional
public readonly packages: any[];
- Type: any[]
A list of packages and modules to include in the final distribution.
pluginsOptional
public readonly plugins: any;
- Type: any
Plugins.
Must be specified as a table.
readmeOptional
public readonly readme: string;
- Type: string
The name of the readme file of the package.
repositoryOptional
public readonly repository: string;
- Type: string
A URL to the repository of the project.
scriptsOptional
public readonly scripts: {[ key: string ]: any};
- Type: {[ key: string ]: any}
The scripts or executables that will be installed when installing the package.
sourceOptional
public readonly source: any[];
- Type: any[]
Source registries from which packages are retrieved.
urlsOptional
public readonly urls: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Project custom URLs, in addition to homepage, repository and documentation.
E.g. "Bug Tracker"
versionOptional
public readonly version: string;
- Type: string
Version of the package (required).
ProjectAuthor
Initializer
import { python } from 'projen'
const projectAuthor: python.ProjectAuthor = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | No description. |
| string | No description. |
emailOptional
public readonly email: string;
- Type: string
nameOptional
public readonly name: string;
- Type: string
ProjenrcOptions
Options for Projenrc.
Initializer
import { python } from 'projen'
const projenrcOptions: python.ProjenrcOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | The name of the projenrc file. |
| string | The projen version to use. |
| string | Path to the python executable to use. |
filenameOptional
public readonly filename: string;
- Type: string
- Default: ".projenrc.py"
The name of the projenrc file.
projenVersionOptional
public readonly projenVersion: string;
- Type: string
- Default: current version
The projen version to use.
pythonExecOptional
public readonly pythonExec: string;
- Type: string
- Default: "python"
Path to the python executable to use.
PyprojectToml
Initializer
import { python } from 'projen'
const pyprojectToml: python.PyprojectToml = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| | No description. |
| | Named groups of dependencies, similar to requirements.txt files, which launchers, IDEs, and other tools can find and identify by name. Each item in [dependency-groups] is defined as mapping of group name to list of dependency specifiers. |
| | There are two kinds of metadata: static and dynamic. |
| | Every tool that is used by the project can have users specify configuration data as long as they use a sub-table within [tool]. |
buildSystemOptional
public readonly buildSystem: BuildSystem;
- Type: BuildSystem
dependencyGroupsOptional
public readonly dependencyGroups: PyprojectTomlDependencyGroups;
Named groups of dependencies, similar to requirements.txt files, which launchers, IDEs, and other tools can find and identify by name. Each item in [dependency-groups] is defined as mapping of group name to list of dependency specifiers.
projectOptional
public readonly project: PyprojectTomlProject;
- Type: PyprojectTomlProject
There are two kinds of metadata: static and dynamic.
Static metadata is listed in the [project] table directly and cannot be specified or changed by a tool.
- Dynamic metadata key names are listed inside the
dynamickey and represents metadata that a tool will later provide.
toolOptional
public readonly tool: PyprojectTomlTool;
- Type: PyprojectTomlTool
Every tool that is used by the project can have users specify configuration data as long as they use a sub-table within [tool].
Generally a project can use the subtable tool.$NAME if, and only if, they own the entry for $NAME in the Cheeseshop/PyPI.
PyprojectTomlDependencyGroups
Named groups of dependencies, similar to requirements.txt files, which launchers, IDEs, and other tools can find and identify by name. Each item in [dependency-groups] is defined as mapping of group name to list of dependency specifiers.
Initializer
import { python } from 'projen'
const pyprojectTomlDependencyGroups: python.PyprojectTomlDependencyGroups = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| any[] | No description. |
devOptional
public readonly dev: any[];
- Type: any[]
PyprojectTomlProject
There are two kinds of metadata: static and dynamic.
Static metadata is listed in the [project] table directly and cannot be specified or changed by a tool.
- Dynamic metadata key names are listed inside the
dynamickey and represents metadata that a tool will later provide.
Initializer
import { python } from 'projen'
const pyprojectTomlProject: python.PyprojectTomlProject = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | Valid name consists only of ASCII letters and numbers, period, underscore and hyphen. |
| | People or organizations considered as 'authors' of the project. |
| string[] | List of Trove classifiers that describe the project. PyPI use the classifiers to categorize projects. |
| string[] | An array of dependency specifier strings, each representing a mandatory dependent package of the project. |
| string | Summary description of the project in one line. |
| | Specifies which keys are intentionally unspecified under [project] table so build backend can/will provide such metadata dynamically. |
| any | Extra entry point groups that allow applications to load plugins. For example, Pygments (a syntax highlighting tool) can use additional styles from separately installed packages through [project.entry-points."pygments.styles"]. Each key is the name of the entry-point group, and each value is a table of entry points. |
| {[ key: string ]: string} | Table of entry points that allows package installers to create a GUI wrapper for. Each key is the name of the script to be created, and each value is the function or object to all, in form of either importable.module or importable.module:object.attr. Windows platform treats gui_scripts specially in that they are wrapped in a GUI executable, so they can be started without a console, but cannot use standard streams unless application code redirects them. |
| string[] | An array of strings specifying the import names that the project exclusively provides when installed. |
| string[] | An array of strings specifying the import names that the project provides when installed, but not exclusively. |
| string[] | List of keywords or tags that describe the project. |
| any | For now it is a table with either: - file key specifying a relative path to a license file, or - text key containing full license content. |
| string[] | Relative paths or globs to paths of license files. |
| | People or organizations considered as 'maintainers' of the project. |
| any | Each entry is a key/value pair, with the key specifying extra feature name (such as socks in requests[socks]), and value is an array of dependency specifier strings. |
| any | Value can be a relative path to text / markdown (.md suffix) / reStructuredText (.rst suffix) readme file, or a table with either: - file key containing path of aforementioned readme file, or - text key containing the full readme text embedded inside pyproject.toml. |
| string | Specifies the Python version(s) that the distribution is compatible with. |
| {[ key: string ]: string} | Table of entry points that allows package installers to create a command-line wrapper for. Each key is the name of the script to be created, and each value is the function or object to all, in form of either importable.module or importable.module:object.attr. Windows platform treats console_scripts specially in that they are wrapped in a console executable, so they are attached to a console and can use sys.stdin, sys.stdout and sys.stderr for I/O. |
| {[ key: string ]: string} | Table consisting one or multiple label: URL pairs. |
| string | Version of the project, as defined in the Version specifier specification, and preferably already normalized. |
nameRequired
public readonly name: string;
- Type: string
Valid name consists only of ASCII letters and numbers, period, underscore and hyphen.
It must start and end with a letter or number.
authorsOptional
public readonly authors: ProjectAuthor[];
- Type: ProjectAuthor[]
People or organizations considered as 'authors' of the project.
Each author is a table with name key, email key, or both.
classifiersOptional
public readonly classifiers: string[];
- Type: string[]
List of Trove classifiers that describe the project. PyPI use the classifiers to categorize projects.
dependenciesOptional
public readonly dependencies: string[];
- Type: string[]
An array of dependency specifier strings, each representing a mandatory dependent package of the project.
descriptionOptional
public readonly description: string;
- Type: string
Summary description of the project in one line.
Tools may not accept multiple lines.
dynamicOptional
public readonly dynamic: PyprojectTomlProjectDynamic[];
- Type: PyprojectTomlProjectDynamic[]
Specifies which keys are intentionally unspecified under [project] table so build backend can/will provide such metadata dynamically.
Each key must be listed only once. It is an error to both list a key in dynamic and use the key directly in [project].
One of the most common usage is version, which allows build backend to retrieve project version from source code or version control system instead of hardcoding it in pyproject.toml.
entryPointsOptional
public readonly entryPoints: any;
- Type: any
Extra entry point groups that allow applications to load plugins. For example, Pygments (a syntax highlighting tool) can use additional styles from separately installed packages through [project.entry-points."pygments.styles"]. Each key is the name of the entry-point group, and each value is a table of entry points.
guiScriptsOptional
public readonly guiScripts: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Table of entry points that allows package installers to create a GUI wrapper for. Each key is the name of the script to be created, and each value is the function or object to all, in form of either importable.module or importable.module:object.attr. Windows platform treats gui_scripts specially in that they are wrapped in a GUI executable, so they can be started without a console, but cannot use standard streams unless application code redirects them.
importNamesOptional
public readonly importNames: string[];
- Type: string[]
An array of strings specifying the import names that the project exclusively provides when installed.
importNamespacesOptional
public readonly importNamespaces: string[];
- Type: string[]
An array of strings specifying the import names that the project provides when installed, but not exclusively.
keywordsOptional
public readonly keywords: string[];
- Type: string[]
List of keywords or tags that describe the project.
They could be used by search engines to categorize the project.
licenseOptional
public readonly license: any;
- Type: any
For now it is a table with either: - file key specifying a relative path to a license file, or - text key containing full license content.
Newer tool may accept a single SPDX license expression string instead of a table.
licenseFilesOptional
public readonly licenseFiles: string[];
- Type: string[]
Relative paths or globs to paths of license files.
Can be an empty list.
maintainersOptional
public readonly maintainers: ProjectAuthor[];
- Type: ProjectAuthor[]
People or organizations considered as 'maintainers' of the project.
Each maintainer is a table with name key, email key, or both.
optionalDependenciesOptional
public readonly optionalDependencies: any;
- Type: any
Each entry is a key/value pair, with the key specifying extra feature name (such as socks in requests[socks]), and value is an array of dependency specifier strings.
readmeOptional
public readonly readme: any;
- Type: any
Value can be a relative path to text / markdown (.md suffix) / reStructuredText (.rst suffix) readme file, or a table with either: - file key containing path of aforementioned readme file, or - text key containing the full readme text embedded inside pyproject.toml.
requiresPythonOptional
public readonly requiresPython: string;
- Type: string
Specifies the Python version(s) that the distribution is compatible with.
Must be in the format specified in Version specifiers.
scriptsOptional
public readonly scripts: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Table of entry points that allows package installers to create a command-line wrapper for. Each key is the name of the script to be created, and each value is the function or object to all, in form of either importable.module or importable.module:object.attr. Windows platform treats console_scripts specially in that they are wrapped in a console executable, so they are attached to a console and can use sys.stdin, sys.stdout and sys.stderr for I/O.
urlsOptional
public readonly urls: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Table consisting one or multiple label: URL pairs.
Common indexes like PyPI uses well-known Project URLs when presenting project pages.
versionOptional
public readonly version: string;
- Type: string
Version of the project, as defined in the Version specifier specification, and preferably already normalized.
PyprojectTomlTool
Every tool that is used by the project can have users specify configuration data as long as they use a sub-table within [tool].
Generally a project can use the subtable tool.$NAME if, and only if, they own the entry for $NAME in the Cheeseshop/PyPI.
Initializer
import { python } from 'projen'
const pyprojectTomlTool: python.PyprojectTomlTool = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| any | The uncompromising Python code formatter. |
| any | Build Python wheels for all platforms. |
| any | Modern, extensible Python project management. |
| any | Build and publish crates with pyo3, cffi and uniffi bindings as well as rust binaries as python packages. |
| any | Optional static typing for Python. |
| any | A modern Python package manager with PEP 621 support. |
| any | A task runner that works well with pyproject.toml files. |
| any | Python dependency management and packaging made easy. |
| any | Static type checker for Python. |
| any | Standardized automated testing of Python packages. |
| any | Review a repository for best practices. |
| any | An extremely fast Python linter and formatter, written in Rust. |
| any | Improved build system generator for Python C/C++/Fortran extensions. |
| any | Easily download, build, install, upgrade, and uninstall Python packages. |
| any | Manage Python package versions using SCM (e.g. Git). |
| any | The complementary task runner for python. |
| any | Tombi is a toolkit for TOML; |
| any | Standardized automated testing of Python packages. |
| any | An extremely fast Python type checker, written in Rust. |
| any | An extremely fast Python package installer and resolver, written in Rust. |
blackOptional
public readonly black: any;
- Type: any
The uncompromising Python code formatter.
cibuildwheelOptional
public readonly cibuildwheel: any;
- Type: any
Build Python wheels for all platforms.
hatchOptional
public readonly hatch: any;
- Type: any
Modern, extensible Python project management.
maturinOptional
public readonly maturin: any;
- Type: any
Build and publish crates with pyo3, cffi and uniffi bindings as well as rust binaries as python packages.
mypyOptional
public readonly mypy: any;
- Type: any
Optional static typing for Python.
pdmOptional
public readonly pdm: any;
- Type: any
A modern Python package manager with PEP 621 support.
poeOptional
public readonly poe: any;
- Type: any
A task runner that works well with pyproject.toml files.
poetryOptional
public readonly poetry: any;
- Type: any
Python dependency management and packaging made easy.
pyrightOptional
public readonly pyright: any;
- Type: any
Static type checker for Python.
pytestOptional
public readonly pytest: any;
- Type: any
Standardized automated testing of Python packages.
repoReviewOptional
public readonly repoReview: any;
- Type: any
Review a repository for best practices.
ruffOptional
public readonly ruff: any;
- Type: any
An extremely fast Python linter and formatter, written in Rust.
scikitBuildOptional
public readonly scikitBuild: any;
- Type: any
Improved build system generator for Python C/C++/Fortran extensions.
setuptoolsOptional
public readonly setuptools: any;
- Type: any
Easily download, build, install, upgrade, and uninstall Python packages.
setuptoolsScmOptional
public readonly setuptoolsScm: any;
- Type: any
Manage Python package versions using SCM (e.g. Git).
taskipyOptional
public readonly taskipy: any;
- Type: any
The complementary task runner for python.
tombiOptional
public readonly tombi: any;
- Type: any
Tombi is a toolkit for TOML;
providing a formatter/linter and language server
toxOptional
public readonly tox: any;
- Type: any
Standardized automated testing of Python packages.
tyOptional
public readonly ty: any;
- Type: any
An extremely fast Python type checker, written in Rust.
uvOptional
public readonly uv: any;
- Type: any
An extremely fast Python package installer and resolver, written in Rust.
PytestOptions
Initializer
import { python } from 'projen'
const pytestOptions: python.PytestOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| number | Stop the testing process after the first N failures. |
| string | Location of sample tests. |
| string[] | List of paths to test files or directories. |
| string | Pytest version. |
maxFailuresOptional
public readonly maxFailures: number;
- Type: number
Stop the testing process after the first N failures.
testdirOptional
testdir- Deprecated: Reference
sampleTestdiron the project instead; to change the directory where tests are discovered from, usetestMatch.
public readonly testdir: string;
- Type: string
- Default: "tests"
Location of sample tests.
Typically the same directory where project tests will be located.
testMatchOptional
public readonly testMatch: string[];
- Type: string[]
- Default: []
List of paths to test files or directories.
Useful when all project tests are in a known location to speed up test collection and to avoid picking up undesired tests by accident.
Leave empty to discover all test_*.py or *_test.py files, per Pytest default.
The array will be concatenated and passed as a single argument to pytest.
Example
["tests/unit", "tests/qa"]
versionOptional
public readonly version: string;
- Type: string
- Default: "7.4.3"
Pytest version.
PytestSampleOptions
Options for python test code sample.
Initializer
import { python } from 'projen'
const pytestSampleOptions: python.PytestSampleOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | Name of the python package as used in imports and filenames. |
| string | Test directory. |
moduleNameRequired
public readonly moduleName: string;
- Type: string
Name of the python package as used in imports and filenames.
testdirRequired
public readonly testdir: string;
- Type: string
Test directory.
PythonExecutableOptions
Initializer
import { python } from 'projen'
const pythonExecutableOptions: python.PythonExecutableOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | Path to the python executable to use. |
pythonExecOptional
public readonly pythonExec: string;
- Type: string
- Default: "python"
Path to the python executable to use.
PythonPackagingOptions
Initializer
import { python } from 'projen'
const pythonPackagingOptions: python.PythonPackagingOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | Author's e-mail. |
| string | Author's name. |
| string | Version of the package. |
| string[] | A list of PyPI trove classifiers that describe the project. |
| string | A short description of the package. |
| string | A URL to the website of the project. |
| string | License of this package as an SPDX identifier. |
| string | Package name. |
| | Additional options to set for poetry if using poetry. |
| {[ key: string ]: any} | Additional fields to pass in the setup() function if using setuptools. |
| | Additional options to set for uv if using uv. |
authorEmailRequired
public readonly authorEmail: string;
- Type: string
- Default: $GIT_USER_EMAIL
Author's e-mail.
authorNameRequired
public readonly authorName: string;
- Type: string
- Default: $GIT_USER_NAME
Author's name.
versionRequired
public readonly version: string;
- Type: string
- Default: "0.1.0"
Version of the package.
classifiersOptional
public readonly classifiers: string[];
- Type: string[]
A list of PyPI trove classifiers that describe the project.
descriptionOptional
public readonly description: string;
- Type: string
A short description of the package.
homepageOptional
public readonly homepage: string;
- Type: string
A URL to the website of the project.
licenseOptional
public readonly license: string;
- Type: string
License of this package as an SPDX identifier.
packageNameOptional
public readonly packageName: string;
- Type: string
Package name.
poetryOptionsOptional
public readonly poetryOptions: PoetryPyprojectOptionsWithoutDeps;
Additional options to set for poetry if using poetry.
setupConfigOptional
public readonly setupConfig: {[ key: string ]: any};
- Type: {[ key: string ]: any}
Additional fields to pass in the setup() function if using setuptools.
uvOptionsOptional
public readonly uvOptions: UvOptions;
- Type: UvOptions
Additional options to set for uv if using uv.
PythonProjectOptions
Options for PythonProject.
Initializer
import { python } from 'projen'
const pythonProjectOptions: python.PythonProjectOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | This is the name of your project. |
| boolean | Whether to commit the managed files by default. |
| projen.IgnoreFileOptions | Configuration options for .gitignore file. |
| projen.GitOptions | Configuration options for git. |
| projen.LoggerOptions | Configure logging options such as verbosity. |
| string | The root directory of the project. |
| projen.Project | The parent project, if this project is part of a bigger project. |
| string | The shell command to use in order to run the projen CLI. |
| boolean | Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation. |
| projen.ProjenrcJsonOptions | Options for .projenrc.json. |
| boolean | Use renovatebot to handle dependency upgrades. |
| projen.RenovatebotOptions | Options for renovatebot. |
| projen.github.AutoApproveOptions | Enable and configure the 'auto approve' workflow. |
| boolean | Enable automatic merging on GitHub. |
| projen.github.AutoMergeOptions | Configure options for automatic merging on GitHub. |
| boolean | Add a clobber task which resets the repo to origin. |
| boolean | Add a VSCode development environment (used for GitHub Codespaces). |
| boolean | Enable GitHub integration. |
| projen.github.GitHubOptions | Options for GitHub integration. |
| boolean | Add a Gitpod development environment. |
| boolean | Whether mergify should be enabled on this repository or not. |
| projen.github.MergifyOptions | Options for mergify. |
| projen.ProjectType | Which type of project this is (library/app). |
| projen.github.GithubCredentials | Choose a method of providing GitHub API access for projen workflows. |
| string | The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows. |
| projen.SampleReadmeProps | The README setup. |
| boolean | Auto-close of stale issues and pull request. |
| projen.github.StaleOptions | Auto-close stale issues and pull requests. |
| boolean | Enable VSCode integration. |
| string | Author's e-mail. |
| string | Author's name. |
| string | Version of the package. |
| string[] | A list of PyPI trove classifiers that describe the project. |
| string | A short description of the package. |
| string | A URL to the website of the project. |
| string | License of this package as an SPDX identifier. |
| string | Package name. |
| | Additional options to set for poetry if using poetry. |
| {[ key: string ]: any} | Additional fields to pass in the setup() function if using setuptools. |
| | Additional options to set for uv if using uv. |
| string | Path to the python executable to use. |
| string | Name of the python package as used in imports and filenames. |
| string[] | List of runtime dependencies for this project. |
| string[] | List of dev dependencies for this project. |
| boolean | Use pip with a requirements.txt file to track project dependencies. |
| boolean | Use poetry to manage your project dependencies, virtual environment, and (optional) packaging/publishing. |
| boolean | Use projenrc in javascript. |
| projen.javascript.ProjenrcOptions | Options related to projenrc in JavaScript. |
| boolean | Use projenrc in Python. |
| | Options related to projenrc in python. |
| boolean | Use projenrc in TypeScript. |
| projen.typescript.ProjenrcTsOptions | Options related to projenrc in TypeScript. |
| boolean | Include pytest tests. |
| | pytest options. |
| boolean | Include sample code and test if the relevant directories don't exist. |
| string | Location of sample tests. |
| boolean | Use setuptools with a setup.py script for packaging and publishing. |
| boolean | Use uv to manage your project dependencies, virtual environment, and (optional) packaging/publishing. |
| boolean | Use venv to manage a virtual environment for installing dependencies inside. |
| | Venv options. |
nameRequired
public readonly name: string;
- Type: string
- Default: $BASEDIR
This is the name of your project.
commitGeneratedOptional
public readonly commitGenerated: boolean;
- Type: boolean
- Default: true
Whether to commit the managed files by default.
gitIgnoreOptionsOptional
public readonly gitIgnoreOptions: IgnoreFileOptions;
- Type: projen.IgnoreFileOptions
Configuration options for .gitignore file.
gitOptionsOptional
public readonly gitOptions: GitOptions;
- Type: projen.GitOptions
Configuration options for git.
loggingOptional
public readonly logging: LoggerOptions;
- Type: projen.LoggerOptions
- Default: {}
Configure logging options such as verbosity.
outdirOptional
public readonly outdir: string;
- Type: string
- Default: "."
The root directory of the project.
Relative to this directory, all files are synthesized.
If this project has a parent, this directory is relative to the parent directory and it cannot be the same as the parent or any of it's other subprojects.
parentOptional
public readonly parent: Project;
- Type: projen.Project
The parent project, if this project is part of a bigger project.
projenCommandOptional
public readonly projenCommand: string;
- Type: string
- Default: "npx projen"
The shell command to use in order to run the projen CLI.
Can be used to customize in special environments.
projenrcJsonOptional
public readonly projenrcJson: boolean;
- Type: boolean
- Default: false
Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation.
projenrcJsonOptionsOptional
public readonly projenrcJsonOptions: ProjenrcJsonOptions;
- Type: projen.ProjenrcJsonOptions
- Default: default options
Options for .projenrc.json.
renovatebotOptional
public readonly renovatebot: boolean;
- Type: boolean
- Default: false
Use renovatebot to handle dependency upgrades.
renovatebotOptionsOptional
public readonly renovatebotOptions: RenovatebotOptions;
- Type: projen.RenovatebotOptions
- Default: default options
Options for renovatebot.
autoApproveOptionsOptional
public readonly autoApproveOptions: AutoApproveOptions;
- Type: projen.github.AutoApproveOptions
- Default: auto approve is disabled
Enable and configure the 'auto approve' workflow.
autoMergeOptional
public readonly autoMerge: boolean;
- Type: boolean
- Default: true
Enable automatic merging on GitHub.
Has no effect if github.mergify
is set to false.
autoMergeOptionsOptional
public readonly autoMergeOptions: AutoMergeOptions;
- Type: projen.github.AutoMergeOptions
- Default: see defaults in
AutoMergeOptions
Configure options for automatic merging on GitHub.
Has no effect if
github.mergify or autoMerge is set to false.
clobberOptional
public readonly clobber: boolean;
- Type: boolean
- Default: true, but false for subprojects
Add a clobber task which resets the repo to origin.
devContainerOptional
public readonly devContainer: boolean;
- Type: boolean
- Default: false
Add a VSCode development environment (used for GitHub Codespaces).
githubOptional
public readonly github: boolean;
- Type: boolean
- Default: true
Enable GitHub integration.
Enabled by default for root projects. Disabled for non-root projects.
githubOptionsOptional
public readonly githubOptions: GitHubOptions;
- Type: projen.github.GitHubOptions
- Default: see GitHubOptions
Options for GitHub integration.
gitpodOptional
public readonly gitpod: boolean;
- Type: boolean
- Default: false
Add a Gitpod development environment.
mergifyOptional
mergify- Deprecated: use
githubOptions.mergifyinstead
public readonly mergify: boolean;
- Type: boolean
- Default: true
Whether mergify should be enabled on this repository or not.
mergifyOptionsOptional
mergifyOptions- Deprecated: use
githubOptions.mergifyOptionsinstead
public readonly mergifyOptions: MergifyOptions;
- Type: projen.github.MergifyOptions
- Default: default options
Options for mergify.
projectTypeOptional
projectType- Deprecated: no longer supported at the base project level
public readonly projectType: ProjectType;
- Type: projen.ProjectType
- Default: ProjectType.UNKNOWN
Which type of project this is (library/app).
projenCredentialsOptional
public readonly projenCredentials: GithubCredentials;
- Type: projen.github.GithubCredentials
- Default: use a personal access token named PROJEN_GITHUB_TOKEN
Choose a method of providing GitHub API access for projen workflows.
projenTokenSecretOptional
projenTokenSecret- Deprecated: use
projenCredentials
public readonly projenTokenSecret: string;
- Type: string
- Default: "PROJEN_GITHUB_TOKEN"
The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows.
This token needs to have the repo, workflows
and packages scope.
readmeOptional
public readonly readme: SampleReadmeProps;
- Type: projen.SampleReadmeProps
- Default: { filename: 'README.md', contents: '# replace this' }
The README setup.
Example
"{ filename: 'readme.md', contents: '# title' }"
staleOptional
public readonly stale: boolean;
- Type: boolean
- Default: false
Auto-close of stale issues and pull request.
See staleOptions for options.
staleOptionsOptional
public readonly staleOptions: StaleOptions;
- Type: projen.github.StaleOptions
- Default: see defaults in
StaleOptions
Auto-close stale issues and pull requests.
To disable set stale to false.
vscodeOptional
public readonly vscode: boolean;
- Type: boolean
- Default: true
Enable VSCode integration.
Enabled by default for root projects. Disabled for non-root projects.
authorEmailRequired
public readonly authorEmail: string;
- Type: string
- Default: $GIT_USER_EMAIL
Author's e-mail.
authorNameRequired
public readonly authorName: string;
- Type: string
- Default: $GIT_USER_NAME
Author's name.
versionRequired
public readonly version: string;
- Type: string
- Default: "0.1.0"
Version of the package.
classifiersOptional
public readonly classifiers: string[];
- Type: string[]
A list of PyPI trove classifiers that describe the project.
descriptionOptional
public readonly description: string;
- Type: string
A short description of the package.
homepageOptional
public readonly homepage: string;
- Type: string
A URL to the website of the project.
licenseOptional
public readonly license: string;
- Type: string
License of this package as an SPDX identifier.
packageNameOptional
public readonly packageName: string;
- Type: string
Package name.
poetryOptionsOptional
public readonly poetryOptions: PoetryPyprojectOptionsWithoutDeps;
Additional options to set for poetry if using poetry.
setupConfigOptional
public readonly setupConfig: {[ key: string ]: any};
- Type: {[ key: string ]: any}
Additional fields to pass in the setup() function if using setuptools.
uvOptionsOptional
public readonly uvOptions: UvOptions;
- Type: UvOptions
Additional options to set for uv if using uv.
pythonExecOptional
public readonly pythonExec: string;
- Type: string
- Default: "python"
Path to the python executable to use.
moduleNameRequired
public readonly moduleName: string;
- Type: string
- Default: $PYTHON_MODULE_NAME
Name of the python package as used in imports and filenames.
Must only consist of alphanumeric characters and underscores.
depsOptional
public readonly deps: string[];
- Type: string[]
- Default: []
List of runtime dependencies for this project.
Dependencies use the format: <module>@<semver>
Additional dependencies can be added via project.addDependency().
devDepsOptional
public readonly devDeps: string[];
- Type: string[]
- Default: []
List of dev dependencies for this project.
Dependencies use the format: <module>@<semver>
Additional dependencies can be added via project.addDevDependency().
pipOptional
public readonly pip: boolean;
- Type: boolean
- Default: true, unless poetry is true, then false
Use pip with a requirements.txt file to track project dependencies.
poetryOptional
public readonly poetry: boolean;
- Type: boolean
- Default: false
Use poetry to manage your project dependencies, virtual environment, and (optional) packaging/publishing.
This feature is incompatible with pip, setuptools, or venv.
If you set this option to true, then pip, setuptools, and venv must be set to false.
projenrcJsOptional
public readonly projenrcJs: boolean;
- Type: boolean
- Default: false
Use projenrc in javascript.
This will install projen as a JavaScript dependency and add a synth
task which will run .projenrc.js.
projenrcJsOptionsOptional
public readonly projenrcJsOptions: ProjenrcOptions;
- Type: projen.javascript.ProjenrcOptions
- Default: default options
Options related to projenrc in JavaScript.
projenrcPythonOptional
public readonly projenrcPython: boolean;
- Type: boolean
- Default: true
Use projenrc in Python.
This will install projen as a Python dependency and add a synth
task which will run .projenrc.py.
projenrcPythonOptionsOptional
public readonly projenrcPythonOptions: ProjenrcOptions;
- Type: ProjenrcOptions
- Default: default options
Options related to projenrc in python.
projenrcTsOptional
public readonly projenrcTs: boolean;
- Type: boolean
- Default: false
Use projenrc in TypeScript.
This will create a tsconfig file (default: tsconfig.projen.json)
and use ts-node in the default task to parse the project source files.
projenrcTsOptionsOptional
public readonly projenrcTsOptions: ProjenrcTsOptions;
- Type: projen.typescript.ProjenrcTsOptions
- Default: default options
Options related to projenrc in TypeScript.
pytestOptional
public readonly pytest: boolean;
- Type: boolean
- Default: true
Include pytest tests.
pytestOptionsOptional
public readonly pytestOptions: PytestOptions;
- Type: PytestOptions
- Default: defaults
pytest options.
sampleOptional
public readonly sample: boolean;
- Type: boolean
- Default: true
Include sample code and test if the relevant directories don't exist.
sampleTestdirOptional
public readonly sampleTestdir: string;
- Type: string
- Default: "tests"
Location of sample tests.
Typically the same directory where project tests will be located.
setuptoolsOptional
public readonly setuptools: boolean;
- Type: boolean
- Default: true, unless poetry is true, then false
Use setuptools with a setup.py script for packaging and publishing.
uvOptional
public readonly uv: boolean;
- Type: boolean
- Default: false
Use uv to manage your project dependencies, virtual environment, and (optional) packaging/publishing.
venvOptional
public readonly venv: boolean;
- Type: boolean
- Default: true, unless poetry is true, then false
Use venv to manage a virtual environment for installing dependencies inside.
venvOptionsOptional
public readonly venvOptions: VenvOptions;
- Type: VenvOptions
- Default: defaults
Venv options.
PythonSampleOptions
Options for python sample code.
Initializer
import { python } from 'projen'
const pythonSampleOptions: python.PythonSampleOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | Sample code directory. |
dirRequired
public readonly dir: string;
- Type: string
Sample code directory.
RequirementsFileOptions
Initializer
import { python } from 'projen'
const requirementsFileOptions: python.RequirementsFileOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| | Provide a list of packages that can be dynamically updated. |
packageProviderOptional
public readonly packageProvider: IPackageProvider;
- Type: IPackageProvider
Provide a list of packages that can be dynamically updated.
SetupPyOptions
Fields to pass in the setup() function of setup.py.
Initializer
import { python } from 'projen'
const setupPyOptions: python.SetupPyOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| {[ key: string ]: any} | Escape hatch to allow any value. |
| string | Author's e-mail. |
| string | Author's name. |
| string[] | A list of PyPI trove classifiers that describe the project. |
| string | A short project description. |
| string | Package's Homepage / Website. |
| string | The project license. |
| string | Name of the package. |
| string[] | List of submodules to be packaged. |
| string | Manually specify package version. |
additionalOptionsOptional
public readonly additionalOptions: {[ key: string ]: any};
- Type: {[ key: string ]: any}
Escape hatch to allow any value.
authorEmailOptional
public readonly authorEmail: string;
- Type: string
Author's e-mail.
authorNameOptional
public readonly authorName: string;
- Type: string
Author's name.
classifiersOptional
public readonly classifiers: string[];
- Type: string[]
A list of PyPI trove classifiers that describe the project.
descriptionOptional
public readonly description: string;
- Type: string
A short project description.
homepageOptional
public readonly homepage: string;
- Type: string
Package's Homepage / Website.
licenseOptional
public readonly license: string;
- Type: string
The project license.
nameOptional
public readonly name: string;
- Type: string
Name of the package.
packagesOptional
public readonly packages: string[];
- Type: string[]
List of submodules to be packaged.
versionOptional
public readonly version: string;
- Type: string
Manually specify package version.
SetuptoolsOptions
Initializer
import { python } from 'projen'
const setuptoolsOptions: python.SetuptoolsOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | Author's e-mail. |
| string | Author's name. |
| string | Version of the package. |
| string[] | A list of PyPI trove classifiers that describe the project. |
| string | A short description of the package. |
| string | A URL to the website of the project. |
| string | License of this package as an SPDX identifier. |
| string | Package name. |
| | Additional options to set for poetry if using poetry. |
| {[ key: string ]: any} | Additional fields to pass in the setup() function if using setuptools. |
| | Additional options to set for uv if using uv. |
| string | Path to the python executable to use. |
authorEmailRequired
public readonly authorEmail: string;
- Type: string
- Default: $GIT_USER_EMAIL
Author's e-mail.
authorNameRequired
public readonly authorName: string;
- Type: string
- Default: $GIT_USER_NAME
Author's name.
versionRequired
public readonly version: string;
- Type: string
- Default: "0.1.0"
Version of the package.
classifiersOptional
public readonly classifiers: string[];
- Type: string[]
A list of PyPI trove classifiers that describe the project.
descriptionOptional
public readonly description: string;
- Type: string
A short description of the package.
homepageOptional
public readonly homepage: string;
- Type: string
A URL to the website of the project.
licenseOptional
public readonly license: string;
- Type: string
License of this package as an SPDX identifier.
packageNameOptional
public readonly packageName: string;
- Type: string
Package name.
poetryOptionsOptional
public readonly poetryOptions: PoetryPyprojectOptionsWithoutDeps;
Additional options to set for poetry if using poetry.
setupConfigOptional
public readonly setupConfig: {[ key: string ]: any};
- Type: {[ key: string ]: any}
Additional fields to pass in the setup() function if using setuptools.
uvOptionsOptional
public readonly uvOptions: UvOptions;
- Type: UvOptions
Additional options to set for uv if using uv.
pythonExecOptional
public readonly pythonExec: string;
- Type: string
- Default: "python"
Path to the python executable to use.
UvOptions
Options for UV project.
Initializer
import { python } from 'projen'
const uvOptions: python.UvOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | Path to the python executable to use. |
| | Declares any Python level dependencies that must be installed in order to run the project’s build system successfully. |
| | The project's basic metadata configuration. |
| | The configuration and metadata for uv. |
pythonExecOptional
public readonly pythonExec: string;
- Type: string
- Default: "python"
Path to the python executable to use.
buildSystemOptional
public readonly buildSystem: BuildSystem;
- Type: BuildSystem
- Default: no build system
Declares any Python level dependencies that must be installed in order to run the project’s build system successfully.
projectOptional
public readonly project: PyprojectTomlProject;
- Type: PyprojectTomlProject
The project's basic metadata configuration.
uvOptional
public readonly uv: UvConfiguration;
- Type: UvConfiguration
The configuration and metadata for uv.
VenvOptions
Options for venv.
Initializer
import { python } from 'projen'
const venvOptions: python.VenvOptions = { ... }
Properties
| Name | Type | Description |
|---|---|---|
| string | Name of directory to store the environment in. |
| string | Path to the python executable to use. |
envdirOptional
public readonly envdir: string;
- Type: string
- Default: ".env"
Name of directory to store the environment in.
pythonExecOptional
public readonly pythonExec: string;
- Type: string
- Default: "python"
Path to the python executable to use.
Protocols
IPackageProvider
- Implemented By: IPackageProvider
Properties
| Name | Type | Description |
|---|---|---|
| projen.Dependency[] | An array of packages (may be dynamically generated). |
packagesRequired
public readonly packages: Dependency[];
- Type: projen.Dependency[]
An array of packages (may be dynamically generated).
IPythonDeps
- Implemented By: Pip, Poetry, Uv, IPythonDeps
Methods
| Name | Description |
|---|---|
| Adds a runtime dependency. |
| Adds a dev dependency. |
| Installs dependencies (called during post-synthesis). |
addDependency
public addDependency(spec: string): void
Adds a runtime dependency.
specRequired
- Type: string
Format <module>@<semver>.
addDevDependency
public addDevDependency(spec: string): void
Adds a dev dependency.
specRequired
- Type: string
Format <module>@<semver>.
installDependencies
public installDependencies(): void
Installs dependencies (called during post-synthesis).
Properties
| Name | Type | Description |
|---|---|---|
| projen.Task | A task that installs and updates dependencies. |
installCiTaskRequired
public readonly installCiTask: Task;
- Type: projen.Task
A task that installs and updates dependencies.
IPythonEnv
- Implemented By: Poetry, Uv, Venv, IPythonEnv
Methods
| Name | Description |
|---|---|
| Initializes the virtual environment if it doesn't exist (called during post-synthesis). |
setupEnvironment
public setupEnvironment(): void
Initializes the virtual environment if it doesn't exist (called during post-synthesis).
IPythonPackaging
- Implemented By: Poetry, Setuptools, Uv, IPythonPackaging
Properties
| Name | Type | Description |
|---|---|---|
| projen.Task | A task that uploads the package to a package repository. |
publishTaskRequired
public readonly publishTask: Task;
- Type: projen.Task
A task that uploads the package to a package repository.
Enums
PyprojectTomlProjectDynamic
Members
| Name | Description |
|---|---|
| version. |
| description. |
| readme. |
| requires-python. |
| license. |
| license-files. |
| authors. |
| maintainers. |
| keywords. |
| classifiers. |
| urls. |
| scripts. |
| gui-scripts. |
| entry-points. |
| dependencies. |
| optional-dependencies. |
| import-names. |
| import-namespaces. |
VERSION
version.
DESCRIPTION
description.
README
readme.
REQUIRES_HYPHEN_PYTHON
requires-python.
LICENSE
license.
LICENSE_HYPHEN_FILES
license-files.
AUTHORS
authors.
MAINTAINERS
maintainers.
KEYWORDS
keywords.
CLASSIFIERS
classifiers.
URLS
urls.
SCRIPTS
scripts.
GUI_HYPHEN_SCRIPTS
gui-scripts.
ENTRY_HYPHEN_POINTS
entry-points.
DEPENDENCIES
dependencies.
OPTIONAL_HYPHEN_DEPENDENCIES
optional-dependencies.
IMPORT_HYPHEN_NAMES
import-names.
IMPORT_HYPHEN_NAMESPACES
import-namespaces.