Spack Package Recipe
Package recipe defines the logic for package build. Spack follows the instructions and installs the package.
We can start creating package recipe with command,
spack create --name python-cli-app https://github.com/nitinsharmacs/python-cli-app
where --name
specifies package name followed by link.
This will create package directory in repo with a boilerplate package.py
, selected by spack. We can check the selected repo using command
spack repo list
whichever comes on top takes the precedence.
Following is the modified package.py
.
package.py
from spack.package import *
class PythonCliApp(PythonPackage):
"Python cli app spack package."
# FIXME: Add a proper url for your package's homepage here.
homepage = "https://github.com/nitinsharmacs/python-cli-app"
url = "https://github.com/nitinsharmacs/python-cli-app"
git = "https://github.com/nitinsharmacs/python-cli-app.git"
# FIXME: Add a list of GitHub accounts to
# notify when the package is updated.
# maintainers("nitinsharmacs")
# FIXME: Add the SPDX identifier of the project's license below.
# See https://spdx.org/licenses/ for a list. Upon manually verifying
# the license, set checked_by to your Github username.
# FIXME: Add proper versions and checksums here.
version("0.1.0", tag="v0.1.0")
# FIXME: Add dependencies if required.
# depends_on("foo")
depends_on("python@3.10", type=("build", "run"))
depends_on("py-poetry-core", type="build")
Once all the required information is added in package file, we can install it and use it.
spack install python-cli-app
spack load python-cli-app
This should make executables accessible in the current process.