Skip to content

angelo-peronio/scripts

Repository files navigation

PowerShell scripts to streamline common tasks in Python projects

license ci pre-commit.ci status

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+.

Usage

  • Download and unzip a release, or clone this project.
  • Copy the scripts subfolder into your project.
  • Customize the scripts as you like, add your own, and delete what you do not need.
  • Create or edit the pyproject.toml of your project:
    • Use the requires-python entry to specify the Python version you want to use.
    • List the dependencies of the tools you use in the dev dependency group.
    • If your project does not include a Python package, do not define the [build-system] table.
  • Profit.

Scripts

Initialization

Publishing

Documentation

Documentation

Use Get-Help to show the documentation of each script:

PS> Get-Help .\scripts\Release-Project.ps1 -Detailed

As a git submodule

Instead 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 scripts as 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 scripts symbolic link will not work. Recreate it:

    PS> Remove-Item scripts
    PS> git restore scripts

Details

  • uv sync --upgrade is used to create the Python virtual environment with the latest version of the dependencies, uv run is used to activate it.
  • Environment variables are automatically loaded from a .env file in the project root folder, if present. This mechanism is used to optionally store the virtual environment outside the project folder, until uv will support this natively.

Alternatives

Other common ways to reach the same goal:

About

A collection of PowerShell scripts to work with Python projects

Topics

Resources

License

Stars

Watchers

Forks