question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Automplete not working when using Python versions 3.9 or 3.10

See original GitHub issue
  • Faker version: 12.0.0
  • OS: Debian GNU/Linux 11 (bullseye)
OS versions
PS C:\Users\User\Guru> docker run -it --rm python:3.8 cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

PS C:\Users\User\Guru> docker run -it --rm python:3.9 cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

PS C:\Users\User\Guru> docker run -it --rm python:3.10 cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Tab autocomplete in python interactive shell unavailable when using Python versions 3.9 or 3.10.

Steps to reproduce

  1. Set up python 3.9 or 3.10 with faker installed
    1. An easy way to try this out is with docker
    2. docker run -it --rm python:3.8 bash
  2. Enter python shell with python
  3. Type import faker
  4. Type fake = faker.Faker()
  5. Type fake.
  6. Hit the tab button

Expected behavior

After I type in fake. and hit the tab key a few times, all available attributes of fake are shown. The very same ones you would get from dir(fake)

Python 3.8
PS C:\Users\User\Guru> docker run -it --rm python:3.8 bash
root@ac31d9ef666b:/# pip install faker
Collecting faker
Downloading Faker-12.0.0-py3-none-any.whl (1.5 MB)
    |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.5 MB 3.8 MB/s
Collecting python-dateutil>=2.4
Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
    |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 247 kB 22.1 MB/s
