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

feat: including typehints; tox to manage packages; mypy to static check; remove unnecessary requirements; change circle ci to use tox; run black and isort to format #118

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

pedroimpulcetto
Copy link

@pedroimpulcetto pedroimpulcetto commented May 22, 2024

Hey there, I'm trying to keep this repository alive by implementing Mypy as a static type checker and making some small improvements, not changing the repository core.
I hope it looks good 🙏 but feel free to suggest or decline any changes.

🛠️ Adding Mypy for Better Type Checking

A development dependency, Mypy, was added. It checks for type-related errors before you run the code, making it less prone to runtime errors and smoothing the development process.

📦 Dependency Changes in requirements.txt

The dependencies pytest and responses have been removed. These dependencies aren't necessary for the closeio_api package as they are dev-dependencies, so they were added in tox.ini for testing purposes only.

🔄 Updates in .circleci/config.yml

We are now using pip install tox to run tests and Mypy. A new step, 'Mypy', has been introduced, which runs Mypy on the codebase, ensuring type safety.

💡 Type Hints in closeio_api

Several improvements have been made to the closeio_api/__init__.py file. The main changes include adding type hints to variables and function parameters. This enhancement helps catch type errors at an early stage, making the code safer and more maintainable.

…ck; remove unnecessary requirements; change circle ci to use tox; run black and isort to format
@pedroimpulcetto pedroimpulcetto changed the title feat: including typehints; tox to manage packages; mypy to static che… feat: including typehints; tox to manage packages; mypy to static check; remove unnecessary requirements; change circle ci to use tox; run black and isort to format May 23, 2024
@pedroimpulcetto pedroimpulcetto marked this pull request as ready for review May 23, 2024 12:57
Copy link

@tsx tsx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @pedroimpulcetto, thank you for your contribution. I'm excited to see our client getting improvements!

I've left a few comments on things I noticed right away, however I'd really appreciate if we did this as a series of smaller, more focused, separate PRs. I'd be happy to help review and ship those.

@@ -15,10 +15,13 @@ defaults: &defaults
- checkout
- run:
name: Install dependencies
command: pip install -r requirements.txt
command: pip install tox
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're trying to move away from using CircleCI and towards github actions. Would you mind holding off any changes to CircleCI config?

"""Construct and return a requests.Request object based on
provided parameters.
"""
if api_key:
auth = (api_key, '')
auth = (api_key, "")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer shipping changes to formatting separately from functional ones - putting them together makes actual changes really hard to review.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will make a different PR for isort and black after having specific requirements for dev/test dependencies

@@ -0,0 +1,3 @@
[mypy]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer tooling configuration to be placed in pyproject.toml instead of tool-specific files.

Copy link
Author

@pedroimpulcetto pedroimpulcetto May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as this project is not using pyproject.toml I'm going to include in setup.cfg

@@ -1,4 +1 @@
pytest==7.4.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need to pin specific dependency versions. Splitting them into a separate file is a good idea though (example in another repo).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you prefer to have only one requirements-dev.txt for all development dependencies or have different requirements-lint.txt, requirements-test.text, etc?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just pushed this new PR #119 creating a new requirements-dev.txt file

commands =
pytest

[testenv:format]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should be using tox as a framework for running other tools besides doing actual testing.

@pedroimpulcetto
Copy link
Author

Hey @pedroimpulcetto, thank you for your contribution. I'm excited to see our client getting improvements!

I've left a few comments on things I noticed right away, however I'd really appreciate if we did this as a series of smaller, more focused, separate PRs. I'd be happy to help review and ship those.

I really appreciate your time to take a look at it @tsx, thank you!
I completely agree with you, I think I got too carried away with the changes 😅 I will do that smaller and focused on each scope.

@pedroimpulcetto pedroimpulcetto marked this pull request as draft May 28, 2024 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants