Λογότυπο Python

Python

Κοινότητα
Lynricsy
python

Guides the Python language and toolchain: uv, ruff, pyproject.toml, pytest, typing, asyncio. Use when writing, typing, testing or packaging Python code, editing pyproject.toml or uv.lock, or a test passes alone but fails in the full pytest run, including a one-off script that needs third-party packages.

Επισκόπηση

ΕκδότηςLynricsy
ΑποθετήριοHyperSkills
Όνομα δεξιότηταςpython
Αστέρια
26
Forks
0
Συνοδευτικά αρχεία
28
Άδεια χρήσηςMIT
Σύνδεσμοι
  • Οδηγίες σε Markdown

    Ένα αρχείο SKILL.md που το μοντέλο φορτώνει όταν χρειάζεται, ώστε να καταναλώνει token μόνο όταν ένα αίτημα είναι πράγματι σχετικό.

  • Λειτουργεί με οποιοδήποτε LLM

    Οι δεξιότητες AI είναι απλό Markdown, όχι κώδικας για συγκεκριμένο πάροχο, επομένως αυτή η δεξιότητα λειτουργεί με GPT, Claude, Gemini, Grok ή ένα τοπικό μοντέλο.

  • 28 συνοδευτικά αρχεία

    Σενάρια, πρότυπα και υλικό αναφοράς που μπορεί να διαβάζει το μοντέλο καθώς εργάζεται. Τα αρχεία είναι μόνο για ανάγνωση και δεν εκτελούνται ποτέ.

  • Ανοιχτού κώδικα

    Δημοσιεύτηκε από Lynricsy στο GitHub. Διαβάστε το πηγαίο περιεχόμενο πριν εγκαταστήσετε τη δεξιότητα.

Εγκατάσταση

Εγκαταστήστε τη δεξιότητα AI Python στο TypingMind για να τη χρησιμοποιείτε με οποιοδήποτε LLM ή προσθέστε τη σε άλλον πράκτορα AI που διαβάζει αρχεία SKILL.md.

1

Εγκατάσταση στο TypingMind

Το TypingMind εγκαθιστά μια δεξιότητα απευθείας από τον φάκελό της στο GitHub — διαβάζει το SKILL.md, συγκεντρώνει τα συνοδευτικά αρχεία σε πακέτο και αποθηκεύει το αποτέλεσμα τοπικά.

  1. Ανοίξτε την εφαρμογή και μεταβείτε στα Πρόσθετα → Δεξιότητες.
  2. Επιλέξτε «Εγκατάσταση από GitHub».
  3. Επικολλήστε το παρακάτω URL του φακέλου της δεξιότητας και επιβεβαιώστε.
    https://github.com/Lynricsy/HyperSkills/tree/main/skills/python
  4. Ενεργοποιήστε τη δεξιότητα σε κάθε συνομιλία όπου θέλετε να είναι διαθέσιμη.
Πρόσθετα → Δεξιότητες → Νέα δεξιότητα → Από URL του GitHub, έπειτα επικολλήστε το URL του φακέλου και πατήστε «Συνέχεια».
2

Εγκατάσταση σε άλλον πράκτορα AI

Κάθε πράκτορας AI που διαβάζει τη μορφή Agent Skills μπορεί να χρησιμοποιήσει αυτή τη δεξιότητα — αντιγράψτε τον φάκελο στον κατάλογο δεξιοτήτων του.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Lynricsy/HyperSkills.git /tmp/HyperSkills
mkdir -p .claude/skills
cp -r /tmp/HyperSkills/skills/python .claude/skills/python
Επανεκκινήστε το Claude Code μετά την αντιγραφή, ώστε να εντοπίσει τη νέα δεξιότητα.

Χρησιμοποιήστε τη στο TypingMind

Ενεργοποιήστε τη δεξιότητα Python σε οποιαδήποτε συνομιλία στο TypingMind και το μοντέλο αναλαμβάνει τα υπόλοιπα. Το όνομα και η περιγραφή της περιλαμβάνονται στην προτροπή συστήματος και, μόλις προκύψει ένα σχετικό αίτημα, το μοντέλο φορτώνει μόνο του τις πλήρεις οδηγίες — δεν χρειάζεται ποτέ να την καλείτε χειροκίνητα και δεν καταναλώνει token μέχρι να χρησιμοποιηθεί πραγματικά.