Collecting six>=1.5
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: six, python-dateutil, faker
Successfully installed faker-12.0.0 python-dateutil-2.8.2 six-1.16.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.2.4; however, version 22.0.3 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
root@ac31d9ef666b:/# python
Python 3.8.12 (default, Jan 29 2022, 05:06:10)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import faker
>>> fake = faker.Faker()
>>> fake.  # This is where I hit the tab button a few times
Display all 277 possibilities? (y or n)
fake.aba(                             fake.current_country_code(            fake.get_formatter(                   fake.mac_processor(                   fake.pylist(                          fake.street_name(
fake.add_provider(                    fake.date(                            fake.get_providers(                   fake.md5(                             fake.pyset(                           fake.street_suffix(
fake.address(                         fake.date_between(                    fake.hex_color(                       fake.military_apo(                    fake.pystr(                           fake.suffix(
fake.administrative_unit(             fake.date_between_dates(              fake.hexify(                          fake.military_dpo(                    fake.pystr_format(                    fake.suffix_female(
fake.am_pm(                           fake.date_object(                     fake.hostname(                        fake.military_ship(                   fake.pystruct(                        fake.suffix_male(
fake.android_platform_token(          fake.date_of_birth(                   fake.http_method(                     fake.military_state(                  fake.pytimezone(                      fake.suffix_nonbinary(
fake.ascii_company_email(             fake.date_this_century(               fake.iana_id(                         fake.mime_type(                       fake.pytuple(                         fake.swift(
fake.ascii_email(                     fake.date_this_decade(                fake.iban(                            fake.month(                           fake.random                           fake.swift11(
fake.ascii_free_email(                fake.date_this_month(                 fake.image(                           fake.month_name(                      fake.random_choices(                  fake.swift8(
fake.ascii_safe_email(                fake.date_this_year(                  fake.image_url(                       fake.msisdn(                          fake.random_digit(                    fake.tar(
fake.bank_country(                    fake.date_time(                       fake.internet_explorer(               fake.name(                            fake.random_digit_not_null(           fake.text(
fake.bban(                            fake.date_time_ad(                    fake.invalid_ssn(                     fake.name_female(                     fake.random_digit_not_null_or_empty(  fake.texts(
fake.binary(                          fake.date_time_between(               fake.ios_platform_token(              fake.name_male(                       fake.random_digit_or_empty(           fake.time(
fake.boolean(                         fake.date_time_between_dates(         fake.ipv4(                            fake.name_nonbinary(                  fake.random_element(                  fake.time_delta(
fake.bothify(                         fake.date_time_this_century(          fake.ipv4_network_class(              fake.nic_handle(                      fake.random_elements(                 fake.time_object(
fake.bs(                              fake.date_time_this_decade(           fake.ipv4_private(                    fake.nic_handles(                     fake.random_int(                      fake.time_series(
fake.building_number(                 fake.date_time_this_month(            fake.ipv4_public(                     fake.null_boolean(                    fake.random_letter(                   fake.timezone(
fake.cache_pattern                    fake.date_time_this_year(             fake.ipv6(                            fake.numerify(                        fake.random_letters(                  fake.tld(
fake.catch_phrase(                    fake.day_of_month(                    fake.isbn10(                          fake.opera(                           fake.random_lowercase_letter(         fake.tsv(
fake.century(                         fake.day_of_week(                     fake.isbn13(                          fake.paragraph(                       fake.random_number(                   fake.unique
fake.chrome(                          fake.del_arguments(                   fake.iso8601(                         fake.paragraphs(                      fake.random_sample(                   fake.unix_device(
fake.city(                            fake.dga(                             fake.items(                           fake.parse(                           fake.random_uppercase_letter(         fake.unix_partition(
fake.city_prefix(                     fake.domain_name(                     fake.itin(                            fake.password(                        fake.randomize_nb_elements(           fake.unix_time(
fake.city_suffix(                     fake.domain_word(                     fake.job(                             fake.past_date(                       fake.rgb_color(                       fake.upc_a(
fake.color(                           fake.dsv(                             fake.json(                            fake.past_datetime(                   fake.rgb_css_color(                   fake.upc_e(
fake.color_name(                      fake.ean(                             fake.language_code(                   fake.phone_number(                    fake.ripe_id(                         fake.uri(
fake.company(                         fake.ean13(                           fake.language_name(                   fake.port_number(                     fake.safari(                          fake.uri_extension(
fake.company_email(                   fake.ean8(                            fake.last_name(                       fake.postalcode(                      fake.safe_color_name(                 fake.uri_page(
fake.company_suffix(                  fake.ein(                             fake.last_name_female(                fake.postalcode_in_state(             fake.safe_domain_name(                fake.uri_path(
fake.coordinate(                      fake.email(                           fake.last_name_male(                  fake.postalcode_plus4(                fake.safe_email(                      fake.url(
fake.country(                         fake.factories                        fake.last_name_nonbinary(             fake.postcode(                        fake.safe_hex_color(                  fake.user_agent(
fake.country_calling_code(            fake.file_extension(                  fake.latitude(                        fake.postcode_in_state(               fake.secondary_address(               fake.user_name(
fake.country_code(                    fake.file_name(                       fake.latlng(                          fake.prefix(                          fake.seed                             fake.uuid4(
fake.credit_card_expire(              fake.file_path(                       fake.lexify(                          fake.prefix_female(                   fake.seed_instance(                   fake.weights
fake.credit_card_full(                fake.firefox(                         fake.license_plate(                   fake.prefix_male(                     fake.seed_locale(                     fake.windows_platform_token(
fake.credit_card_number(              fake.first_name(                      fake.linux_platform_token(            fake.prefix_nonbinary(                fake.sentence(                        fake.word(
fake.credit_card_provider(            fake.first_name_female(               fake.linux_processor(                 fake.pricetag(                        fake.sentences(                       fake.words(
fake.credit_card_security_code(       fake.first_name_male(                 fake.local_latlng(                    fake.profile(                         fake.set_arguments(                   fake.year(
fake.cryptocurrency(                  fake.first_name_nonbinary(            fake.locale(                          fake.provider(                        fake.set_formatter(                   fake.zip(
fake.cryptocurrency_code(             fake.fixed_width(                     fake.locales                          fake.providers                        fake.sha1(                            fake.zipcode(
fake.cryptocurrency_name(             fake.format(                          fake.localized_ean(                   fake.psv(                             fake.sha256(                          fake.zipcode_in_state(
fake.csv(                             fake.free_email(                      fake.localized_ean13(                 fake.pybool(                          fake.simple_profile(                  fake.zipcode_plus4(
fake.currency(                        fake.free_email_domain(               fake.localized_ean8(                  fake.pydecimal(                       fake.slug(
fake.currency_code(                   fake.future_date(                     fake.location_on_land(                fake.pydict(                          fake.ssn(
fake.currency_name(                   fake.future_datetime(                 fake.longitude(                       fake.pyfloat(                         fake.state(
fake.currency_symbol(                 fake.generator_attrs                  fake.mac_address(                     fake.pyint(                           fake.state_abbr(
fake.current_country(                 fake.get_arguments(                   fake.mac_platform_token(              fake.pyiterable(                      fake.street_address(

Actual behavior

Nothing is shown. The examples below show dir(fake). It’s hard to show me tabbing after I type in fake., but trust me, after I type in fake. and hit the tab key a couple of times, nothing happens.

Python 3.9
PS C:\Users\User\Guru> docker run -it --rm python:3.9 bash
root@f5111bad0450:/# pip install faker
Collecting faker
Downloading Faker-12.0.0-py3-none-any.whl (1.5 MB)
    |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.5 MB 4.6 MB/s
Collecting python-dateutil>=2.4
Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
    |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 247 kB 20.8 MB/s
Collecting six>=1.5
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: six, python-dateutil, faker
Successfully installed faker-12.0.0 python-dateutil-2.8.2 six-1.16.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.2.4; however, version 22.0.3 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
root@f5111bad0450:/# python
Python 3.9.10 (main, Jan 29 2022, 04:10:57)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import faker
>>> fake = faker.Faker()
>>> dir(fake)
['__annotations__', '__class__', '__deepcopy__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_factories', '_factory_map', '_locales', '_map_provider_method', '_select_factory', '_unique_proxy', '_weights', 'aba', 'add_provider', 'address', 'administrative_unit', 'am_pm', 'android_platform_token', 'ascii_company_email', 'ascii_email', 'ascii_free_email', 'ascii_safe_email', 'bank_country', 'bban', 'binary', 'boolean', 'bothify', 'bs', 'building_number', 'cache_pattern', 'catch_phrase', 'century', 'chrome', 'city', 'city_prefix', 'city_suffix', 'color', 'color_name', 'company', 'company_email', 'company_suffix', 'coordinate', 'country', 'country_calling_code', 'country_code', 'credit_card_expire', 'credit_card_full', 'credit_card_number', 'credit_card_provider', 'credit_card_security_code', 'cryptocurrency', 'cryptocurrency_code', 'cryptocurrency_name', 'csv', 'currency', 'currency_code', 'currency_name', 'currency_symbol', 'current_country', 'current_country_code', 'date', 'date_between', 'date_between_dates', 'date_object', 'date_of_birth', 'date_this_century', 'date_this_decade', 'date_this_month', 'date_this_year', 'date_time', 'date_time_ad', 'date_time_between', 'date_time_between_dates', 'date_time_this_century', 'date_time_this_decade', 'date_time_this_month', 'date_time_this_year', 'day_of_month', 'day_of_week', 'del_arguments', 'dga', 'domain_name', 'domain_word', 'dsv', 'ean', 'ean13', 'ean8', 'ein', 'email', 'factories', 'file_extension', 'file_name', 'file_path', 'firefox', 'first_name', 'first_name_female', 'first_name_male', 'first_name_nonbinary', 'fixed_width', 'format', 'free_email', 'free_email_domain', 'future_date', 'future_datetime', 'generator_attrs', 'get_arguments', 'get_formatter', 'get_providers', 'hex_color', 'hexify', 'hostname', 'http_method', 'iana_id', 'iban', 'image', 'image_url', 'internet_explorer', 'invalid_ssn', 'ios_platform_token', 'ipv4', 'ipv4_network_class', 'ipv4_private', 'ipv4_public', 'ipv6', 'isbn10', 'isbn13', 'iso8601', 'items', 'itin', 'job', 'json', 'language_code', 'language_name', 'last_name', 'last_name_female', 'last_name_male', 'last_name_nonbinary', 'latitude', 'latlng', 'lexify', 'license_plate', 'linux_platform_token', 'linux_processor', 'local_latlng', 'locale', 'locales', 'localized_ean', 'localized_ean13', 'localized_ean8', 'location_on_land', 'longitude', 'mac_address', 'mac_platform_token', 'mac_processor', 'md5', 'military_apo', 'military_dpo', 'military_ship', 'military_state', 'mime_type', 'month', 'month_name', 'msisdn', 'name', 'name_female', 'name_male', 'name_nonbinary', 'nic_handle', 'nic_handles', 'null_boolean', 'numerify', 'opera', 'paragraph', 'paragraphs', 'parse', 'password', 'past_date', 'past_datetime', 'phone_number', 'port_number', 'postalcode', 'postalcode_in_state', 'postalcode_plus4', 'postcode', 'postcode_in_state', 'prefix', 'prefix_female', 'prefix_male', 'prefix_nonbinary', 'pricetag', 'profile', 'provider', 'providers', 'psv', 'pybool', 'pydecimal', 'pydict', 'pyfloat', 'pyint', 'pyiterable', 'pylist', 'pyset', 'pystr', 'pystr_format', 'pystruct', 'pytimezone', 'pytuple', 'random', 'random_choices', 'random_digit', 'random_digit_not_null', 'random_digit_not_null_or_empty', 'random_digit_or_empty', 'random_element', 'random_elements', 'random_int', 'random_letter', 'random_letters', 'random_lowercase_letter', 'random_number', 'random_sample', 'random_uppercase_letter', 'randomize_nb_elements', 'rgb_color', 'rgb_css_color', 'ripe_id', 'safari', 'safe_color_name', 'safe_domain_name', 'safe_email', 'safe_hex_color', 'secondary_address', 'seed', 'seed_instance', 'seed_locale', 'sentence', 'sentences', 'set_arguments', 'set_formatter', 'sha1', 'sha256', 'simple_profile', 'slug', 'ssn', 'state', 'state_abbr', 'street_address', 'street_name', 'street_suffix', 'suffix', 'suffix_female', 'suffix_male', 'suffix_nonbinary', 'swift', 'swift11', 'swift8', 'tar', 'text', 'texts', 'time', 'time_delta', 'time_object', 'time_series', 'timezone', 'tld', 'tsv', 'unique', 'unix_device', 'unix_partition', 'unix_time', 'upc_a', 'upc_e', 'uri', 'uri_extension', 'uri_page', 'uri_path', 'url', 'user_agent', 'user_name', 'uuid4', 'weights', 'windows_platform_token', 'word', 'words', 'year', 'zip', 'zipcode', 'zipcode_in_state', 'zipcode_plus4']
>>> fake.  # Trust me, I hit the tab button a few times here and nothing happened
Python 3.10
PS C:\Users\User\Guru> docker run -it --rm python:3.10 bash
root@f4f9049d3170:/# pip install faker
Collecting faker
Downloading Faker-12.0.0-py3-none-any.whl (1.5 MB)
    |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.5 MB 4.9 MB/s
Collecting python-dateutil>=2.4
Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
    |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 247 kB 16.4 MB/s
Collecting six>=1.5
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: six, python-dateutil, faker
Successfully installed faker-12.0.0 python-dateutil-2.8.2 six-1.16.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.2.4; however, version 22.0.3 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
root@f4f9049d3170:/# python
Python 3.10.2 (main, Jan 29 2022, 02:41:17) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import faker
>>> fake = faker.Faker()
>>> dir(fake)
['__annotations__', '__class__', '__deepcopy__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_factories', '_factory_map', '_locales', '_map_provider_method', '_select_factory', '_unique_proxy', '_weights', 'aba', 'add_provider', 'address', 'administrative_unit', 'am_pm', 'android_platform_token', 'ascii_company_email', 'ascii_email', 'ascii_free_email', 'ascii_safe_email', 'bank_country', 'bban', 'binary', 'boolean', 'bothify', 'bs', 'building_number', 'cache_pattern', 'catch_phrase', 'century', 'chrome', 'city', 'city_prefix', 'city_suffix', 'color', 'color_name', 'company', 'company_email', 'company_suffix', 'coordinate', 'country', 'country_calling_code', 'country_code', 'credit_card_expire', 'credit_card_full', 'credit_card_number', 'credit_card_provider', 'credit_card_security_code', 'cryptocurrency', 'cryptocurrency_code', 'cryptocurrency_name', 'csv', 'currency', 'currency_code', 'currency_name', 'currency_symbol', 'current_country', 'current_country_code', 'date', 'date_between', 'date_between_dates', 'date_object', 'date_of_birth', 'date_this_century', 'date_this_decade', 'date_this_month', 'date_this_year', 'date_time', 'date_time_ad', 'date_time_between', 'date_time_between_dates', 'date_time_this_century', 'date_time_this_decade', 'date_time_this_month', 'date_time_this_year', 'day_of_month', 'day_of_week', 'del_arguments', 'dga', 'domain_name', 'domain_word', 'dsv', 'ean', 'ean13', 'ean8', 'ein', 'email', 'factories', 'file_extension', 'file_name', 'file_path', 'firefox', 'first_name', 'first_name_female', 'first_name_male', 'first_name_nonbinary', 'fixed_width', 'format', 'free_email', 'free_email_domain', 'future_date', 'future_datetime', 'generator_attrs', 'get_arguments', 'get_formatter', 'get_providers', 'hex_color', 'hexify', 'hostname', 'http_method', 'iana_id', 'iban', 'image', 'image_url', 'internet_explorer', 'invalid_ssn', 'ios_platform_token', 'ipv4', 'ipv4_network_class', 'ipv4_private', 'ipv4_public', 'ipv6', 'isbn10', 'isbn13', 'iso8601', 'items', 'itin', 'job', 'json', 'language_code', 'language_name', 'last_name', 'last_name_female', 'last_name_male', 'last_name_nonbinary', 'latitude', 'latlng', 'lexify', 'license_plate', 'linux_platform_token', 'linux_processor', 'local_latlng', 'locale', 'locales', 'localized_ean', 'localized_ean13', 'localized_ean8', 'location_on_land', 'longitude', 'mac_address', 'mac_platform_token', 'mac_processor', 'md5', 'military_apo', 'military_dpo', 'military_ship', 'military_state', 'mime_type', 'month', 'month_name', 'msisdn', 'name', 'name_female', 'name_male', 'name_nonbinary', 'nic_handle', 'nic_handles', 'null_boolean', 'numerify', 'opera', 'paragraph', 'paragraphs', 'parse', 'password', 'past_date', 'past_datetime', 'phone_number', 'port_number', 'postalcode', 'postalcode_in_state', 'postalcode_plus4', 'postcode', 'postcode_in_state', 'prefix', 'prefix_female', 'prefix_male', 'prefix_nonbinary', 'pricetag', 'profile', 'provider', 'providers', 'psv', 'pybool', 'pydecimal', 'pydict', 'pyfloat', 'pyint', 'pyiterable', 'pylist', 'pyset', 'pystr', 'pystr_format', 'pystruct', 'pytimezone', 'pytuple', 'random', 'random_choices', 'random_digit', 'random_digit_not_null', 'random_digit_not_null_or_empty', 'random_digit_or_empty', 'random_element', 'random_elements', 'random_int', 'random_letter', 'random_letters', 'random_lowercase_letter', 'random_number', 'random_sample', 'random_uppercase_letter', 'randomize_nb_elements', 'rgb_color', 'rgb_css_color', 'ripe_id', 'safari', 'safe_color_name', 'safe_domain_name', 'safe_email', 'safe_hex_color', 'secondary_address', 'seed', 'seed_instance', 'seed_locale', 'sentence', 'sentences', 'set_arguments', 'set_formatter', 'sha1', 'sha256', 'simple_profile', 'slug', 'ssn', 'state', 'state_abbr', 'street_address', 'street_name', 'street_suffix', 'suffix', 'suffix_female', 'suffix_male', 'suffix_nonbinary', 'swift', 'swift11', 'swift8', 'tar', 'text', 'texts', 'time', 'time_delta', 'time_object', 'time_series', 'timezone', 'tld', 'tsv', 'unique', 'unix_device', 'unix_partition', 'unix_time', 'upc_a', 'upc_e', 'uri', 'uri_extension', 'uri_page', 'uri_path', 'url', 'user_agent', 'user_name', 'uuid4', 'weights', 'windows_platform_token', 'word', 'words', 'year', 'zip', 'zipcode', 'zipcode_in_state', 'zipcode_plus4']
>>> fake.  # Trust me, I hit the tab button a few times here and nothing happened

Notes

Just to be thorough and prove that autocomplete works as expected in Python 3.9 and 3.10, here’s me proving that:

Python 3.9
PS C:\Users\User\Guru> docker run -it --rm python:3.9
Python 3.9.10 (main, Jan 29 2022, 04:10:57)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo:
...     a = "this"
...     b = "that"
...     c = "or"
...     d = "other"
...
>>> foo = Foo()
>>> foo.
foo.a  foo.b  foo.c  foo.d
>>> foo.
Python 3.10
PS C:\Users\User\Guru> docker run -it --rm python:3.10
Python 3.10.2 (main, Jan 29 2022, 02:41:17) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo:
...     a = "this"
...     b = "that"
...     c = "or"
...     d = "other"
...
>>> foo = Foo()
>>> foo.
foo.a  foo.b  foo.c  foo.d
>>> foo.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:23 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
tonycommented, Nov 12, 2022

This is a night and day difference.

Environment

Instructions

mkdir -p ~/projects/python; cd ~/projects/python
git clone https://github.com/joke2k/faker
git clone https://github.com/KaylaHood/faker-stubs

cd ~/projects/python/faker
virtualenv .venv
. .venv/bin/activate
pip install -e .
python ../faker-stubs/generate_stub.py

You should now see this with git status:

❯ git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        faker/proxy.pyi

If the faker/proxy.pyi stub is there, you will be able to see typings if you open any file, e.g. tests/test_proxy.py

Before (via here)

from faker import Faker

def test_faker(faker: Faker):
    assert isinstance(faker.name(), str)

image

With faker-stubs @ 77d25e7

image

image

Locale / faker constructor

re: locales

from faker import Faker

fake = Faker(locale="en")

Expected no arguments to β€œFaker” constructor (Pyright reportGeneralTypeIssues)

If the constructor itself allowed locale, we’d get around this particular one. Though we wouldn’t have locale-specific ones.

image

3reactions
KaylaHoodcommented, Nov 3, 2022

I’m just commenting to say that I’d greatly appreciate this feature as well. I’d imagine it would be trivial to add a mypy stub or similar to declare all of the many provider’s attributes as members of the base Faker class. I’m trying to write the stub file myself, I’ll try to remember to report back if it works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IDLE: Fix tab completion after settings and some keys
Opening a Settings windows with Options => Configure IDLE and closing with Apply and Cancel or OK (which also applies) disables tab completion....
Read more >
autocomplete-python not working for atom python 3.9
As an addendum, autocomplete-python has been behind on staying up-to-date with the latest jedi versions. You need version 0.17.2 for autocomplete-python to work...
Read more >
autocomplete-python traceback output Β· Issue #453 - GitHub
0. I have installed Jedi via pip install jedi==0.17. 2 and the traceback error appears every time I write something on the script....
Read more >
Python auto completion not working : r/DoomEmacs - Reddit
Every time I launch it with file name, like `emacs test.py`, it doesn't autocomplete until I run M-x python-mode. If I start emacs...
Read more >
argcomplete - PyPI
Argcomplete gets completions by running your program. ... This also works for alternate Python versions (e.g. python3 and pypy), as long as that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found