A command line tool for creating Spark Packages and generating release distributions
Command Line Tool for working with Spark Packages
Please upgrade to latest version as spark-packages now supports SSL
pip install --upgrade spark-package
spark-package command line tool is your helper when developing new
The tool provides two methods:
spark-package -h to see the list of available
commands and options.
Initializes an empty project. Sets up the recommended directory layout and provides templates for
required files. The tool will prompt the user to select a license, but users may skip this process
by selecting the value for
other license (decide later).
A name must be supplied with the flag
--name. The name must match the name of the github
repository of the package. The layout for python can be generated with the flag
directories can be generated for R using
-r, directories and files for scala can
be generated with
--scala and java folders can be generated with
An output directory for the package can be supplied with
--out. The default for the output
path is the current working directory.
Generate a folder called “package” in the current directory setup with all files regarding to scala.
` spark-package init -n "test/package" `
Generate a folder called “package” in $PACKAGE_PATH setup with all files regarding to scala and python.
` spark-package init -s -p -n "test/package" -o $PACKAGE_PATH `
Creates a zip file for distribution on the Spark Packages website. If your package has java or
scala code, use the
sbt-spark-package plugin as it is more advanced. If your package is comprised
of just python code, use this command.
The package name must be supplied with
--name. In addition, the root directory of the
package must be supplied with
--folder. In addition, users must supply the version of the
release they want to distribute with the flag
--version. The output directory of the
zip file can be configured through
--out. The default path is the current working directory.
Generate a zip file for distribution on the Spark Packages website with release version 0.2.1.
` spark-package zip -f $PACKAGE_PATH -n "test/package" -v "0.2.1" `
Register your package on the Spark Packages website. Requires that you login to the Spark Packages
website at least once. In addition, a Github Personal Access Token with “read:org” permissions must be
supplied as a password. The credentials can be supplied through a file using
format of the file must be:
` user= $USERNAME password= $TOKEN `
Note: If there are multiple user, passwords, the last ones in the file will be used
For more information on Github Personal Access Tokens, please read the Github documentation.
Then you will be asked to enter a short description of your package, a long description, and the homepage of your package, which is by default the github repository of the package. The descriptions can be provided through files. Simply provide the relative path to the file once you are prompted.
Example usage: ` spark-package register -c $CREDS_FILE -n "test/package" # or spark-package register -u $GITHUB_USERNAME -p $GITHUB_PASSWORD -n "test/package" `
Publishes a new release on the Spark packages website. Like the
register command, requires credentials (see above).
Requires either the path to the package with
-f or the zip archive of the release artifact with
Example usage: ` spark-package publish -c $CREDS_FILE -f PACKAGE_PATH -n "test/package" -v "0.2.1" # or spark-package publish -c $CREDS_FILE -z $ZIP_FILE -n "test/package" -v "0.2.1" `
If you encounter bugs or want to contribute, feel free to submit an issue or pull request.