Gramex 1.91 release notes

Gramex 1.91 adds multiple rate limits and Pytest based testing.

Multiple rate limits

Rate limit now supports multiple configuration values.

ratelimit can be an array of rate limit configurations. For example, to set 2 limit:

ratelimit:
  - pool: daily-user-pool
    keys: [daily, user]
    limit: 30
  - pool: daily-pool
    keys: [daily]
    limit: 100

You can now use handler.get_ratelimit() to access the rate limit for the current request.

More details about ratelimit can be found here

Pytest based testing

As we migrate from the unmaintained nosetests to pytest, we were running only pure Python tests with pytest.

Now, we run Gramex tests with pytest too. We first run gramex to start the server, then run pytest, then shut down the server.

Advantage: clean shutdown of the tests. (nosetests sometimes doesn’t cleanly shutdown)

================ test session starts ======================
platform win32 -- Python 3.9.13, pytest-7.2.0, pluggy-1.0.0
rootdir: C:\site\gramener.com\viz\async-gramex, configfile: pyproject.toml, testpaths: pytest
plugins: anyio-3.6.2, typeguard-4.0.0, yamlns-0.11.0
collected 53 items

pytest\test_chatgpthandler.py ..........      [ 18%]
pytest\test_cli.py .....                      [ 28%]
pytest\test_data.py .....................     [ 67%]

Bug fixes

Backward compatibility & security

Gramex 1.91 is backward compatible with previous releases unless the release notes say otherwise. We ensure this with automated tests.

Every Gramex release is tested for security vulnerabilities using the following tools.

  1. Bandit tests for back-end Python vulnerabilities. See Bandit results
  2. npm-audit tests for front-end JavaScript vulnerabilities. See npm-audit results
  3. Snyk for front-end and back-end vulnerabilities. See Synk results
  4. ClamAV for anti-virus scans. See ClamAV results
  5. Trivy for container scans. See Trivy results

Statistics

The Gramex code base has:

How to install

See the Gramex installation and upgrade instructions.