A collection of PowerShell scripts to streamline common tasks during the development of projects written in Python or using tools written in Python (pre-commit, Bump My Version, Material for MkDocs, …), inspired by Scripts to Rule Them All. Requires uv 0.8.18+.
- Download and unzip a release, or clone this project.
- Copy the
scriptssubfolder into your project. - Customize the scripts as you like, add your own, and delete what you do not need.
- Create or edit the
pyproject.tomlof your project:- Use the
requires-pythonentry to specify the Python version you want to use. - List the dependencies of the tools you use in the
devdependency group. - If your project does not include a Python package, do not define the
[build-system]table.
- Use the
- Profit.
Bootstrap.ps1Bootstrap a development environment.New-PythonVenv.ps1Create or refresh a Python virtual environment.Install-PreCommitHooks.ps1Install pre-commit hooks using prek.Update-PreCommitHooks.ps1Update pre-commit hooks.Set-VenvOutsideProject.ps1Telluvto store the Python virtual environment outside the project folder. Useful to avoid problems with Microsoft OneDrive.Update-Scripts.ps1Upgrade (or downgrade) the scripts to the specified released version. Requires robocopy.
Build-Package.ps1Build source distribution and wheel, then expand them for inspection.Release-Project.ps1Bump the project version, tag a release, and push toorigin.
Build-Docs.ps1Build the documentation.Serve-Docs.ps1Start a live preview server to view the documentation while editing it.
Use Get-Help to show the documentation of each script:
PS> Get-Help .\scripts\Release-Project.ps1 -DetailedInstead of copying, you can include the scripts repository as a submodule of your project. On Windows, this can be achieved as follows:
-
Enable Windows Developer Mode to be able to create symbolic links without administrative rights.
-
Enable symbolic links in
git:PS> git config --global core.symlinks true
-
From within your project, add
scriptsas a submodule, and create a symbolic link in the project folder.PS> git submodule add https://github.com/angelo-peronio/scripts.git submodules/scripts PS> New-Item -ItemType SymbolicLink -Path scripts -Target .\submodules\scripts\scripts\
-
Remember to clone your project with
git clone --recurse -
After cloning on Windows, the
scriptssymbolic link will not work. Recreate it:PS> Remove-Item scripts PS> git restore scripts
uv sync --upgradeis used to create the Python virtual environment with the latest version of the dependencies,uv runis used to activate it.- Environment variables are automatically loaded from a
.envfile in the project root folder, if present. This mechanism is used to optionally store the virtual environment outside the project folder, untiluvwill support this natively.
Other common ways to reach the same goal: