Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bootcamp Task] Implement static typing for thumbor/console.py #12

Open
heynemann opened this issue Jan 30, 2022 · 0 comments
Open

[Bootcamp Task] Implement static typing for thumbor/console.py #12

heynemann opened this issue Jan 30, 2022 · 0 comments
Labels
L1 Level 1 Bootcamp Task mypy Tasks related to static typing using MyPy. task Bootcamp task. Feel free to grab it and work on it. For more information ping a bootcamp mentor. thumbor/console.py label for fixing issues with the specified file

Comments

@heynemann
Copy link
Member

Areas of Expertise

MyPy, static typing

You will learn more about how to use statically typed python code. mypy is an optional static type checker for python. It provides compile-time type checking.

Summary

In this task you'll fix thumbor/console.py to be typed.

Involved Modules

Task Relevance

Providing type safety is important both for thumbor and the projects that depend on it. This way we can eliminate type errors, like None where you don't expect None or an integer where you expect a string.

How to complete this task?

To complete this task, read mypy docs on how to get started and run mypy thumbor/console.py from thumbor's virtualenv.

When creating this task, this was the output of running mypy thumbor/console.py:

../thumbor/thumbor/console.py:17: error: Function is missing a type annotation  [no-untyped-def]
Found 1 error in 1 file (checked 1 source file)

This gives you all errors in the file you will fix. Don't worry if there are types of other packages (other thumbor files or thumbor dependencies) failing. If that's the case we can ignore these for now using this kind of annotation:

import module_without_mypy  # type: ignore

For more details check this page.

Once you get to a point where running mypy thumbor/console.py returns no errors, go ahead and submit a PR. The output should look like this:

Success: no issues found in 1 source file

Task Workflow

The workflow for completing tasks in thumbor goes like this:

  1. Fork the involved repositories
  2. In each repository there's a documentation on how to install dependencies and initialize your environment
  3. Hack, in no particular order:
    • Write code & tests
    • Write new tests
    • Write docs
    • Improve design
    • Check that all tests pass
    • Repeat until you're satisfied
  4. Submit a pull request.
@heynemann heynemann added L1 Level 1 Bootcamp Task mypy Tasks related to static typing using MyPy. task Bootcamp task. Feel free to grab it and work on it. For more information ping a bootcamp mentor. thumbor/console.py label for fixing issues with the specified file labels Jan 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L1 Level 1 Bootcamp Task mypy Tasks related to static typing using MyPy. task Bootcamp task. Feel free to grab it and work on it. For more information ping a bootcamp mentor. thumbor/console.py label for fixing issues with the specified file
Projects
None yet
Development

No branches or pull requests

1 participant