Skip to main content

DataKitchen Inc. extension of requests package

Project description

Requests Extensions

Usage

...

Developement Setup

This repository requires Python 3.10 at minimum -- prefer the latest 3.10.X.

Installation

Prefer using a virtual Python environment when installing. Tools such as virtualenv can be used to set up the environment using a specific Python version. pyenv can be used to install the desired Python version if your choice of OS does not provide it for you.

Example install

python -m virtualenv -p /usr/bin/python3.10 venv
source venv/bin/activate
# Install platform and developer extra packages
pip install --editable '.[dev]'

Testing

pytest is used to run test.

cd /to/requests_extensions
pytest # runs both unit and integration tests

Pre-commit + Linting

We enforce the use of certain linting tools. To not get caught by the build-system's checks, you should use pre-commit to scan your commits before they go upstream.

The following hooks are enabled in pre-commit:

  • black: The black formatter is enforced on the project. We use a basic configuration. Ideally this should solve any and all formatting questions we might encounter.
  • isort: the isort import-sorter is enforced on the project. We use it with the black profile.

To enable pre-commit from within your virtual environment, simply run:

pip install pre-commit
pre-commit install

Additional tools

These tools should be used by the developer because the build-system will enforce that the code complies with them. These tools are pinned in the dev extra-requirements of pyproject.toml, so you can acquire them with

# within environment
pip install .[dev]

We use the following additional tools:

  • pytest: This tool is used to run the test e.g. pytest .
  • mypy: This is a static and dynamic type-checking tool. This also checks for unreachable and non-returning code. See pyproject.toml for its settings. This tool is not included in pre-commit because doing so would require installing this repo's package and additional stubs into the pre-commit environment, which is inadvised by pre-commit, and poorly supported.

FAQ: mypy errors

I've encountered 'Unused "type: ignore" comment'

Good news, this means that mypy has found symbols for the thing which you are ignoring. That means its time to enable type-checking on these code-paths.

To resolve this error, do two things:

  1. Remove the ignore and fix any type errors.
  2. run mypy . --install-types and add any newly installed types-* packages installed to our dev dependencies.

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

requests-extensions-1.1.3.tar.gz (10.6 kB view hashes)

Uploaded Source

Built Distribution

requests_extensions-1.1.3-py3-none-any.whl (9.3 kB view hashes)

Uploaded Python 3

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