Country definitions that are based on the [ISO 3166](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes).

## CountryAlpha2

**Bases:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

CountryAlpha2 parses country codes in the [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format.

```py
from pydantic import BaseModel

from pydantic_extra_types.country import CountryAlpha2

class Product(BaseModel):
    made_in: CountryAlpha2

product = Product(made_in='ES')
print(product)
# > made_in='ES'
```

### Attributes

#### alpha3

The country code in the [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) format.

**Type:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

#### numeric\_code

The country code in the [ISO 3166-1 numeric](https://en.wikipedia.org/wiki/ISO_3166-1_numeric) format.

**Type:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

#### short\_name

The country short name.

**Type:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

## CountryAlpha3

**Bases:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

CountryAlpha3 parses country codes in the [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) format.

```py
from pydantic import BaseModel

from pydantic_extra_types.country import CountryAlpha3

class Product(BaseModel):
    made_in: CountryAlpha3

product = Product(made_in='USA')
print(product)
# > made_in='USA'
```

### Attributes

#### alpha2

The country code in the [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format.

**Type:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

#### numeric\_code

The country code in the [ISO 3166-1 numeric](https://en.wikipedia.org/wiki/ISO_3166-1_numeric) format.

**Type:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

#### short\_name

The country short name.

**Type:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

## CountryNumericCode

**Bases:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

CountryNumericCode parses country codes in the [ISO 3166-1 numeric](https://en.wikipedia.org/wiki/ISO_3166-1_numeric) format.

```py
from pydantic import BaseModel

from pydantic_extra_types.country import CountryNumericCode

class Product(BaseModel):
    made_in: CountryNumericCode

product = Product(made_in='840')
print(product)
# > made_in='840'
```

### Attributes

#### alpha2

The country code in the [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format.

**Type:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

#### alpha3

The country code in the [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) format.

**Type:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

#### short\_name

The country short name.

**Type:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

## CountryShortName

**Bases:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

CountryShortName parses country codes in the short name format.

```py
from pydantic import BaseModel

from pydantic_extra_types.country import CountryShortName

class Product(BaseModel):
    made_in: CountryShortName

product = Product(made_in='United States')
print(product)
# > made_in='United States'
```

### Attributes

#### alpha2

The country code in the [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format.

**Type:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

#### alpha3

The country code in the [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) format.

**Type:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

#### numeric\_code

The country code in the [ISO 3166-1 numeric](https://en.wikipedia.org/wiki/ISO_3166-1_numeric) format.

**Type:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

## Related pages

- [API Documentation](./api-documentation-index.md)
- [Concepts](./concepts-index.md)
- [Dev Tools](./dev-tools-index.md)
- [Error Messages](./error-messages-index.md)
- [Examples](./examples-index.md)
- [Integrations](./integrations-index.md)
- [Internals](./internals-index.md)
- [Production Tools](./production-tools-index.md)
- [Pydantic](./pydantic-index.md)
- [Pydantic Core](./pydantic-core-index.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