Το μοντέλο φορτώνει αυτόματα τη δεξιότητα Python μόλις λάβει ένα σχετικό αίτημα.

Λειτουργεί με οποιοδήποτε μοντέλο AI

Οι δεξιότητες AI είναι απλές οδηγίες Markdown και όχι κώδικας για συγκεκριμένο πάροχο, οπότε η δεξιότητα Python δεν περιορίζεται στο μοντέλο για το οποίο γράφτηκε. Εγκαταστήστε τη μία φορά στο TypingMind και χρησιμοποιήστε τη με GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ή ένα τοπικό μοντέλο που εκτελείτε εσείς — πάντα με τα δικά σας κλειδιά API.

  • Φόρτωση μόνο όταν χρειάζεται

    Η προτροπή συστήματος περιλαμβάνει μόνο το όνομα και την περιγραφή. Οι οδηγίες ανακτώνται με το πρώτο σχετικό αίτημα, οπότε μια δεξιότητα που δεν χρησιμοποιείται δεν έχει κόστος.

  • Αλλάξτε μοντέλα κατά τη συνομιλία

    Επειδή η δεξιότητα αποτελείται από οδηγίες και όχι από κώδικα, η αλλαγή μοντέλου δεν επηρεάζει τη λειτουργία της — το επόμενο μοντέλο διαβάζει το ίδιο αρχείο SKILL.md.

Οδηγίες δεξιότητας

Αυτό είναι το περιεχόμενο του αρχείου SKILL.md που φορτώνει το μοντέλο. Διαβάστε το πριν από την εγκατάσταση — μια δεξιότητα αποτελείται από οδηγίες που θα ακολουθήσει το μοντέλο σας.

python

Scope

Covers the Python language and its standard toolchain: uv for environments, dependencies and scripts; ruff for lint and format; pyproject.toml for project metadata, dependency groups, build backend and packaging; pytest for tests; static typing with mypy or pyright; asyncio; and the runtime traps that a type checker and a linter both miss.

Not covered: web frameworks — FastAPI request handling, dependency injection and response models are the fastapi skill's job; Django request handling, ORM models and migrations are the framework's own concern. Also not covered: data analysis and notebooks (pandas, numpy, Jupyter). Model training and fine-tuning: use the ml-training skill; calling a hosted model: the ai-engineering skill. For the discipline of driving code with tests rather than the pytest API, use the test-driven-development skill. For diagnosing a specific observed failure, use the debugging skill. For reviewing a diff, use the code-review skill.

Paths below are relative to this skill's directory.

