Skip to content

Instantly share code, notes, and snippets.

@datavudeja
datavudeja / allpyenv.py
Created February 9, 2025 21:55 — forked from oyale/allpyenv.py
A dead-simple script to perform bulk operations in all python virtualenvs installed
#! /bin/python
"""
A dead-simple script to perform bulk operations in all python virtualenvs installed
"""
import argparse
import os
import subprocess
import glob
@datavudeja
datavudeja / setup_virtualenv.py
Created February 9, 2025 21:55 — forked from Borillion/setup_virtualenv.py
This code creates a virtualenv environment in the directory specified by the -d or --env-dir command-line argument. If the directory does not exist, it will be created if the -c or --create option is used..
import os
import sys
import shutil
import subprocess
import argparse
# Set up command-line argument parser
parser = argparse.ArgumentParser(description='Set up a virtual environment.')
parser.add_argument('--env-dir', '-d', type=str, required=True,
help='Directory where the virtual environment should be set up.')
#!/usr/bin/env python
"""
Bootstrap script for prepare environ for project
"""
import os
import subprocess
import optparse
import sys
import os
import shlex
import subprocess
from subprocess import Popen
from pathlib import Path
class VirtualEnv(object):
"""
Create a VirtualEnv context manager.
@datavudeja
datavudeja / .bash_profile
Created February 9, 2025 22:00 — forked from zzarcon/.bash_profile
Git terminal helper
### GIT
source ~/.bash/gitprompt.sh
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
alias gss="git status --short"
alias gl="git log --pretty=format:'%Cred%h%Creset - %C(green) %an %C(reset) - %C(yellow)%d%Creset %s %Cgreen(%cr) %Creset'"
@datavudeja
datavudeja / build_artifact.py
Created February 9, 2025 22:03 — forked from grncdr/build_artifact.py
script to pack up a python project and all of it's dependencies in a tarfile using virtualenv
import subprocess
import shutil
import os
import sys
import tarfile
def get_version(project_root):
process = subprocess.Popen(
['git', 'describe'],
stdout=subprocess.PIPE,
@datavudeja
datavudeja / venv_link.py
Created February 9, 2025 22:04 — forked from davidfraser/venv_link.py
Script to link Python system package into virtual environment from Nick Coghlan at https://bitbucket.org/ncoghlan/misc/raw/44341af0b2e4ac7f9580d5f907d8f49c7013b3b9/venv_link.py Modified to use system python to find the module, and pip to decide the link location
@datavudeja
datavudeja / setup.py
Created February 9, 2025 22:05 — forked from juancarlospaco/setup.py
setup.py with post-install compilation of Cython and Go.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#
# To generate DEB package from Python Package:
# sudo pip3 install stdeb
# python3 setup.py --verbose --command-packages=stdeb.command bdist_deb
#
#
# To generate RPM package from Python Package:
@datavudeja
datavudeja / uvs
Created February 9, 2025 22:07 — forked from rgilton/uvs
uvs: A stand-in for the yet-to-exist `uv shell` command
#!/usr/bin/env python3
#
# uvs: A stand-in for the yet-to-exist `uv shell` subcommand
#
# Copyright 2024 Rob Gilton
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
@datavudeja
datavudeja / setup_venv.py
Created February 9, 2025 22:08 — forked from chgroeling/setup_venv.py
Small python script to setup an virtualenv and keep it up to date.
"""
This script creates a virtual environment and updates its dependencies.
The following features are supported.
- The script checks if the venv exists. If it does it will not recreate it.
- The script checks if the requirements.txt has changed. If it has, packages of the venv will be updated.
- The script checks if itself has changed. If it has, the venv will be recreated.
"""
import os