Skip to content

B. Building & distributing packages

Johannes Hjorth edited this page Sep 30, 2024 · 6 revisions

Once the packaging branch is merged in, you will be able to easily distribute snudda through packages.

Building a wheel

git clone [email protected]:Hjorthmedh/Snudda
cd Snudda
python3 setup.py sdist bdist_wheel

This should provide you with a .whl file in the dist folder. You can install that on your own computer using

pip3 install dist/<distribution-file.whl>

To upload it to PyPI, use twine

twine upload --repository snudda  dist/snudda-<version>

Bonus tip:

To upgrade all packages in python:

pip3 freeze --local |sed -rn 's/^([^=# \t\\][^ \t=]*)=.*/echo; echo Processing \1 ...; pip3 install -U \1/p' |sh

Building spack package

Set up spack locally:

git clone https://github.com/spack/spack.git
source spack/share/spack/setup-env.sh

Set up local repository:

mkdir spack-local-testing
mkdir spack-local-testing/packages
mkdir spack-local-testing/packages/snudda
touch spack-local-testing/packages/snudda/package.py
cat <<EOT >> spack-local-testing/repo.yaml
repo:
  namespace: spack-local-testing
EOT
spack repo add spack-local-testing

Edit spack package.py (ebrains gitlab) (local mirror) :

You test it with:

spack install snudda

Each new version built will require an update to package.py (get MD5 hash from pypi.org).

Clone this wiki locally