Skip to main content

Functions to calculate geometric properties of 2D and 3D shapes.

Project description

shapes_geometry

shapes_geometry is a lightweight Python package for performing geometry calculations for common 2D and 3D shapes. It provides simple functions to compute area, perimeter, volume, surface area, and other geometric properties — perfect for students, educators, and developers building math-related tools.


Features

  • 2D Shapes: Circle, Triangle, Square, Rectangle, Parallelogram, Rhombus, Trapezium, Kite, Semicircle, Regular Polygons (Pentagon, Hexagon, Octagon, Decagon)
  • 3D Shapes: Sphere, Cube, Cuboid, Cone, Cylinder
  • Simple API with functional structure (no classes)
  • Easy to extend and integrate into other Python projects

📌 Version History

v0.2 - Current Version

  • Added Torus and Ellipsoid Geometric Calculations.
  • Added Regular Polygon Calculations.
  • Added CalculationError which is raised when calculations cannot be performed.

v0.1.5

  • Added utils.validate_positive_numbers() for reusable validation.
  • Added Geometric Calculations for Capsule.

v0.1.4

  • Added utils.validate_positive_numbers() for reusable validation.
  • Applied consistent dimension checks across shapes (circle, cylinder, etc.).
  • Improved exception handling with:
    • ShapesGeometryError
    • InvalidDimensionError
    • InvalidCoordinateError

v0.1.3

  • Added support for more 2D and 3D shapes (parallelogram, trapezium, cone, etc.).
  • Introduced initial exception handling for invalid dimensions.

v0.1.2

  • Implemented core shapes: Circle, Square, Rectangle, Triangle, Cube, Sphere, Cylinder.
  • Added area, perimeter, surface area, and volume functions.

v0.1.1

  • Basic setup with __init__.py.
  • Organized shapes into modules.
  • First working release with Circle and Square.

Installation

pip install shapes-geometry

Example Usage

from shapes_geometry.shapes import circle, square, rectangle

print(circle.area(5))           # Output: 78.53981633974483
print(square.perimeter(4))      # Output: 16
print(rectangle.area(10, 5))    # Output: 50

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

shapes_geometry-0.2.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

shapes_geometry-0.2-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file shapes_geometry-0.2.tar.gz.

File metadata

  • Download URL: shapes_geometry-0.2.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for shapes_geometry-0.2.tar.gz
Algorithm Hash digest
SHA256 ffc5b9b2f4279b21d189ded40d8adbef97729817c1b995120d77773c97aa6e70
MD5 d3010cc6beaa3e189d58c24826a1ca64
BLAKE2b-256 002bef6b567b7f254741bdeebecb68be80548a562fd13180c97e6daf9de92cf0

See more details on using hashes here.

File details

Details for the file shapes_geometry-0.2-py3-none-any.whl.

File metadata

  • Download URL: shapes_geometry-0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for shapes_geometry-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a22b8e008dc866af8547c6a279355c8da9a2ce6c6945561f5994ddeffcc2f6c1
MD5 d682e93b4f592cf1e22bf83e3546d37f
BLAKE2b-256 a5b185ea7ee37c9d4ede6cc44bc4d47669b87e7461ae57c31c165b6350c37f15

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