QGIS Venv Creator
Single file and zero dependency tool to create a Python virtual environment for QGIS plugin development.
Table of Contents
Installation
The recommended way to install qgis-venv-creator (and other Python cli tools) is to install it with pipx. Pipx will install the application in an isolated environment and make it available as a command line utility. To install pipx, follow the instructions provided at https://github.com/pypa/pipx#install-pipx.
$ pipx install qgis-venv-creator
Alternatively, to install in your current Python environment:
$ pip install qgis-venv-creator
Copy as a script
qgis-venv-creator is a single Python script that can be downloaded and copied to your project root, or any other location from which you wish to use it.
Usage
Quick start
On your plugin root directory, run:
$ create-qgis-venv
Note:
If you have copied the script file to your project root, you can run it withpython create-qgis-venv.py.
On a system where there might be multiple QGIS installations (ie. Windows, MacOs), you are asked to select the one you want to use for development.
After the virtual environment is created, you can activate it and it will have access to the QGIS Python environment.
Options
create-qgis-venv [-h] [--venv-parent VENV_PARENT] [--venv-name VENV_NAME]
[--qgis-installation QGIS_INSTALLATION]
[--qgis-installation-search-path-pattern QGIS_INSTALLATION_SEARCH_PATH_PATTERN]
[--python-executable PYTHON_EXECUTABLE] [--debug]
| Option | Available on platform | Description |
|---|---|---|
| -h, --help | ALL | Show this help message and exit |
| --venv-parent | ALL | Path to the parent directory of the virtual environment to be created. Most likely your project directory. Default current directory. |
| --venv-name | ALL | Name of the virtual environment |
| --qgis-installation | Windows | Path to the QGIS installation to use for development. Installations made with official msi and Osgeo4W installers are supported. Give the path to the 'qgis' directory inside the 'apps' directory. If not given, the user is prompted to select one. |
| --qgis-installation-search-path-pattern | Windows | Custom glob pattern for QGIS installations to be selected. Can be set also with environment variable QGIS_INSTALLATION_SEARCH_PATH_PATTERN. For example "C:\qgis\*\apps\qgis*\" to find installations from "C:\qgis\3.32\apps\qgis\" and "C:\qgis\3.28\apps\qgis-ltr\" |
| --python-executable | Windows | Path to the Python executable used by the QGIS installation. If not given, the Python executable is searched from the QGIS installation. |
| --debug | ALL | Enable debug logging |
Development
This project uses uv for development and packaging. Install instructions can be found at https://docs.astral.sh/uv/getting-started/installation/.
Create the development environment with:
uv sync
uv creates an in-project .venv, which VS Code picks up automatically as the interpreter.
Common commands:
uv run pytest # run unit tests (e2e skipped by default)
uv run pytest tests/unit/test_prompt.py::test_prompt_on_valid_selection # single test
uv run coverage run -m pytest # run tests with coverage
uv run coverage report # print coverage report
uv run ty check src/qgis_venv_creator tests # type check
uv run ruff check . # lint
uv run ruff format . # format
uv build # build sdist + wheel into dist/
To run the test suite against a specific Python version, pass -p, e.g. uv run -p 3.8 pytest.
The version is bumped with uv version --bump <major|minor|patch> followed by python scripts/sync_version.py, which copies the new version into __version__ in src/qgis_venv_creator/create_qgis_venv.py (tests/unit/test_version.py guards against drift).
Pre-commit hook
This project uses prek to run code checks before committing.
Install pre-commit hooks to your repo with:
uv run prek install
License
qgis-venv-creator is distributed under the terms of the MIT license.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qgis_venv_creator-0.2.0.tar.gz.
File metadata
- Download URL: qgis_venv_creator-0.2.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29cdf459727815bf158dc0ad27f97333544049e945260864d5c247559acab856
|
|
| MD5 |
0baafa2683a9bc731cc1197cb1778df4
|
|
| BLAKE2b-256 |
3abc2e0fb8bd1b1bb03f58c3f67d8c0db611cb917b475af23a6ce1e880647cbb
|
Provenance
The following attestation bundles were made for qgis_venv_creator-0.2.0.tar.gz:
Publisher:
release.yml on GispoCoding/qgis-venv-creator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qgis_venv_creator-0.2.0.tar.gz -
Subject digest:
29cdf459727815bf158dc0ad27f97333544049e945260864d5c247559acab856 - Sigstore transparency entry: 2528828220
- Sigstore integration time:
-
Permalink:
GispoCoding/qgis-venv-creator@226061da6cd1c618145baeaa20410a75d7a71c75 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/GispoCoding
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@226061da6cd1c618145baeaa20410a75d7a71c75 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file qgis_venv_creator-0.2.0-py3-none-any.whl.
File metadata
- Download URL: qgis_venv_creator-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5eb588ac6a2d00c266d5ee6c0921b782a65d6e3edf4f8dc7c448e16fc4757414
|
|
| MD5 |
a8ab81a5776c0b8643321fac2d538523
|
|
| BLAKE2b-256 |
b6670f978622ac9a4f196bde51abd222fbfb99ffc2d10c2a19d3ab002a492a5b
|
Provenance
The following attestation bundles were made for qgis_venv_creator-0.2.0-py3-none-any.whl:
Publisher:
release.yml on GispoCoding/qgis-venv-creator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qgis_venv_creator-0.2.0-py3-none-any.whl -
Subject digest:
5eb588ac6a2d00c266d5ee6c0921b782a65d6e3edf4f8dc7c448e16fc4757414 - Sigstore transparency entry: 2528828660
- Sigstore integration time:
-
Permalink:
GispoCoding/qgis-venv-creator@226061da6cd1c618145baeaa20410a75d7a71c75 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/GispoCoding
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@226061da6cd1c618145baeaa20410a75d7a71c75 -
Trigger Event:
pull_request
-
Statement type: