Skip to main content

A simple test package using setuptools

Project description

suanki-py-setuptool

Python Version License: MIT

A simple, optimized test package demonstrating modern Python packaging configurations using setuptools and pyproject.toml.

🚀 Features

  • Mathematical Utilities: Fast local processing algorithms.
  • CLI Ready: Built-in automated terminal shortcuts.
  • Modern Standards: Fully compatible with the src/ layout ecosystem.

📦 Installation

Install the package directly from your local wheel build or project root:

# Install from local source in editable mode
pip install -e .

# Or install the pre-compiled wheel archive
pip install dist/suanki_trader_tools-0.1.0-py3-none-any.whl

🛠️ Usage

Via Python Script

Import the core module functions into any Python execution environment:

import suanki_trader_tools

# Multiply any integer or float by two
result = suanki_trader_tools.multiply_by_two(10)
print(result)  # Output: 20

Via Terminal Command-Line (CLI)

Once installed, run the automated script directly from your shell path:

run-suanki

🧑‍💻 Development Setup

To configure this project for local development, testing, and modifications:

  1. Clone the repository structure.
  2. Initialize your isolated virtual environment:
    python3 -m venv .venv
    source .venv/bin/activate
    
  3. Install package builders and project dependencies:
    pip install build twine
    
  4. Regenerate distribution bundles:
    python -m build
    

📄 License

Distributed under the MIT License. See LICENSE for more information.

🚀 Python Packaging Interview Guide: Setuptools & Wheels

A high-density technical summary explaining modern Python build infrastructure, designed for rapid review and interview preparation.


🛠️ 1. What is setuptools?

setuptools is Python's foundational build backend. Its primary job is to process project metadata, source code, and assets to compile them into standardized, distributable software packages.

📌 Core Concepts to Remember:

  • The Declarative Standard: Running python setup.py commands is strictly deprecated. Modern setuptools runs silently behind the scenes, reading configuration settings directly from pyproject.toml (PEP 517/518).
  • Dependency Tracking: It declares project requirements, telling installation frontends (like pip) exactly which external upstream libraries must be pulled down.
  • CLI Automation: It automates command-line interface generation using [project.scripts]. It instructs the host operating system to map a terminal command directly to an internal Python function.

📦 2. What is a .whl (Wheel) File?

A Wheel is the standard built distribution format for Python software. Structurally, it is a standard .zip archive containing package modules and structural metadata, renamed with a .whl extension.

📌 Core Concepts to Remember:

  • Historical Context: It completely replaced legacy Source Distributions (.tar.gz) as the preferred installation format on PyPI.
  • The Installation Advantage: Wheels are pre-compiled. pip installs them by unzipping the archive directly into the system's site-packages directory. It skips running local configuration scripts or building binaries on the client machine, maximizing security and speed.
  • The Compatibility Tag System: Wheel filenames contain strict platform indicators (e.g., py3-none-any.whl):
    • py3: Language implementation (Compatible with Python 3 engines).
    • none: ABI tag (No reliance on specific Python C-API compiler internals).
    • any: Platform tag (Pure Python code capable of running on Windows, macOS, or Linux).

🎯 3. High-Frequency Interview Questions

Q1: What is the difference between an sdist and a Wheel?

  • sdist (Source Distribution, .tar.gz): Contains raw, uncompiled source code. The user's system must process and build it during installation.
  • Wheel (Built Distribution, .whl): Pre-compiled and structured. The user's machine skips the build phase entirely and extracts it instantly.

Q2: Why is the src/ directory layout highly recommended?

  • Answer: It enforces testing isolation. If source modules sit directly in the project root, testing frameworks can accidentally import local raw files. Placing modules under src/ forces tools to test the actual package built and installed by setuptools.

Q3: How do you compile a production-ready package today?

  • Answer: Install the standardized PyPA frontend build engine (pip install build) and run python -m build at the project root. This spins up an isolated build environment, processes the pyproject.toml directives via setuptools, and generates output files inside a dist/ directory.

📋 Essential Terminal Command Reference

# 1. Mount project locally in editable/development mode
pip install -e .

# 2. Compile clean source (sdist) and binary wheel packages
python -m build

# 3. Force install a pre-compiled wheel binary directly
pip install dist/package_name-0.1.0-py3-none-any.whl
pip uninstall suanki-py-setuptool -y

📋 How to install .whl

  • pip install build

trigger compilation

  • python -m build

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

suanki_trader_tools-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

suanki_trader_tools-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file suanki_trader_tools-0.1.0.tar.gz.

File metadata

  • Download URL: suanki_trader_tools-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for suanki_trader_tools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9eaea2c9e822211766ec9675d7606243264521671cd659157feaffb3c17e2035
MD5 1efa4b39227384ef408e65c03569c439
BLAKE2b-256 98b1be30f7b0e53cc3080fd209fb42cf137837399e410c6370ba822ed1626f24

See more details on using hashes here.

File details

Details for the file suanki_trader_tools-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for suanki_trader_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 984753a3bbbf792c8d6dba1f3df680f1f96c188ed206a0ccab9e8f77fd09f8fa
MD5 d02f6aff550a9bd5a7630180222fa0a3
BLAKE2b-256 6cc02130797de82383b10d67d08b1d8964959f382c2aa9564793a0fcece61555

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page