Setting Up Python Libraries logo

Setting Up Python Libraries

Community
wdm0006
setting-up-python-libraries

Sets up professional Python library projects with modern tooling (pyproject.toml, uv, ruff, pytest, pre-commit, GitHub Actions). Use when creating new Python libraries, modernizing existing projects to pyproject.toml, configuring linting/testing/CI, or setting up Makefiles and pre-commit hooks.

Overview

Publisherwdm0006
Repositorypython-skills
Skill namesetting-up-python-libraries
Stars
111
Forks
17
Bundled files
4
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 4 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by wdm0006 on GitHub. Read the source before you install it.

Installation

Install the Setting Up Python Libraries AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/wdm0006/python-skills/tree/main/skills/python/project-setup
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wdm0006/python-skills.git /tmp/python-skills
mkdir -p .claude/skills
cp -r /tmp/python-skills/skills/python/project-setup .claude/skills/setting-up-python-libraries
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Setting Up Python Libraries in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Setting Up Python Libraries on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Setting Up Python Libraries is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Python Library Project Setup

Quick Start

Create a new library with this structure:

my-library/
├── src/my_library/
│   ├── __init__.py
│   └── py.typed
├── tests/
├── pyproject.toml
├── Makefile
├── .pre-commit-config.yaml
└── .github/workflows/ci.yml

Use src/ layout to prevent accidental imports of development code.

Core Configuration

For complete templates, see:

  • PYPROJECT.md - Full pyproject.toml with all tool configs
  • CI.md - GitHub Actions and pre-commit setup
  • MAKEFILE.md - Makefile automation patterns

Minimal pyproject.toml

toml
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "my-library"
version = "0.1.0"
description = "What it does"
readme = "README.md"
requires-python = ">=3.10"
license = "MIT"  # SPDX expression
dependencies = []

[project.optional-dependencies]
dev = ["pytest>=7.0", "ruff>=0.1", "mypy>=1.0"]

[tool.setuptools.packages.find]
where = ["src"]

Essential Commands

bash
# Setup
uv sync --extra dev
pre-commit install

# Daily workflow
ruff check src tests        # Lint
ruff format src tests       # Format
pytest                      # Test
mypy src                    # Type check

Keep local checks identical to CI

The most common CI failure is not a bug — it's a check that passes locally but fails in CI (or vice versa) because the two run different commands. Two rules prevent an entire class of "green locally, red in CI" (and chronically-red base branch) problems:

1. make lint must be read-only — never --fix. A lint target that runs ruff check --fix mutates your files and almost always exits 0, so pre-existing violations silently sit on the branch while CI's read-only ruff check goes red. Put --fix only in format and the pre-commit hook. make lint should run the exact commands CI runs.

2. CI (and make lint) must check formatting too. ruff check and ruff format are different tools: the linter passing says nothing about formatting. Gate on both, or formatting drift ships / turns a branch red unexpectedly:

bash
ruff check src tests          # lint rules
ruff format --check src tests # formatting — REQUIRED, not implied by ruff check

Lint the same paths in the Makefile and CI (add examples/, docs/, etc. if they contain Python) — a narrower local scope lets violations accumulate in dirs CI checks. Configure ruff under [tool.ruff.lint] (not the deprecated top-level select/ignore), and keep requires-python and [tool.ruff] target-version in sync so ruff doesn't apply upgrade rules for a version you don't support.

For coverage, prefer running pytest --cov with a terminal report (--cov-report=term-missing) in the CI log over uploading to a third-party service — no external account, token, or network dependency in the gate.

Key Decisions

ChoiceRecommendationWhy
Layoutsrc/Catches packaging bugs early
Build backendsetuptoolsMature, broad compatibility
LinterruffFast, replaces flake8+isort+black
Python range>=3.10Don't pin exact versions
DependenciesMinimalMove optional deps to extras

Checklist

Project Setup:
- [ ] src/ layout with py.typed marker
- [ ] pyproject.toml (not setup.py)
- [ ] Makefile with dev/test/lint/format (lint read-only, no --fix)
- [ ] `make lint` runs the exact `ruff check` + `ruff format --check` CI runs
- [ ] Build-gating tools pinned (linter, formatter, toolchain, test runner) so upstream releases don't flip green/red on unrelated PRs
- [ ] .pre-commit-config.yaml
- [ ] .github/workflows/ci.yml
- [ ] README.md, LICENSE, CHANGELOG.md
- [ ] .gitignore

Helper Script

Create a new project structure:

bash
python scripts/create_project.py my-library --author "Name" --license MIT

--license takes an SPDX identifier (default MIT); a LICENSE file is generated for MIT and BSD-3-Clause.

Learn More

This skill is based on the Guide to Developing High-Quality Python Libraries by Will McGinnis. See these posts for deeper coverage:

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Setting Up Python Libraries AI skill do?

Sets up professional Python library projects with modern tooling (pyproject.toml, uv, ruff, pytest, pre-commit, GitHub Actions). Use when creating new Python libraries, modernizing existing projects to pyproject.toml, configuring linting/testing/CI, or setting up Makefiles and pre-commit hooks.

Why use Setting Up Python Libraries on TypingMind?

Because you install it once and use it with any model. Setting Up Python Libraries is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Setting Up Python Libraries in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wdm0006/python-skills/tree/main/skills/python/project-setup. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Setting Up Python Libraries?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Setting Up Python Libraries?

As many as you like. As long as a model supports skills, you can use Setting Up Python Libraries with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Setting Up Python Libraries AI skill free?

Yes. It is published on GitHub by wdm0006 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