Forge
Plugins

Python

Plugin for Python projects

@bjb-forge/nx-python-project

Installation

npx @bjb-forge/cli add @bjb-forge/nx-python-project

Plugin Options

{
  "plugin": "@bjb-forge/nx-python-project/nx-plugin",
  "options": {}
}
OptionTypeDescription
build.targetNamestringThe name of the build target
generate.targetNamestringThe name of the generate target
test.targetNamestringThe name of the test target
lint.targetNamestringThe name of the lint target
serve.targetNamestringThe name of the serve target

Inferred Targets

build

Builds the Python project using uv build.

Condition: All Python projects with a pyproject.toml

generate

Generates OpenAPI code using openapi-generator-cli.

Condition: Python projects with a generator-config.yaml

test

Runs tests using uv run pytest.

Condition: All Python projects with a pyproject.toml

lint

Lints the Python project using uv run ruff check.

Condition: All Python projects with a pyproject.toml

serve

Runs the Python application using uv run python -m <module>.

Condition: Application projects (has [project.scripts])

nx-release-publish

Publishes the Python package to PyPI using uv publish.

Condition: All Python projects with a pyproject.toml

Generators

python-project

Generate a Python project structure.

nx g @bjb-forge/nx-python-project:python-project [options]
OptionTypeRequiredDefaultDescription
directorystringYes-A directory where the project is placed
namestringNo-The name of the project. Defaults to the last segment of the directory
workspacebooleanNotrueWhether to add the project to a uv workspace. When true, creates or updates a root pyproject.toml with [tool.uv.workspace]
nx g @bjb-forge/nx-python-project:python-project packages/my-app

On this page