🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

rolling-pin

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rolling-pin

A library of generic tools for ETL work and visualization of JSON blobs and python repositories

0.11.2
PyPI
Maintainers
1

linkedin github pypi vimeo alexgbraun

Introduction

Rolling-pin is a library of generic tools for ETL work and visualization of JSON blobs and python repositories

See documentation for details.

See blob notebook for a demo of the BlobETL class.

See conform notebook for a demo of the ConformETL class.

See cli notebook for a demo of the rolling-pin CLI.

On the documentation main page, under the Architecture section, is a dynamically generated dependency graph of rolling-pin's current architecture. It is generated using the RepoETL class.

If you look under the Metrics section you will find Radon code metric plots and data of the rolling-pin source code, generated by the RadonETL class.

Installation for Developers

Docker

  • Install docker-desktop
  • Ensure docker-desktop has at least 4 GB of memory allocated to it.
  • git clone git@github.com:theNewFlesh/rolling-pin.git
  • cd rolling-pin
  • chmod +x bin/rolling-pin
  • bin/rolling-pin docker-start
    • If building on a M1 Mac run export DOCKER_DEFAULT_PLATFORM=linux/amd64 first.

The service should take a few minutes to start up.

Run bin/rolling-pin --help for more help on the command line tool.

ZSH Setup

  • bin/rolling-pin must be run from this repository's top level directory.

  • Therefore, if using zsh, it is recommended that you paste the following line in your ~/.zshrc file:

    • alias rolling-pin="cd [parent dir]/rolling-pin; bin/rolling-pin"
    • Replace [parent dir] with the parent directory of this repository
  • Consider adding the following line to your ~/.zshrc if you are using a M1 Mac:

    • export DOCKER_DEFAULT_PLATFORM=linux/amd64
  • Running the zsh-complete command will enable tab completions of the cli commands, in the next shell session.

    For example:

    • rolling-pin [tab] will show you all the cli options, which you can press tab to cycle through
    • rolling-pin docker-[tab] will show you only the cli options that begin with "docker-"

Installation for Production

Python

pip install rolling-pin

Please see the prod.dockerfile for an official example of how to build a docker image with rolling-pin.

Docker

  • Install docker-desktop
  • docker pull theNewFlesh/rolling-pin:[mode]-[version]

Quickstart Guide

This repository contains a suite commands for the whole development process. This includes everything from testing, to documentation generation and publishing pip packages.

These commands can be accessed through:

  • The VSCode task runner
  • The VSCode task runner side bar
  • A terminal running on the host OS
  • A terminal within this repositories docker container

Running the zsh-complete command will enable tab completions of the CLI. See the zsh setup section for more information.

Command Groups

Development commands are grouped by one of 10 prefixes:

CommandDescription
buildCommands for building packages for testing and pip publishing
dockerCommon docker commands such as build, start and stop
docsCommands for generating documentation and code metrics
libraryCommands for managing python package dependencies
sessionCommands for starting interactive sessions such as jupyter lab and python
stateCommand to display the current state of the repo and container
testCommands for running tests, linter and type annotations
versionCommands for bumping project versions
quickstartDisplay this quickstart guide
zshCommands for running a zsh session in the container and generating zsh completions

Common Commands

Here are some frequently used commands to get you started:

CommandDescription
docker-restartRestart container
docker-startStart container
docker-stopStop container
docs-fullGenerate documentation, coverage report, diagram and code
library-addAdd a given package to a given dependency group
library-graph-devGraph dependencies in dev environment
library-removeRemove a given package from a given dependency group
library-searchSearch for pip packages
library-updateUpdate dev dependencies
session-labRun jupyter lab server
stateState of
test-devRun all tests
test-lintRun linting and type checking
zshRun ZSH session inside container
zsh-completeGenerate ZSH completion script

Development CLI

bin/rolling-pin is a command line interface (defined in cli.py) that works with any version of python 2.7 and above, as it has no dependencies. Commands generally do not expect any arguments or flags.

Its usage pattern is: bin/rolling-pin COMMAND [-a --args]=ARGS [-h --help] [--dryrun]

Commands

The following is a complete list of all available development commands:

CommandDescription
build-edit-prod-dockerfileEdit prod.dockefile to use local package
build-local-packageGenerate local pip package in docker/dist
build-packageBuild production version of repo for publishing
build-prodPublish pip package of repo to PyPi
build-publishRun production tests first then publish pip package of repo to PyPi
build-testBuild test version of repo for prod testing
docker-buildBuild development image
docker-build-from-cacheBuild development image from registry cache
docker-build-no-cacheBuild development image without cache
docker-build-prodBuild production image
docker-build-prod-no-cacheBuild production image without cache
docker-containerDisplay the Docker container id
docker-destroyShutdown container and destroy its image
docker-destroy-prodShutdown production container and destroy its image
docker-imageDisplay the Docker image id
docker-prodStart production container
docker-pull-devPull development image from Docker registry
docker-pull-prodPull production image from Docker registry
docker-push-devPush development image to Docker registry
docker-push-dev-latestPush development image to Docker registry with dev-latest tag
docker-push-prodPush production image to Docker registry
docker-push-prod-latestPush production image to Docker registry with prod-latest tag
docker-removeRemove Docker image
docker-restartRestart container
docker-startStart container
docker-stopStop container
docsGenerate sphinx documentation
docs-architectureGenerate architecture.svg diagram from all import statements
docs-fullGenerate documentation, coverage report, diagram and code
docs-metricsGenerate code metrics report, plots and tables
library-addAdd a given package to a given dependency group
library-graph-devGraph dependencies in dev environment
library-graph-prodGraph dependencies in prod environment
library-install-devInstall all dependencies into dev environment
library-install-prodInstall all dependencies into prod environment
library-list-devList packages in dev environment
library-list-prodList packages in prod environment
library-lock-devResolve dev.lock file
library-lock-prodResolve prod.lock file
library-removeRemove a given package from a given dependency group
library-searchSearch for pip packages
library-sync-devSync dev environment with packages listed in dev.lock
library-sync-prodSync prod environment with packages listed in prod.lock
library-updateUpdate dev dependencies
library-update-pdmUpdate PDM
quickstartDisplay quickstart guide
session-labRun jupyter lab server
session-pythonRun python session with dev dependencies
stateState of repository and Docker container
test-coverageGenerate test coverage report
test-devRun all tests
test-fastTest all code excepts tests marked with SKIP_SLOWS_TESTS decorator
test-formatFormat all python files
test-lintRun linting and type checking
test-prodRun tests across all support python versions
versionFull resolution of repo: dependencies, linting, tests, docs, etc
version-bump-majorBump pyproject major version
version-bump-minorBump pyproject minor version
version-bump-patchBump pyproject patch version
version-commitTag with version and commit changes to master
zshRun ZSH session inside Docker container
zsh-completeGenerate oh-my-zsh completions
zsh-rootRun ZSH session as root inside Docker container

Flags

ShortLongDescription
-a--argsAdditional arguments, this can generally be ignored
-h--helpPrints command help message to stdout
--dryrunPrints command that would otherwise be run to stdout

Production CLI

Rolling-pin comes with a command line interface defined in command.py.

Its usage pattern is: rolling-pin COMMAND [ARGS] [FLAGS] [-h --help]

Commands

bash-completion

Prints BASH completion code to be written to a _rolling-pin completion file

Usage: rolling-pin bash-completion

zsh-completion

Prints ZSH completion code to be written to a _rolling-pin completion file

Usage: rolling-pin zsh-completion

conform

Copies source files to target filepaths according to given conform file.

Usage: rolling-pin conform [OPTIONS] SOURCE

ArgumentDescription
sourceconform YAML filepath
FlagArgumentDescriptionDefault
--groupstextcomma separated list of groups to be conformedall
--dryrun

Print out conform table instead of run conform

--help

print help message

graph

Generate a dependency graph of a source repository and write it to a given filepath

Usage: rolling-pin graph [OPTIONS] SOURCE TARGET

ArgumentDescription
sourcerepository path
targettarget filepath
FlagArgumentDescriptionDefault
--includetextinclude files that match this regex pattern.*.py$'
--excludetextexclude files that match this regex patterntest
--orienttextgraph orientationlr
--help

print help message

plot

Write radon metrics plots of given repository to given filepath.

Usage: rolling-pin plot [OPTIONS] SOURCE TARGET

ArgumentDescription
sourcerepository path
targetplot filepath
FlagDescription
--helpprint help message

table

Write radon metrics tables of given repository to given directory.

Usage: rolling-pin table [OPTIONS] SOURCE TARGET

ArgumentDescription
sourcerepository path
targettable directory
FlagDescription
--helpprint help message

toml

Generate a copy of a given TOML file with given edits indicated by flags. Flags are evalauted in the following order: edit, delete, search. Flags may be arbitrarily combined. Edit and delete flags may appear multiple times.

Usage: rolling-pin toml [OPTIONS] SOURCE

ArgumentDescription
sourceTOML filepath
FlagArgumentDescription
--edittextreplace key's value with given value, text is "=" separated key value pair in TOML format
--deletetextdelete keys that match this regular expression
--searchtextsearch for keys that match this regular expression
--targettexttarget filepath to write to
--help

print help message

Example Usage

example file

>>>cat example.toml
[root]
a = 1
b = 2

[root.foo.bar]
x = "y"

[world]
hello = true

edit flag

>>>rolling-pin toml foobar.toml --edit 'root.a=999'
[root]
a = 999
b = 2...

>>>rolling-pin toml foobar.toml \
        --edit 'root.a=[1, 2]'   \
        --edit 'root.b="xxx"'
[root]
a = [
    1,
    2,
]
b = "xxx"...

>>>rolling-pin toml foobar.toml --edit 'root.foo.bar="baz"'
...
hello = true

[root.foo]
bar = "baz"...

delete flag

>>>rolling-pin toml foobar.toml \
        --delete 'root.foo.bar'  \
        --delete 'root.a'
[root]
b = 2

[world]
hello = true

search flag

>>>rolling-pin toml foobar.toml --search 'root.foo|world'
[world]
hello = true

[root.foo.bar]
x = "y"

Keywords

ETL

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts