Pycrucible configuration can be set in two ways.
We can use the separate pycrucible.toml
file, or we can use custom sections in our existing pyproject.toml
file.
When using any of the configuration options only entrypoint
declaration is required !
Both configuration options have exact same declarations
Declaration of entrypoint
can also be just entry
Configuration options
-
entrypoint (or entry) - Defines the main script which is called first
-
patterns - Defines what files to include and what to exclude from bundling
-
source - Defines GitHub repository, for auto-update feature
-
uv - Commands to pass to
uv
binary - NOT IMPLEMENTED -
env - Keyword arguments to pass to environment variables - NOT IMPLEMENTED
-
hooks - Place to define
pre
andpost
hooks to run (also python scripts)
Lets take a look at all the configuration options and how they look
entrypoint
This is a string with a relative path to your main file that should be run as an entrypoint to application.
Default is: main.py
[tool.pycrucible]
entrypoint = "src/main.py"
# or
entry = "src/main.py"
patterns
Patterns define what files to include and what to exclude from your application. These work by GLOB patterns which you should already be familiar with.
[tool.pycrucible.patterns]
include = [
"**/*.py",
]
exclude = [
"**/__pycache__/**",
]
Default is:
patterns.include = [
"**/*.py",
]
patterns.exclude = [
".venv/**/*",
"**/__pycache__/**",
".git/**/*",
"**/*.pyc",
"**/*.pyo",
"**/*.pyd"
]
source
Source defines your GitHub repository for auto-update feature.
Only public repositories are supported for now
[tool.pycrucible.source]
repository = "https://github.com/username/repo"
branch = "main"
update_strategy = "pull"
uv
This section is not yet implemented
env
This section is not yet implemented
hooks
Hooks are a way to run scripts before and after the main application. You can use them to create and/or populate databases, create dummy data, or cleanup of resources when your application exits.
There are two hooks
-
pre-run
-
post-run
Hooks must also be python scripts.
Dependencies declared in the main project also are available to hooks scripts.
[tool.pycrucible.hooks]
pre_run = "some_script.py"
post_run = "some_other_script.py"