py-automapper
Library for automatically mapping one object to another
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-automapperuv
uv add py-automapperpoetry
poetry add py-automapperInstalling 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
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
sqlmodelSQLModel combines SQLAlchemy and Pydantic to…
permissive · top 5,000 on PyPI
jsonschema-pydantic-converterConverts JSON Schema definitions to Pydantic v2…
permissive · top 15,000 on PyPI
sparkdanticConverts Pydantic models to PySpark schemas…
unclear · top 5,000 on PyPI
dydanticDynamically generates Pydantic models from JSON…
permissive · top 5,000 on PyPI
SQLAlchemySQLAlchemy is a Python SQL toolkit and Object…
permissive · top 100 on PyPI
jamboConverts JSON Schema definitions into Pydantic…
permissive · top 15,000 on PyPI
tortoise-ormTortoise ORM is an async-native…
permissive · top 15,000 on PyPI
jsonschema-pydanticConverts JSON Schema definitions into Pydantic…
unclear · top 15,000 on PyPI
dataclasses-avroschemaGenerates Avro schemas from Python dataclasses,…
permissive · top 5,000 on PyPI
pydantic-to-typescript2Converts Pydantic models to TypeScript…
permissive · top 15,000 on PyPI