Skip to main content

Useful tool for generating variable names

Project description

Contributor Covenant License Language

Closed Issues Commit Activity Build Status

EPONYM

Useful tool for generating variable names. Uses wordsapi.com

Getting Started

Source code

git clone https://github.com/seanchristians/eponym
pip3 install -r eponym/src/requirements.txt

PyPI

pip3 install eponym-alloy

Usage

Eponym can be used as part of a project or by itself. Pass a single string sentence to eponym.synonyms to generate an array of synonyms. eponym.rand takes that array as input and returns a word according to some options. Eponym relies on WordsAPI to generate synonyms. To use the service, create an account on RapidAPI and get a free API key for WordsAPI.

API Key

The script can interpret an API key from three different sources:

  • Any environment variable (defaults to $APIKEY)
  • A file
  • Direct input text To set your API key, you can define it in the script or run export APIKEY="[RapidAPI Application Key]"

Script functionality

usage: python3 -m eponym [-h] [-k KEY] [-l] [-w] [-s SEP] [-m MAX] words [words ...]

Variable name generator

positional arguments:
  words              list of input words

optional arguments:
  -h, --help         show this help message and exit
  -k KEY, --key KEY  api key
  -l, --lower        output lowercase
  -w, --words        output word count
  -s SEP, --sep SEP  word separator
  -m MAX, --max MAX  maximum word length for each synonym

Purging the cache

The script will not automatically clear the cache when terms expire after 6 months. Instead, you can write a cron job to do it yourself or do it manually. Run python3 -c "import eponym; eponym.cache.purge()" to clear the cache of expired items.

Caching

Eponym relies on WordsAPI. In order to reduce calls to the API and retain bandwidth, all requests go through cache.get which builds and maintains a local cache of searched results. cache.py refreshes the cache every cache.timeDelta which is currently set to 6 months.

Languages

Currently, the project only supports English. This is due to both sole use of wordsapi.com and a filter which removes non English letters. See CONTRIBUTING to help out!


© 2020 Sean Christians

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eponym-alloy-1.0.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

eponym_alloy-1.0.1-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file eponym-alloy-1.0.1.tar.gz.

File metadata

  • Download URL: eponym-alloy-1.0.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for eponym-alloy-1.0.1.tar.gz
Algorithm Hash digest
SHA256 9765a23bb1879548ed9acce1bbd08ea2f854c209dc5c1bf54c7ba6c3c6cac832
MD5 f784a042297ef25239f490b7685b4869
BLAKE2b-256 6672246f0227416094bdc3804b69ec5576d21566ad82dbcb7f8dc2c394ab0c79

See more details on using hashes here.

File details

Details for the file eponym_alloy-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: eponym_alloy-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for eponym_alloy-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6c450a4e260576d366dc4110167492e3ff359dc60bfb8ac5a5ff2b57342899e1
MD5 dde4fe23f5d6384eeee0394d603b400f
BLAKE2b-256 73df21471f69cb302032d761e0cd354687fd1db20e8cbb368cf577de5bdfac39

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page