Install pyfcstm
Use this guide when you need a working pyfcstm command on a local machine
or CI runner. The package supports Python 3.7 through 3.14, so the commands
avoid assumptions that only work on the newest Python releases.
What installation includes
The normal package installation is an all-in-one install for the current public runtime dependencies. It installs the CLI, parser, model layer, simulator, renderer, diagnostics, verify support, and visualization integration declared by the package. It does not install external system programs such as Java, PlantUML jar files, Graphviz, or desktop viewers.
Capability |
Included in Python package install |
External tool sometimes needed |
|---|---|---|
Parse DSL and build models |
yes |
no |
|
yes |
no |
|
yes |
no extra system tool for normal inspect use |
|
yes |
no for Python generation; target compilers are needed only when you build generated C/C++ artifacts |
|
yes |
no |
|
Python integration yes |
Java and a PlantUML jar for local rendering, or network access to a remote PlantUML service |
Install from PyPI
For normal use, install the published package with the interpreter that will run the CLI:
python -m pip install pyfcstm
If the machine has several Python interpreters, be explicit:
python3 -m pip install pyfcstm
python3 -m pyfcstm --help
For project-local work, prefer a virtual environment:
python -m venv .venv
. .venv/bin/activate
python -m pip install -U pip
python -m pip install pyfcstm
pyfcstm --help
On Windows cmd.exe, activation usually looks like:
py -m venv .venv
.venv\Scripts\activate
python -m pip install -U pip
python -m pip install pyfcstm
pyfcstm --help
Install from the main branch
Use a source install only when you intentionally need the current repository state instead of the latest PyPI release:
python -m pip install -U git+https://github.com/hansbug/pyfcstm@main
Pin a branch, tag, or commit in project automation. Unpinned source installs can change without your build configuration changing.
Use a pre-built executable
If the deployment environment cannot install Python packages directly, check the GitHub Releases page for pre-built executable artifacts. Prefer PyPI for normal development and CI; use release artifacts only when that packaging model fits the deployment target.
Verify the Python package
The installation tutorial keeps a checked-in verification script. It imports the package metadata and proves that Python can load the installed package:
1from pyfcstm.config.meta import __TITLE__, __AUTHOR__, __VERSION__, __DESCRIPTION__
2
3if __name__ == '__main__':
4 print(__TITLE__, __VERSION__)
5 print('Developed and maintained by', __AUTHOR__)
6 print(__DESCRIPTION__)
Expected output shape:
1pyfcstm 0.6.0
2Developed and maintained by HansBug
3A Python framework for parsing finite state machine DSL and generating executable code in multiple target languages.
For a shorter manual check, run:
python - <<'PY'
import pyfcstm
print(pyfcstm.__title__)
print(pyfcstm.__version__)
PY
Verify the CLI
Check version and help first:
pyfcstm -v
pyfcstm --help
The documentation build also exercises this shell check:
1pyfcstm -v
1Pyfcstm, version 0.6.0.
2Developed by HansBug (hansbug@buaa.edu.cn).
Verify a tiny DSL round trip
After the command exists, test the parser and one non-rendering command with a small file:
cat > smoke.fcstm <<'FCSTM'
state Root {
state Idle;
[*] -> Idle;
}
FCSTM
pyfcstm inspect -i smoke.fcstm
pyfcstm plantuml -i smoke.fcstm -o smoke.puml
This check does not need Java, PlantUML, a compiler, or a graphical desktop.
Optional renderer setup
pyfcstm plantuml writes PlantUML source and needs no renderer. Only
pyfcstm visualize needs a renderer backend.
For local rendering, install Java and provide a PlantUML jar:
export PLANTUML_JAR=/path/to/plantuml.jar
pyfcstm visualize --check --renderer local
For remote rendering, configure a PlantUML service when you do not want the public default:
export PLANTUML_HOST=http://www.plantuml.com/plantuml
pyfcstm visualize --check --renderer remote
Remote rendering sends generated PlantUML source to the configured service. Use local rendering for private diagrams.
CI installation pattern
In CI, keep package installation separate from command execution so failures are easier to diagnose:
python -m pip install -U pip
python -m pip install pyfcstm
python -m pyfcstm --help
pyfcstm inspect -i machines/main.fcstm --format json -o build/main.inspect.json
For rendered diagrams in CI, avoid viewer launch:
pyfcstm visualize -i machines/main.fcstm -t svg -o build/main.svg --no-open
Troubleshooting checklist
Symptom |
Likely cause |
Fix |
|---|---|---|
|
The script directory is not on |
Run |
|
Package not installed in that interpreter. |
Run |
CLI exists but a DSL command fails |
Input path, syntax, or model validation issue. |
Run |
|
Missing Java, missing PlantUML jar, invalid jar path, or local backend failure. |
Install Java, set |
|
Network, proxy, or remote service issue. |
Set |
Viewer does not open after render |
Headless environment or no system opener. |
Use |
Verification examples and failure signals
Use these short checks after installation. They are intentionally independent of rendering backends so they work on a fresh Python-only environment.
Check |
Command |
Expected signal |
If it fails |
|---|---|---|---|
Package import. |
|
Prints the package title. |
The package is not installed in this interpreter. |
Console script. |
|
Lists public commands. |
Use |
Version. |
|
Prints |
Confirm the command belongs to the intended environment. |
Python-only DSL smoke. |
|
Prints |
Fix DSL syntax or installation before checking renderers. |
Source-only diagram smoke. |
|
|
This does not require Java or a PlantUML jar. |
Renderer smoke. |
|
Reports local and/or remote renderer availability. |
Configure Java/jar or remote host only if rendered images are required. |
Common installation diagnosis examples
Symptom |
Probe |
Meaning |
Repair |
|---|---|---|---|
|
|
Package may be installed but console script is not on |
Activate the virtualenv or reinstall with the intended interpreter. |
Import works but command uses another version. |
|
Interpreter and console script point to different environments. |
Prefer |
|
|
Python package is installed; renderer backend is missing. |
Install Java and PlantUML jar, or use an allowed remote renderer. |
Native generated runtime build fails. |
Build the generated output with its generated README command. |
pyfcstm generation may be fine; target compiler/toolchain is missing or incompatible. |
Install target toolchain and keep native checks explicit. |
Next steps
Quick Start gives the shortest end-to-end path.
CLI workflows shows common command-line tasks.
CLI reference lists command and option facts.
Published documentation is available at hansbug.github.io/pyfcstm.