Skip to main content

Package Scripts

Scripts for frequently performed Python development / maintainer tasks.

  • build - Build and (optionally) publish a package to PyPI
  • create-service - Generate and install a systemd unit file with the provided parameters
  • format - Run isort, ruff format, and ruff check.
  • bump-version - Update pyproject.toml with a new version, create git tag, push upstream
  • get-pr-link - Prints the GitHub page comparing your current branch to the default branch (so you can create a PR).


Installing

Create Virtual Environment

[!NOTE] Use whichever kind env you please, just make sure to use one to avoid clobbering your system pacakges.

mkdir -p ~/.local/opt/package-scripts
python3 -m venv ~/.local/opt/package-scripts
source ~/.local/opt/package-scripts/bin/activate

Set File Prefix

  • File prefixes should match the regex pattern [\w-]+.
  • With a prefix of 'run', the resulting files will be: run-build, run-format, run-bump-version, run-create-service.
export SCRIPT_PREFIX="run"

Install PyPI Package

 PACKAGE_SCRIPT_PREFIX="${SCRIPT_PREFIX:-run}" pip install --no-cache-dir package-scripts

Ensure Scripts are in PATH

Do one of the following:

  • Option 1 - Symlink the scripts from the virtual environment to any location already in PATH
for script in build format bump-version create-service; do
  ln -s "$HOME/.local/opt/package-scripts/bin/${PACKAGE_SCRIPT_PREFIX}-${script}" "$HOME/.local/bin/${PACKAGE_SCRIPT_PREFIX}-${script}"
done 
  • Option 2 - Copy the generated script files to a location in PATH
cp "$HOME/.local/opt/package-scripts/bin/${PACKAGE_SCRIPT_PREFIX}-"* "$HOME/.local/bin/"
  • Option 3 - Add the virtual environment's bin directory to PATH. This has the side effect of including every other executable file in that directory to the search path, so be warned.
# Append to PATH rather than prepend so that the executables we add will be used only if they don't exist elsewere.
echo "export PATH=$PATH:$HOME/.local/opt/package-scripts/bin" >> ~/.bashrc

Install Shell Completion

This will generate a file in the local shell completion directory

for script in build format bump-version create-service; do
  ${PACKAGE_SCRIPT_PREFIX}-${script} --install-completion
done

[!TIP] If you want to place the completion scripts elsewhere, you can redirect the output of ${PACKAGE_SCRIPT_PREFIX}-${script} --show-completion to your desired location instead of using --install-completion.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

package_scripts-0.4.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

package_scripts-0.4.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file package_scripts-0.4.0.tar.gz.

File metadata

  • Download URL: package_scripts-0.4.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for package_scripts-0.4.0.tar.gz
Algorithm Hash digest
SHA256 d4657376c47f76cf11df7710efa5da1c91916e127f9f314f9e17e3537d6762eb
MD5 34270e14269988d39e33fdf058f7e3fc
BLAKE2b-256 5cf74f7ad507e777da64458b9d87d856b8f58b99ab356785e285608d782978eb

See more details on using hashes here.

File details

Details for the file package_scripts-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for package_scripts-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 97ca00a371e5c0dc3ab481d92db15c95ccb5d87a4990009fe55fab7c515bf7fd
MD5 6efa227dce4ec9e7bb6db8f2fdfed2fe
BLAKE2b-256 147542bdc424e5c75104b74467b6c639d50881014e9a48057d56b941396c846f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 files

0.3.0

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page