Skip to content

Commit aefb212

Browse files
committed
Start introduction
1 parent 18e4c88 commit aefb212

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exclude: |-
77
)$
88
repos:
99
- repo: https://github.com/paddyroddy/.github
10-
rev: v0.355.0
10+
rev: v0.363.0
1111
hooks:
1212
- id: general-hooks
1313
- id: lua-hooks

python-packaging/index.qmd

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,52 @@ subtitle:
88
title: Python Packaging
99
---
1010

11+
# Introduction
12+
13+
## What is a Python Package
14+
15+
- A Python package is a toolbox that can be used to perform a variety of tasks.
16+
- A directory with a specific file structure.
17+
- The directory has modules (`.py` extension).
18+
- Modules allow one to group and structure Python code.
19+
- Modules contain functions and classes.
20+
21+
## Python Packages are Installable
22+
23+
- Allows one to add functionality within the package's code to any Python environment.
24+
- Packages can then simply be imported (`import numpy`).
25+
- Installing a package into an environment enables re-use across projects.
26+
- Structuring code as a package is the first step.
27+
28+
<!-- vale RedHat.TermsWarnings = NO -->
29+
30+
## Why Create a Python Package {data-menu-title="Why Create a Python Package (i)"}
31+
32+
<!-- vale RedHat.TermsWarnings = YES -->
33+
34+
- Use your code across different projects:
35+
- Allows one to install code into any Python environment.
36+
- Can import functions and classes into any workflow.
37+
- Build community around your code.
38+
- Packages make it easier for others to work on it.
39+
- Version control (`git`) makes it easy to track changes and contribute.
40+
- Tools such as issues and pull requests aid outside users to contribute.
41+
42+
## Why Create a Python Package {data-menu-title="Why Create a Python Package (ii)"}
43+
44+
- Share your code:
45+
- Can be installed on any machine using a single command (`pip`/`conda`).
46+
- Organise your code.
47+
- Packages can help organise large code projects.
48+
- Smaller, more manageable components.
49+
- Structure can help both supporting the codebase and making it easier to understand.
50+
51+
## What to Consider Before Creating a Package
52+
53+
- Who will use your package?
54+
- How people might use your project?
55+
- If relevant, what data will be used with your package?
56+
- Have you got documentation and tests?
57+
- How long will you be able to support it?
58+
1159
{{< include /_includes/qr-code.qmd >}}

0 commit comments

Comments
 (0)