Skip to main content

Python for JBang - Java Script in your Python

Project description

jbang-python - Java Script in your Python

Install and use JBang from Python-based projects.

Lets you use your own local scripts, JBang AppStore alias or any network reachable jar or Maven artifact.

Usage

The jbang.exec() function accepts a string that will be passed as the command-line arguments to the jbang executable.

Given this script test.py:

#! /usr/bin/env python
import jbang
jbang.exec('properties@jbangdev')

Now you can invoke the test script from the command-line:

python test.py

You can easily pass command-line arguments around:

import sys
args = ' '.join(sys.argv1:])
jbang.exec('com.myco.mylib:RELEASE ' + args)

So now if you run python test.py arg1 arg2, arg1 arg2 will be appended to the command executed.

Behind the scenes

When you run pip install - JBang and other dependencies will be installed. This uses the app setup command.

Opening a new terminal or shell may be required to be able to use the jbang command from the system PATH.

Improvements ?

This was made as a quick hack to see if it was possible to use JBang from Python based on jbang-npm. If you have any ideas on how to improve this, please open an issue or PR and lets see where this brings us.

Similar projects

  • jgo - allows execution of Maven artifacts by using Maven.

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

jbang-0.3.0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

jbang-0.3.0-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jbang-0.3.0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for jbang-0.3.0.tar.gz
Algorithm Hash digest
SHA256 eb89266f6ab5f2a5950eda60ceb808382deb8d4be9b35d15a690da0596dcb34f
MD5 dfca7f1179fb7d6d5be3a5d3e63b56ce
BLAKE2b-256 3cf795286950472254f72dac7171ff514b2d5de4c97c485c916d6282ce2fe8d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jbang-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for jbang-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9febdde4fce5da63f85ce1bb7c0f57bc1e67a0d2e30f0e66a5fea09efb8a5c34
MD5 c2a2b1d6ad406276d22ed4b0fd364f51
BLAKE2b-256 8d4e1fb578e9b8df04fee4c1744d178b9ae4cd5646bc0d024a9f44144eae3128

See more details on using hashes here.

Supported by

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