Skip to main content

Scripts for frequently performed Python development tasks.

Project description

Package Scripts

Scripts for frequently performed Python development 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


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.

Project details


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.3.0.tar.gz (12.4 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.3.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: package_scripts-0.3.0.tar.gz
  • Upload date:
  • Size: 12.4 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.3.0.tar.gz
Algorithm Hash digest
SHA256 18edbc050f1c3fc1cfb08802f459f55ac3ae2bfb351c7dca4a250245c0edd4cd
MD5 835371ea6cdad0e0ece849f81ec9c75d
BLAKE2b-256 11edd841f6e06e40417c024747ee708bcf5dc6948ad604baeec65fce2e02477c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for package_scripts-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37a0add5254a6a1342767fc67a6ce4354f094a302d8c7d0cb7e61ab99dcffd72
MD5 6645cbf19f5d202c8c60313464826081
BLAKE2b-256 fdaf60a03e1a9779ff1e3c5660315c6f7aa0e663e8fd12257f672d56d0330d39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page