Core rules

  1. Read pyproject.toml before changing anything. On an existing project its declared Python version, line length, type checker, test layout and rule set are the truth; the defaults here apply only when a field is absent or the project is new. Nothing annoys a maintainer faster than a tool swap nobody asked for.
  2. uv is the environment manager. Mutate dependencies with uv add / uv remove and run everything through uv run. Hand-editing the dependency tables skips resolution and leaves uv.lock stale; source .venv/bin/activate leaves the agent and CI in different environments.
  3. uv pip install is an escape hatch for a non-project virtualenv, never a way to add a project dependency — it writes nothing to pyproject.toml.
  4. Development tooling goes in [dependency-groups], not [project.optional-dependencies]. Groups are local-only; extras are published with the wheel, so an extra makes your linter part of your public API.
  5. Commit uv.lock for applications and for anything deployed. Libraries may leave it uncommitted, but then CI has no reproducible run — decide once and say which.
  6. A single file that needs third-party packages gets PEP 723 inline metadata (uv init --script, then uv add --script), not a requirements file and not a README telling people to pip install first. The dependencies key must be present even when empty, and inline metadata makes uv run ignore any surrounding project.
  7. ruff replaces flake8, black, isort, pydocstyle and pyupgrade — all of them, not some. ruff check and ruff format are two separate commands; running only the first leaves the file unformatted.
  8. Select ruff rules explicitly (E, F, UP, B, SIM, I is a good start) and widen a group at a time. select = ["ALL"] silently adopts every rule added in the next release, which turns a version bump into a lint failure.
  9. Fix only the diagnostics on lines this change touched. Pre-existing violations elsewhere get reported to the user, not swept up — "while I was here" is how a two-line fix becomes an unreviewable diff.
  10. Never let ruff check --fix and --unsafe-fixes run unattended in the same pass. Apply safe fixes, read the diff, then consider unsafe ones; unsafe fixes may change behaviour by design.
  11. Every # noqa and every # type: ignore names its code and its reason (# noqa: E501 — URL in docstring). A bare suppression is invisible to the next reader and to --extend-select RUF100.
  12. Type the boundaries first: public function signatures, class attributes, and anything crossing a process or module edge. Local variables the checker can infer do not need annotations.
  13. A dependency that several unrelated classes satisfy is a typing.Protocol, not a base class. Inheritance forces every implementation — including test stubs — to import your module.
  14. Structured payloads get a TypedDict, dataclass or Pydantic model. dict[str, Any] disables checking for everything downstream of it, which is worse than no annotation because it looks done.
  15. Turn strictness up per module, in batches, and keep the suite green between batches (references/typing.md). Flipping --strict on a large repo produces thousands of errors and one giant unreviewable commit.
  16. In pyproject.toml, [tool.pytest] needs pytest 9.0+; [tool.pytest.ini_options] works from 6.0. Put the table under the wrong name for your pinned version and pytest ignores the whole thing — markers, filterwarnings and asyncio_mode included — without warning.
  17. Fixture scope above function must be immutable or reset. A session-scoped object that tests mutate makes the suite order-dependent, which is why a file passes alone and fails in the full run.
  18. unittest.mock.patch replaces a name in the namespace that resolves it, so the target follows the import style of the module under test: from httpx import get means patching mymodule.get, while import httpx means httpx.get is the same object either way. Mocks for awaited callables are AsyncMock, not Mock; and a patch whose context exits before a background task runs asserts nothing.
  19. Keep a strong reference to every asyncio.create_task result, or create it inside asyncio.TaskGroup. The loop holds only weak references, so a fire-and-forget task can be garbage collected mid-flight.
  20. Prefer asyncio.TaskGroup over asyncio.gather. When a child fails, the group cancels its siblings; gather propagates the first exception and leaves the rest running. Use gather only when you need positional results or return_exceptions=True.
  21. No blocking call inside async def — not time.sleep, not requests, not a synchronous DB driver, not open().read() on a slow mount. One blocking call stalls every other task on the loop. Wrap unavoidable ones in asyncio.to_thread.
  22. If you catch asyncio.CancelledError, re-raise it after cleanup. Swallowing it breaks TaskGroup and asyncio.timeout, which are built on cancellation.
  23. Finish every change with the gate: uv run ruff format, uv run ruff check, the project's type checker on the touched paths, then uv run pytest. Report the commands and their output, not "should be fine".

Workflows

start-or-migrate-a-project

  • Classify the work: single file with dependencies → PEP 723 script; multi-file but not distributed → uv init; installable package → uv init --package with a src/ layout. The rest of this list is the package case.
  • Existing project? Inventory what is being replaced first: requirements*.txt, setup.py / setup.cfg, Pipfile, poetry.lock, .flake8, [tool.black], [tool.isort], mypy.ini, tox.ini. Migration steps per source are in references/uv-projects.md.
  • Bring runtime dependencies over with uv add -r requirements.txt (or uv add per package, reviewing each pin — an == from 2023 is a decision nobody re-made), then dev tooling with uv add --group dev ruff mypy and uv add --group test pytest pytest-cov.
  • Set requires-python to the oldest version you actually support. ruff infers target-version from it, so this one field decides which pyupgrade rewrites fire.
  • Configure ruff and the type checker (references/ruff.md, references/typing.md), and pytest under the table name your pinned pytest version reads (rule 16, detail in references/pytest.md).
  • Delete the replaced files in the same change. Two dependency sources in one tree is the failure mode: CI installs one, the developer installs the other.
  • Distributable? Choose the build backend and fill in packaging metadata via references/packaging.md.
  • Gate — reproducible from a clean checkout: uv sync --all-groups, then uv run ruff format --check, uv run ruff check, the type checker, and uv run pytest, all from a fresh clone with no pre-existing .venv.

