Removed APIs:
Person.political_views(),Person.worldview(), andPerson.views_on()Datetime.century()Payment.paypal()Science.measure_unit()andScience.metric_prefix()- Enums
MeasureUnitandMetricPrefixSign Internet.stock_image_url()
This release introduces a new schema generation system for relational data.
Breaking changes:
- Added
SchemaBuilderin mimesis.builder. - Removed the legacy
mimesis.schema.SchemaBuilder. - Removed
SchemaContext.pick_from()andSchemaContext.ref(). Existing schemas must be migrated to the new API.
SchemaBuilder:
- Supports lazy fields, record references, nested schemas, and automatic dependency resolution.
- Includes
reseed(),clear(), andreset()helpers. - Available via
from mimesis import SchemaBuilder.
- Added support for E.164 phone number formatting to the
Personprovider'sphone_number()method. - Added
secondary_address()method to theAddressprovider. - Add SHA-3 family hash algorithms (
SHA3_224,SHA3_256,SHA3_384,SHA3_512,SHAKE128,SHAKE256) to theAlgorithmenum. - Add
future_date(),future_datetime(),past_date()andpast_datetime()methods for theDatetimeprovider. See (#775).
- Added many key functions for various transformations.
- Removed the
pytestplugin from the package. Use project-specific fixtures and theFieldclass instead. - Removed the
builtinsmodule from the package. Use custom field handlers. - The
Cryptographicprovider now uses a seedable random number generator instead of thesecretsmodule. See (#1656). - Add
jwt,api_keyandcertificate_fingerprintmethods for theCryptographicprovider. - Add
SchemaBuilderfor generating relational data. - Add
ip_v4_cidr(),ip_v6_cidr()andcloud_region()methods for theInternetprovider.
- Added support of Arabic for various arabic countries.
- Added the iata_code() method for the Address provider.
- Added the icao_code() method for the Address provider.
- Added the asn method for the Internet provider.
- Added the special_ip_v4_object() and special_ip_v4() methods for the Internet provider, along with the IPv4Purpose enum for those methods.
- Added
mimesis.enums.DurationUnitenum. - Added
.duration()method forDatetimeprovider to generate random durations.
- Removed unsafe and inaproppriate words from datasets. See #1511
- Fix file permissions in Windows.
- Minor fixes in
factory_boyplugin.
- Integrated mimesis-factory into Mimesis itself. See mimesis-factory#246 and mimesis#1494 for more information.
- Fixed street suffixes for locale Locale.HR.
- Made pytest-mimesis a part of Mimesis itself.
- Removed the age() and work_experience() methods from the Person provider. Use
person.random.randint()instead. - Fixed type hints for Generic. (See #1471).
- Added the birthdate() method to the Person provider. (See #1470).
- Added Croatian locale support (
Locale.HR). Great appreciation to @CerealKiller0807 for this contribution.
- Methods
gender_code()andgender_symbol()have been added for thePersonprovider. - The methods
gender()andsex()no longer accept arguments likeiso5218andsymbol. Please usegender_code()andgender_symbol()instead. - Added a stub for
mimesis.providers.generic.py, enabling type hints forGeneric.
- Python 3.8 and 3.9 are no longer supported.
- Added support for field aliases. See the docs for more information.
- Added the method calver for Development.
- Added the method stage for Development.
- Added the method country_emoji_flag for Address.
- Removed the method hashtags from the Internet provider. Use the words method from the Text provider instead.
- Removed the providers parameter for Field and Fieldset. Use custom field handlers instead.
- Removed the parameters pre_release and calver for Development.version. Use the stage and calver methods instead.
- Moved the method emoji from the Internet provider to the Text provider.
- Moved the method dsn from the Development provider to the Internet provider.
- The Text().emoji() method now supports the category parameter and EmojiCategory enum. It also returns an emoji instead of an emoji shortcut string.
- Added the decorator @handle for Field and Fieldset to register custom fields.
- Renamed register_field to register_handler for Field and Fieldset.
- Renamed register_fields to register_handlers for Field and Fieldset.
- Renamed unregister_field to unregister_handler for Field and Fieldset.
- Renamed unregister_fields to unregister_handlers for Field and Fieldset.
- Renamed unregister_all_fields to unregister_all_handlers for Field and Fieldset.
Added:
- Added support for registering custom fields for
Schema. This allows you to use your own fields in schemas. See docs for more information.
Added:
- Added a new method
system_quality_attribute()(and its aliasility()) forDevelopment.
Added:
- Added a new enum
TimestampFormatfor thetimestamp()method.
Updated:
- The method
timestamp()forDatetime()now expects one of the following timestamp formats: TimestampFormat.POSIX, TimestampFormat.RFC_3339, or TimestampFormat.ISO_8601. - The
datetime()method now has default parameters start and end set to the current year.
Removed:
- The method timestamp() no longer accepts the
posixparameter.
Updated:
romanize()is a key function now. See docs for more information.
Removed:
- Removed method
swear_word()ofText(). This method is inappropriate and lacks practical utility.
Note
This release contains some breaking changes in Schema's API.
Updated:
- Key functions now may accept additional
randomas a parameter. See docs for more information.
Removed:
- The
loopmethod for theSchema, which was considered deprecated and unsafe, has been removed. - The
iterationsparameter for all methods ofSchemahas been removed. Instead, you now have to specify the number of iterations on instantiation ofSchemapassing theiterationsparameter. - The
iteratormethod forSchemahas been removed. Instead, you can now use an instance ofSchemadirectly as an iterator. - The multiplication is no longer supported for
Schema. Instead, you can use theiterationsparameter on instantiation ofSchema.
Added:
- Add
weighted_choice()method forRandom(). See docs for more information. - Add module
keysfor generating key functions.
Added
Fieldset()to generate a set of fields at once. See docs for more information.bank()method forFinance().default_countryforAddress(), which always returns the country associated with the current locale (i.eUnited Statesforen,Россияforru).
Removed:
- Removed parameter
allow_randomforcountry(). Now method returns random country by default.
Added
pytest-randomlyintegration, not by default it will set the global seed for every provider and all fields. This can still be reseeded as usual.http_request_headers()andhttp_response_headers()methods forInternetprovider. These methods return a dictionary of common headers.reseed()method forField.
Removed:
stock_image()method which required an active HTTP connection. Usestock_image_urlinstead.
Updated:
- Actualized data
- Removed outdated data
Removed:
- Removed parameter
model_maskforairplane() - Removed method
truck()ofTransport(), usemenufacturer()instead. - Removed method
cpu_model()ofHardware().
- Improve random sampling performance.
- Make field support different delimiters for
provider.method.
Fixed:
- Fixed memory leak on using
Field.
Optimizations:
- Improved performance of
_load_data().
Fixed:
- Fixed
ValidationFailureforInternet().uri().
Removed:
- Removed support of
portparameter inInternet().uri().
Version 5.6.0
Added:
- Multiplication support for schemas. Now you can use * on the schema to specify the number of iterations. See docs for more information.
- Method
dsn()forDevelopment() - Method
public_dns()forInternet()
Fixed:
- Fixed infinite loop on using
Datetime.bulk_create_datetimes(). - Fixed some typing issues
Fixed:
- Fixed TypeError: 'Datetime' object is not callable error on using
Field(See #1139).
Added:
- Added items
Algorithm.BLAKE2BandAlgorithm.BLAKE2S.
Removed:
- Removed deprecated method
image_placeholder()fromInternet()
Added:
- Added method
to_pickle(),to_json()andto_csv()forschema.Schema.
Optimizations:
- Significantly improved performance of
shortcuts.romanize() - Use
random.choices()to generate random strings instead ofrandom.choice()for selecting individual characters. This can lead to a significant speed up, but will also change the reproducibility of values when upgrading to this version as the two methods use different algorithms. - Optimized
Address.latitude(),Address.longitude(), andAddress.coordinates()when passingdms=True. - Optimized
Development.version().
Fixed:
- Fix duplication of parameter name on using
Internet.query_parameter()(See #1177). - Fix reseeding of the random generator of
Generic. This was a regression in v5.1.0. (See #1150). Development.version()now supports use of both thecalverandpre_releaseflags together.- Providers now have an isolated
randominstance when using a seed ofNone.
Removed:
- Removed all params of
mnemonic_phrase()
Added:
- Added parameter
regionforDatetime().timezone()and enum objectenums.TimezoneRegion
Fixed:
- Fix mechanism of reseeding of the internal providers of
Generic(See #1115).
Removed:
- Removed inappropriate words from
mimesis.data.int.USERNAMES.
Warning: This release contains some breaking changes in API.
Python compatibility:
Mimesis 5.0 supports Python 3.8, 3.9, and 3.10.
The Mimesis 4.1.3 is the last to support Python 3.6 and 3.7.
Reworked:
- A method
Person().username(), now it accepts a parametersmaskanddrange.
Renamed:
- Renamed
enums.UnitNametoenums.MeasureUnit - Renamed
enums.PrefixSigntoenums.MetricPrefixSign - Renamed
Business()toFinance() - Renamed
BaseDataProvider.pulltoBaseDataProvider._load_datafile - Renamed
mimesis.providers.numbers.Numberstomimesis.providers.numeric.Numeric - Renamed
fmtargument ofAddress().country_code()tocode
Fixed:
- Fix inheritance issues for
Generic, now it inheritsBaseProviderinstead ofBaseDataProvider - Fix locale-independent provider to make them accepts keyword-only arguments
- Fix DenmarkSpecProvider CPR to generate valid CPR numbers.
- Fix
.cvv()to make it return string - Fix
.cid()to make it return string - Fix
.price()ofFinanceto make it return float.
Added:
- Added method
hostname()forInternetdata provider - Added support of
**kwargsfor a methodadd_providerofGeneric()provider - Added enum
Localetomimesis.enumsandmimesis.locales - Added
measure_unitandmetric_prefixmethods for theScienceprovider. - Added
.iterator()forschema.Schema - Added methods
.slug()andip_v4_with_port()forInternet() - Added
increment()method forNumbers() - Added methods
.stock_ticker(),.stock_name()and.stock_exchange()forFinance() - Added
BinaryFiledata provider which provides binary data files, such as.mp3,.mp4,.png, etc.
Removed:
- Removed module
decorators. Useshortcuts.romanizeto romanize Cyrillic strings. - Removed
as_objectparameter for.uuid(). Now it returns string by default, if you need uuid4 object then use.uuid_object() - Removed invalid names and surnames from
person.jsonforrulocale - Removed data provider
UnitSystem(), useScience()instead - Removed data provider
Structure(), useschema.Schemainstead - Removed builtin provider
GermanySpecProvider - Removed data provider
Clothing, useNumbersinstead - Removed method
copyright()ofFinance() - Removed method
network_protocol()ofInternet() - Removed params
with_portandport_rangeforip_v4()ofInternet(). Useip_v4_with_port()instead. - Removed methods
sexual_orientation,social_media_profileandavatarof thePerson()provider. - Removed a bunch of useless custom exceptions and replaced them with
FieldError. - Removed completely useless
chemical_elementandatomic_numbermethods ofSciencedata provider and made it locale-independent.
Added:
- Added
py.typedfile to the package - Added
Python 3.9support
Fix:
- Fixed type hint issue for
schema.Schema(#928)
Fix:
- Fixed issue with non-unique uuid
Added:
- Added method
manufacturer()for classTransport() - Added
sk(Slovak) locale support - Added new parameter
uniquefor methodPerson().email() - Added new parameter
as_objectfor methodCryptographic().uuid()
Updated:
- Updated parameter
endfor some methods of providerDatetime()(Fix #870) - Updated
.price()to make it supported locales (Fix #875)
Rename:
- Renamed
decorators.romanizedtodecorators.romanize - Renamed
Random.schoicetoRandom.generate_string - Renamed
BaseDataProvider.pulltoBaseDataProvider._pull
Removed:
- Removed the deprecated
download_image()function from theshortcutsmodule, use your own custom downloader instead. - Removed parameter
versionfor methodCryptographic().uuid()
Warning
This release (4.0.0) contains some insignificant but breaking changes in API, please be careful.
Added:
- Added an alias
first_name(*args, **kwargs)for the methodPerson().name() - Added an alias
sex(*args, **kwargs)for the methodPerson().gender() - Added method
randstr()for classRandom() - Added method
complexes()for the providerNumbers() - Added method
matrixfor the providerNumbers() - Added method
integer_number()for the providerNumbers() - Added method
float_number()for the providerNumbers() - Added method
complex_number()for the providerNumbers() - Added method
decimal_number()for the providerNumbers() - Added method
ip_v4_object()andip_v6_objectfor the providerInternet(). Now you can generate IP objects, not just strings. - Added new parameter
port_rangefor methodip_v4() - Added new parameter
separatorfor methodCryptographic().mnemonic_phrase()
Fixed:
- Fixed issue with invalid email addresses on using custom domains without
@forPerson().email()
Updated:
- Updated names and surnames for locale
ru - The
floats()function in theNumbersprovider now accepts arguments about the range of the generated float numbers and the rounding used. By default, it generates a list ofnfloat numbers instead of a list of 10^n elements. - The argument
lengthof the functionintegersis renamed ton.
Removed:
- Removed the
rating()method from theNumbersprovider. It can be replaced withfloat_number(). - Removed the
primes()method from theNumbersprovider. - Removed the
digit()method from theNumbersprovider. Useinteger_number()instead. - Removed the
between()method from theNumbersprovider. Useinteger_number()instead. - Removed the
math_formula()method from theScienceprovider. - Removed
roundingargument fromfloats(). Now it'sprecision.
Fixed:
country()from theAddress()provider now by default returns the country name of the current locale.- Separated Europe and Asia continents in Italian locale.
Removed:
- Removed duplicated names in the countries of
etlocale.
Added:
- Added built-in provider DenmarkSpecProvider
- Added meta classes for providers for internal usage (see #621.)
- Added support for custom templates in
Person().username() - Added
ItalianSpecProvider()
Fixed:
- Support of seed for custom providers
currency_iso_codefrom theBusiness()provider now by default returns the currency code of the current locale.
Removed:
- Removed
multiple_choice()in therandommodule because it was unused and it could be replaced withrandom.choices. - Removed legacy method
child_count()from providerPerson()
Fixed:
- Fixed
UnsupportedFieldon using fieldchoice, #619
Warning
This release (3.0.0) contains some breaking changes in API
Warning
In this release (3.0.0) we've reject support of Python 3.5
Added:
- Added provider
Choice() - Added method
formatted_time()forDatetime()provider - Added method
formatted_date()forDatetime()provider - Added method
formatted_datetime()forDatetime()provider - Added support of timezones (optional) for
Datetime().datetime() - Added method to bulk create datetime objects:
Datetime().bulk_create_datetimes() - Added
kppforRussiaSpecProvider - Added
PolandSpecProviderbuiltin data provider - Added context manager to temporarily overriding locale -
BaseDataProvider.override_locale() - Added method
token_urlsafe()forCryptographicprovider - Added 6k+ username words
Updated:
- Updated documentation
- Updated data for
plandfr - Updated SNILS algorithm for
RussiaSpecProvider - Updated method
Datetime().time()to return onlydatetime.timeobject - Updated method
Datetime().date()to return onlydatetime.dateobject - Completely annotated all functions
- Locale independent providers inherit
BaseProviderinstead ofBaseDataProvider(it's mean that locale independent providers does not support parameterlocaleanymore) - Now you can add to Generic only providers which are subclasses of
BaseProviderto ensure a single instance ofrandom.Random()for all providers
Renamed:
- Renamed provider
ClothingSizestoClothing, so now it can contain any data related to clothing, not sizes only - Renamed
Science().dna()toScience().dna_sequence() - Renamed
Science().rna()toScience().rna_sequence() - Renamed module
helpers.pytorandom.py - Renamed module
config.pytolocales.py - Renamed module
utils.pytoshortcuts.py - Renamed
Cryptographic().bytes()toCryptographic.token_bytes() - Renamed
Cryptographic().token()toCryptographic.token_hex()
Removed:
- Removed deprecated argument
fmtforDatetime().date(), useDatetime().formatted_date()instead - Removed deprecated argument
fmtforDatetime().time(), useDatetime().formatted_time()instead - Removed deprecated argument
humanizeforDatetime().datetime(), useDatetime().formatted_datetime()instead - Removed deprecated method
Science.scientific_article() - Removed deprecated providers
Games - Removed deprecated method
Structure().json(), useschema.Schema()andschema.Fieldinstead - Removed deprecated and useless method:
Development().backend() - Removed deprecated and useless method:
Development().frontend() - Removed deprecated and useless method:
Development().version_control_system() - Removed deprecated and useless method:
Development().container() - Removed deprecated and useless method:
Development().database() - Removed deprecated method
Internet().category_of_website() - Removed duplicated method
Internet().image_by_keyword(), useInternet().stock_image()withkeywordsinstead - Removed deprecated JapanSpecProvider (it didn't fit the definition of the data provider)
- Removed deprecated method
Internet().subreddit() - Removed
Cryptographic().salt()useCryptographic().token_hex()orCryptographic().token_bytes()instead - Removed methods
Person.favorite_movie(),Person.favorite_music_genre(),Person.level_of_english()because they did not related toPersonprovider
Fixed:
- Fixed bug with seed
- Fixed issue with names on downloading images
- Fixed issue with
Nonein username forPerson().username() - Other minor improvements and fix
Added:
- Added a list of all supported locales as
mimesis/locales.py
Updated:
- Changed how
Internetprovider works withstock_image - Changed how
randommodule works, now exposing globalRandominstance - Updated dependencies
- Updated
choiceto make it a provider with more output types
Fixed:
- Prevents
ROMANIZED_DICTfrom mutating - Fixed
appveyourbuilds - Fixed
flake8-builtinschecks - Fixed some
mypyissues with strict mode - Fixed number of elements returned by
choicewithunique=True
Removed:
- Removed internal function
utils.locale_infowhich duplicateutils.setup_locale
Note
This release (2.0.0) contains some breaking changes and this means that you should update names of classes and methods in your code.
Added:
- Added items
IOCandFIFAfor enum objectCountryCode - Added support of custom providers for
schema.Field - Added support of parameter
dmsforcoordinates, longitude, latitude - Added method
Text.rgb_color - Added support of parameter
safefor methodText.hex_color - Added an alias
zip_codeforAddress.postal_code
Optimizations:
- Significantly improved performance of
schema.Field - Other minor improvements
Updated/Renamed:
- Updated method
integers - Renamed provider
PersonaltoPerson - Renamed provider
StructuredtoStructure - Renamed provider
ClothingSizestoClothing - Renamed json file
personal.jsontoperson.jsonfor all locales - Renamed
country_iso_codetocountry_codeinAddressdata provider
Added:
- Added method
RussiaSpecProvider.inn
Fixed:
- Fixed issue with seed for
providers.Cryptographic.bytes - Fixed issue #375
Optimizations:
- Optimized method
Text.hex_color - Optimized method
Address.coordinates - Optimized method
Internet.ip_v6
Tests:
- Grouped tests in classes
- Added tests for seeded data providers
- Other minor optimizations and improvements
Added:
- Added function for multiple choice
helpers.Random.multiple_choice
Fixed:
- Fixed issue with
seed#325
Optimizations:
- Optimized method
username()
Mover/Removed:
- Moved
custom_codetohelpers.Random
Optimizations:
- Optimized function
custom_codeand it works faster by ≈ 50% - Other minor optimizations in data providers
Added:
- Added method
ethereum_addressforPayment - Added method
get_current_localeforBaseProvider - Added method
booleanforDevelopmentwhich returns random boolean value - Added method
integersforNumbers - Added new built in specific provider
UkraineSpecProvider - Added support of
key functionsfor the objectschema.Field - Added object
schema.Schemawhich helps generate data by schema
Fixed:
- Fixed issue
full_namewhen method return female surname for male name and vice versa - Fixed bug with improper handling of attributes that begin with an underscore for class
schema.Field
Updated:
- Updated method
versionfor supporting pre-releases and calendar versioning - Renamed methods
international,europeanandcustomtointernational_size,european_sizeandcustom_size
Updated:
- Fixed #304
This is a first major version of mimesis and here are breaking
changes (including changes related to support for only the latest
versions of Python, i.e Python 3.5 and Python 3.6), so there
is no backwards compatibility with early versions of this library.
Added:
- Added
Fieldfor generating data by schema - Added new module
typing.pyfor custom types - Added new module
enums.pyand support of enums in arguments of methods - Added
category_of_websiteandporttoInternetdata provider - Added
mnemonic_phraseforCryptographydata provider - Added
price_in_btcandcurrency_symboltoBusinessdata provider - Added
dna,rnaandatomic_numbertoSciencedata provider - Added
vehicle_registration_codetoTransportdata provider - Added
generate_stringmethod forRandom - Added alias
last_nameforsurnameinPersonaldata provider - Added alias
province,region,federal_subjectforstateinAddressdata provider - Added annotations for all methods and functions for supporting type hints
- Added new data provider
Payment - Added new methods to
Payment:credit_card_network,credit_card_owner
Fixed:
- Fixed issue with
primesinNumbersdata provider - Fixed issue with repeated output on using
Code().custom code - Other minor fix and improvements
Mover/Removed:
- Moved
credit_card,credit_card_expiration_date,cid,cvv,paypalandbitcointoPaymentfromPersonal - Moved
custom_codetoutils.pyfromproviders.code.Code - Removed some useless methods
- Removed module
constants, in view of adding more convenient and useful moduleenums - Removed non informative custom exception
WrongArgumentand replaced one withKeyErrorandNonEnumerableError - Parameter
categoryof methodhashtagsis deprecated and was removed - Removed all methods from
UnitSystemand replaced ones withunit().
Updated/Renamed:
- Updated data for
de-at,en,fr,pl,pt-br,pt,ru,uk - Other minor updates in other languages
- Renamed
currency_isotocurrency_iso_codein Businessdata provider