Build Your First Python Package!
Thu, 25 Apr 2024 16:00:00 GMT → Thu, 25 Apr 2024 19:00:00 GMT (d=3 hours, 0 seconds)
Workshop summary
Creating Python code that can be shared and reused is the gold-standard of open science. However, tools and skills to share your code can be tricky to learn. In this hands-on, online tutorial, you’ll learn how to turn your code into an installable Python module (a file containing Python code that defines functions, classes, and variables), that can be shared with others and installed into the python environment of your choice.
To get the most out of this tutorial, you should be familiar with writing Python code, writing and using functions and you should understand the concept of Python environments. You should also have Python and Hatch installed on your computer prior to attending. If you are newer to using Python environments and don’t have a preferred tool, then we recommend that you use conda. However, any environment tool that you prefer works well.
Learning Objectives
In this workshop you will learn:
- How to use the tool Hatch to simplify turning a Python script into a module that can be installed into any environment. An installable module is the most basic form of a Python package.
Learning Outcomes
After completing this workshop, you will be able to:
- Identify and explain the use of the basic components of a Python package: (a specific directory structure, an __init__.py file, a pyroject.toml file and some code);
- Create a basic python package that allows you to install your code into a local Python environment.
- Install your package in editable mode into a Python environment
We will also briefly discuss how LLM’s can be used to support tasks such as documenting and formatting your code to improve usability and maintainability. While also considering the ethical and logistical challenges, pitfalls and concerns associated with using AI based tools in software development.
What you need to complete this tutorial
To participate in this workshop, we suggest that you have experience writing Python code and Python functions.
You also should come to the workshop with:
- Hatch is installed on your computer. An overview of Hatch is here.
- Your favorite environment manager handy (Conda/Mamba, venv, etc). (NOTE: Hatch supports environment management too but we won’t be using Hatch environments in this workshop)
- Your favorite code editor interface and your favorite shell/terminal. Note: I will teach using VSCode for this workshop.
Format
This workshop will be held using the SpatialChat platform. SpatialChat will allow us to have an interactive online learning experience. Check out the video overview of the platform prior to attending the event.
Cost
This workshop is a pilot, so we're charging just a nominal fee of $10 to cover infrastructure costs. If the cost would prevent you from attending, please email [email protected] to request a free registration.
About the instructor
The workshop will be taught by Leah Wasser, the Executive Director and founder of pyOpenSci. Leah has over 20 years of experience teaching data-intensive science with an emphasis helping scientists work through the pain points of working with different types of data. She built both the NEON data skills training program where she also developed the Data Carpentry Geospatial R lessons. She also created the Earth data analytics program at CU Boulder where she designed and built the earthdatascience.org open education learning portal.
pyOpenSci is a diverse community that supports free and open Python tools for processing scientific data. We also build technical open source and open science skills through events like these and online learning resources.
About pyOpenSci
pyOpenSci is a diverse community that supports free and open Python tools for processing scientific data. We also build technical open source and open science skills through events like these and online learning resources.