add-types

  • Read the current state: which checker the project configures, whether this module is excluded, and how strict the surrounding modules already are.
  • Annotate the boundaries — public signatures and class attributes — and let inference handle locals.
  • Replace duck-typed parameters with a Protocol, and untyped mappings with a TypedDict or dataclass (rules 13–14, patterns in references/typing.md).
  • Pick the syntax for your floor: PEP 695 (def f[T](...), class C[T], type Alias = ...) needs Python 3.12+; below that use TypeVar. Say which you chose and why.
  • Remove this module from the exclusion list and raise strictness for it alone — a per-module override, not a global flag.
  • Run the checker on the touched paths first for fast feedback, fix, then widen the run to the package.
  • Any suppression left behind is # type: ignore[<code>] — <reason>. If the count is growing rather than shrinking, the batch is too big: stop and split it.
  • Gate — narrower than before, and green: the checker passes on the touched paths at the new strictness, the exclusion entry is gone, uv run pytest still passes, and every remaining ignore has a code and a reason.

write-or-fix-tests

  • Confirm pytest is reading your config at all: uv run pytest --help lists registered settings, and the startup header names the configfile it picked. A silently ignored table is the first thing to rule out (rule 16).
  • Put shared setup in a fixture in the nearest conftest.py, and default to function scope. Widen scope only for genuinely immutable or externally managed resources, and say what makes it safe.
  • Order-dependent failure? Run uv run pytest -p no:randomly versus the plain run, and uv run pytest --lf. Then look for shared mutable state: a non-function-scoped fixture, a module-level singleton, a mutable default argument, or a class attribute (references/runtime-traps.md).
  • Cover the same behaviour across inputs with @pytest.mark.parametrize and pytest.param(..., id=...); a failing case should name itself in the output.
  • Patch at the lookup site, use AsyncMock for awaited dependencies, and assert on calls (assert_called_once_with) rather than on the mock's existence (rule 18, detail in references/pytest.md).
  • Async tests need an async plugin and a declared mode; mixing asyncio_mode = "auto" with explicit @pytest.mark.asyncio is fine, missing both silently skips or errors the coroutine.
  • Gate — the failure is reproduced and then gone: the previously failing invocation now passes, the full uv run pytest passes, and if the bug was isolation you show the ordering that used to break it.

debug-async

  • Map the call path: is it fully async, or does an async def reach a synchronous library? Mixed paths are where the loop stalls.
  • Grep the async functions for blocking calls — time.sleep, requests., subprocess.run, sync DB drivers, plain file IO on network mounts — and move them behind asyncio.to_thread or an async client.
  • Audit task lifetime: every create_task result is stored or created inside a TaskGroup; nothing awaits a coroutine it never scheduled; no coroutine is left un-awaited (ruff RUF006, ASYNC and B rules catch several of these).
  • Audit cancellation: except asyncio.CancelledError re-raises, except Exception does not accidentally cover it (it derives from BaseException), and cleanup lives in finally.
  • Replace ad-hoc timeout logic with asyncio.timeout, and expect TimeoutError rather than CancelledError at the boundary.
  • Producer/consumer pipelines: the asyncio.Queue has a maxsize, producer and consumers share one TaskGroup, and on 3.13+ the producer ends the run with queue.shutdown() (consumers stop on QueueShutDown) instead of one None sentinel per consumer.
  • Turn on asyncio debug mode (PYTHONASYNCIODEBUG=1 or asyncio.run(main(), debug=True)) to get slow-callback warnings that point at the blocking frame. Details in references/asyncio.md.
  • Gate — the symptom is explained, not just gone: name the task, the blocking frame or the swallowed cancellation, and show the run where the symptom no longer appears.

publish

  • Confirm the metadata contract in references/packaging.md: [project] fields, PyPI name versus import name, readme, license, classifiers, and py.typed if the package ships types.
  • Decide the version source — static in pyproject.toml, or derived from git tags — and make sure exactly one place owns it.
  • Build and inspect before uploading: uv build, then check the wheel actually contains the package (a missing src/ mapping produces an empty wheel that installs cleanly and imports nothing).
  • Rehearse on TestPyPI, install from there into a throwaway environment, and import the package.
  • Publish from CI with Trusted Publishing (OIDC) rather than a long-lived API token stored in secrets.
  • Gate — installable and typed: uv run --isolated --no-project --with dist/<pkg>-<ver>-py3-none-any.whl python -c "import <pkg>" succeeds against the built artifact [verified], and the type checker sees the annotations the wheel actually ships.

Topic router

TopicRead whenFile
uv projects, groups, lockfile, tools, workspaces, PEP 723 scripts, migration from pip/PoetryCreating or migrating a project, or making a script self-containedreferences/uv-projects.md
ruff rule selection, per-file ignores, formatter settings, the fix loop, noqa disciplineConfiguring lint/format or working through a backlog of diagnosticsreferences/ruff.md
Protocol, TypedDict, PEP 695 generics, narrowing, Self, override, mypy and pyright config, strictness ratchetAdding or tightening annotationsreferences/typing.md
pytest config table versions, fixtures and scope, parametrization, isolation, mocking, async tests, pluginsWriting tests or chasing an order-dependent failurereferences/pytest.md
Task lifetime, TaskGroup, producer/consumer queues and Queue.shutdown, cancellation, timeouts, blocking-call detection, debug modeAnything with async def in itreferences/asyncio.md
pyproject.toml metadata, src layout, build backends, versioning, py.typed, publishingMaking a package installable or releasing itreferences/packaging.md
Mutable defaults, late-binding closures, class-attribute sharing, exception chaining, resource leaks, equality and caching trapsReviewing or debugging code that passes lint and the type checker but misbehavesreferences/runtime-traps.md

Environment

  • uv is the only required tool; it provisions Python itself (uv python install 3.13), so no system interpreter or pyenv is needed. Install with curl -LsSf https://astral.sh/uv/install.sh | sh.
  • ruff, mypy or pyright, and pytest are project dependencies, declared in [dependency-groups] and invoked as uv run ruff, uv run mypy, uv run pytest. Do not rely on globally installed copies: their versions differ from the project's and their diagnostics will not match CI.
  • uvx <tool> runs a tool without adding it to the project — useful for a one-off check, wrong for anything CI depends on.
  • When a command here does not exist in the project, say so and name the command the project does use, rather than substituting a global tool.

Συνοδευτικά αρχεία

Το μοντέλο τα διαβάζει όποτε χρειάζεται, όσο η δεξιότητα είναι φορτωμένη. Διατίθενται ως αρχεία για ανάγνωση και δεν εκτελούνται ποτέ.

Συχνές ερωτήσεις

Τι κάνει η δεξιότητα AI Python;

Guides the Python language and toolchain: uv, ruff, pyproject.toml, pytest, typing, asyncio. Use when writing, typing, testing or packaging Python code, editing pyproject.toml or uv.lock, or a test passes alone but fails in the full pytest run, including a one-off script that needs third-party packages.

Γιατί να χρησιμοποιήσετε τη δεξιότητα Python στο TypingMind;

Επειδή την εγκαθιστάτε μία φορά και τη χρησιμοποιείτε με οποιοδήποτε μοντέλο. Η Python είναι απλό Markdown και όχι κώδικας ειδικά για κάποιον πάροχο, επομένως η ίδια δεξιότητα λειτουργεί με GPT-5, Claude, Gemini, Grok ή ένα τοπικό μοντέλο — και μπορείτε να αλλάξετε μοντέλο κατά τη διάρκεια της συνομιλίας χωρίς να διακοπεί η λειτουργία της. Το TypingMind λειτουργεί με τα δικά σας κλειδιά API, οπότε πληρώνετε απευθείας τους παρόχους αντί για συνδρομή ανά θέση χρήστη, ενώ οι δεξιότητες και οι συνομιλίες σας παραμένουν στον δικό σας χώρο αποθήκευσης.

