skillfed

py-automapper

Library for automatically mapping one object to another

py-automapper v2.2.0 193.2K downloads/30d#9,853 on PyPI77
Permissive license MIT License Copyright (c) 2021 Andrii Nikolaienko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) AGING released

What it is and what it does

py-automapper is a field-mapping library designed for layered architectures where objects need to be converted between different representations—such as mapping domain models to API DTOs or database models to presentation objects. It automatically copies matching fields from a source object to a target class instance, with support for field name remapping, value overrides, and optional deep copying to control object reference sharing.

The library includes built-in extensions for popular frameworks: Pydantic/FastAPI models, TortoiseORM, and SQLAlchemy. You can register mappings once and reuse them, or map on-demand by specifying the target class. It handles dictionaries as source objects and allows customization through field mappings and extension points for advanced use cases.

Use it for:

  • Convert domain model objects to API response DTOs while selectively exposing only public fields.
  • Map database ORM models to Pydantic models for API endpoints.
  • Transform data between layers in a multilayer architecture without manual field-by-field assignment.
  • Remap dictionary data into typed Python objects with field name translation.
  • Create read-only API representations by filtering sensitive fields during object mapping.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Automatically maps object fields from one class to another, handling different field names, nested objects, and integration with Pydantic, TortoiseORM, and SQLAlchemy models.

Yes, with conditions. Install if you need straightforward object-to-object mapping in a layered architecture and work with Pydantic, SQLAlchemy, or TortoiseORM. The library is stable and dependency-free, but maintenance was recently renewed after a long pause—monitor the repository for follow-through on the maintainer's commitment to resume active development before relying on it for critical systems.

Install

py-automapper on PyPI

pip

pip install py-automapper

uv

uv add py-automapper

poetry

poetry add py-automapper

Installing py-automapper

Before you install

Low install friction with no runtime dependencies. Maintenance recently renewed after a pause; last release was 523 days ago but the maintainer has committed to resuming active development. Supports Python 3.8 through 3.13.

License in practice

MIT License permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.

Quickstart

pip install py-automapper

from automapper import mapper

class Source:
    def __init__(self, name: str, age: int):
        self.name = name
        self.age = age

class Target:
    def __init__(self, name: str):
        self.name = name

source = Source("John", age)
target = mapper.to(Target).map(source)
print(vars(target))

Verify before relying

  • Whether the maintainer's commitment to resume active development will result in regular releases and timely bug fixes.
  • Performance characteristics when mapping deeply nested object hierarchies or large collections.
  • Compatibility details with the latest versions of Pydantic v2, SQLAlchemy 2.x, and TortoiseORM.

Package facts

License MIT License Copyright (c) 2021 Andrii Nikolaienko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance aging — 523 days since the last release
Last repo commit
First released
Downloads 193,171/month — #9,853 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: py_automapper-2.2.0-py3-none-any.whl

Keywords: utils, dto, object-mapper, mapping, development

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Build ToolsTopic :: Software Development :: Libraries :: Python Modules

Tags

object mapping between classesdto conversion pythonautomatic field mappingpydantic model mappingsqlalchemy to dtodata transfer object mappercross-layer object conversion
dto-mappingorm-integrationlayered-architecture

More Python Modules packages