or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.md
tile.json

tessl/pypi-sampleproject

A sample Python project that serves as a demonstration package for the Python Packaging User Guide

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/sampleproject@4.0.x

To install, run

npx @tessl/cli install tessl/pypi-sampleproject@4.0.0

index.mddocs/

Sample Project

A sample Python project that serves as a demonstration package for the Python Packaging User Guide. It provides a basic template structure for Python packages with proper packaging configuration using pyproject.toml, including a simple utility function and CLI entry point to demonstrate modern Python packaging practices.

Package Information

  • Package Name: sampleproject
  • Language: Python
  • Installation: pip install sampleproject
  • Python Requirements: >=3.9
  • Dependencies: peppercorn
  • License: MIT

Core Imports

import sample

For specific functions:

from sample import main
from sample.simple import add_one

Basic Usage

from sample import main
from sample.simple import add_one

# Use the utility function
result = add_one(5)  # Returns 6

# Call the main entry point function
main()  # Prints "Call your main application code here"

Command line usage:

# Execute the main entry point via CLI
sample

Capabilities

Entry Point Function

Main application entry point that prints a placeholder message. This function serves as the primary entry point for the package when used as an application.

def main() -> None:
    """Entry point for the application script"""

Utility Functions

Simple arithmetic utility function that demonstrates basic package functionality.

def add_one(number: int | float) -> int | float:
    """
    Add one to the given number.
    
    Args:
        number (int | float): Numeric value to increment
    
    Returns:
        int | float: The input number incremented by one
    """

Command Line Interface

CLI Commands

The package provides a command line script that executes the main entry point function.

sample
# Executes sample:main function
# No arguments required
# Prints "Call your main application code here"

Package Data

Data Files

The package includes a sample data file for demonstration purposes.

  • package_data.dat: Text file containing "some data"
  • Location: Bundled with the package installation
  • Access: Available through standard Python package data mechanisms

Accessing Package Data

# Using importlib.resources (Python 3.9+)
from importlib import resources

# Read data file contents
data_content = resources.read_text('sample', 'package_data.dat')
print(data_content)  # Output: "some data"

# Get path to data file
with resources.path('sample', 'package_data.dat') as data_path:
    print(f"Data file location: {data_path}")

Alternative approach using pkg_resources (for older Python versions):

import pkg_resources

# Get path to data file
data_path = pkg_resources.resource_filename('sample', 'package_data.dat')
with open(data_path, 'r') as f:
    data_content = f.read()
    print(data_content)  # Output: "some data"

Installation and Dependencies

Runtime Dependencies

  • peppercorn: Required runtime dependency

Optional Dependencies

Development extras:

pip install sampleproject[dev]  # Includes: check-manifest
pip install sampleproject[test]  # Includes: coverage

Python Version Support

  • Minimum: Python 3.9
  • Tested: Python 3.9, 3.10, 3.11, 3.12, 3.13