« Back to talks

Bytesize: Python packaging

Bytesize: Python packaging

Converting Python scripts into packages for PyPI, Bioconda & Biocontainers

Bytesize 2023-05-02 Online

In this talk, I showed you how to take a Python script and turn it into a stand-alone command-line tool, ready for distribution via the Python Package Index (PyPI).

💡 You can download a .zip file of the “before” and “after” code examples demoed here.

Packaging your script up as a package is a good thing to do for a few reasons:

  • More people can use your scripts - not just within Nextflow
    • This is useful for development, for stand-alone testing
    • It’s useful for people using other workflow managers
    • It helps when users are testing a method / debugging with small sample sizes
  • It allows scripts to be released under different licenses to the pipeline itself
  • Software packaging, that is providing container images with all requirements, is handled automatically
  • Even if it’s a small script that you think no-one will ever use outside of your pipeline, it’s easy to do and you don’t lose anything 🙂

Once released in PyPI, releases via Bioconda are simple (see Bytesize 40: Software packaging). Once in Bioconda, software will be available for Conda users, but also Docker + Singularity, via the BioContainers project.

Website built using Astro and TailwindCSS
See website source code