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.1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: jbang-0.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 cf66f6cd26dffa187f7e346d41bd9860ec25516a2259fa2ee0bbeab53814d6a2
MD5 33d9ed0116e769611e4b8e2a22d46191
BLAKE2b-256 28b68676f95b94aae86cb23bd4baaf0529fe1bfc660cdec30607099c9edb644e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jbang-0.3.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b7f97e3d2ec4bf9b99d754f719435ddbec8bcc460c05ee28742091cce380531a
MD5 9a8fd202f3baae46df8a68b583f2f555
BLAKE2b-256 0b6027d45fd41920b7f0843ae22a0f4338f587a8ec6b830e563d3d95e502f64a

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