Πώς εγκαθιστώ τη Python στο TypingMind;

Στο TypingMind, ανοίξτε Πρόσθετα → Δεξιότητες → Εγκατάσταση από το GitHub και επικολλήστε το https://github.com/Lynricsy/HyperSkills/tree/main/skills/python. Το TypingMind διαβάζει το αρχείο SKILL.md, συγκεντρώνει τα συνοδευτικά αρχεία και εγκαθιστά τη δεξιότητα, την οποία μπορείτε να ενεργοποιείτε ανά συνομιλία.

Ποια μοντέλα AI μπορούν να χρησιμοποιήσουν τη δεξιότητα Python;

Οποιοδήποτε μοντέλο συνδέετε στο TypingMind. Οι δεξιότητες AI είναι απλές οδηγίες Markdown και όχι κώδικας ειδικά για κάποιον πάροχο, επομένως τα GPT, Claude, Gemini, Grok και τα τοπικά μοντέλα μπορούν όλα να φορτώσουν αυτή τη δεξιότητα όταν ένα αίτημα αντιστοιχεί σε αυτή.

Με πόσα μοντέλα AI μπορώ να χρησιμοποιήσω τη Python;

Με όσα θέλετε. Εφόσον ένα μοντέλο υποστηρίζει δεξιότητες, μπορείτε να χρησιμοποιήσετε τη Python με αυτό — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama και άλλα — όλα στο TypingMind με τα δικά σας κλειδιά API.

Είναι δωρεάν η δεξιότητα AI Python;

Ναι. Δημοσιεύεται στο GitHub από τον χρήστη Lynricsy με την άδεια χρήσης MIT. Πληρώνετε μόνο τον δικό σας πάροχο AI για τα token που χρησιμοποιείτε.

Τι είναι οι δεξιότητες AI;

Μια δεξιότητα AI είναι ένα επαναχρησιμοποιήσιμο πακέτο οδηγιών που διδάσκει σε ένα μοντέλο AI πώς να εκτελεί μια συγκεκριμένη εργασία. Ακολουθεί την ανοιχτή μορφή Agent Skills: ένα αρχείο SKILL.md με όνομα και περιγραφή, μαζί με τυχόν σενάρια κώδικα, πρότυπα ή αρχεία αναφοράς που μπορεί να χρειαστεί το μοντέλο. Το μοντέλο διαβάζει τις οδηγίες μόνο όταν το αίτημά σας αντιστοιχεί στη δεξιότητα, οπότε μια εγκατεστημένη δεξιότητα δεν κοστίζει τίποτα μέχρι να χρησιμοποιηθεί.

Σε τι διαφέρουν οι δεξιότητες AI από τα πρόσθετα ή τους συνδέσμους MCP;

Ένα πρόσθετο ή ένας σύνδεσμος MCP παρέχει στο μοντέλο νέα εργαλεία που μπορεί να καλέσει — κώδικα που εκτελείται κάπου και επιστρέφει ένα αποτέλεσμα. Μια δεξιότητα AI παρέχει αντί γι’ αυτό γνώσεις και διαδικασίες στο μοντέλο: πώς να προσεγγίσει μια εργασία, ποια βήματα να ακολουθήσει και ποια χαρακτηριστικά έχει ένα καλό αποτέλεσμα. Οι δεξιότητες είναι απλό Markdown, επομένως δεν χρειάζονται διακομιστή, κλειδί API ή περιβάλλον εκτέλεσης και λειτουργούν με οποιοδήποτε μοντέλο.

Προβολή όλων

Στήστε δικό σας χώρο εργασίας AI τώρα

Εγγραφείτε στο ενημερωτικό μας δελτίο για να ενημερώνεστε για νέες λειτουργίες και μελλοντικές κληρώσεις δώρων 👇