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

Remove unused production requirements #93

Merged
merged 4 commits into from
Apr 23, 2024
Merged

Conversation

arneturuc
Copy link
Member

Removes unused dependencies from the project #36.

Splits dependencies for production and development into requirements.txt and requirements-dev.txt, respectively.
Please use requirements-dev.txt for development and testing.

Switches from python_jwt to pyjwt, because the former is deprecated.

The following packets in requirements.txt are removed/changed:

  • pytest (reason: moved to requirements-dev.txt)
  • py (reasons: maintenance mode, unused)
  • attrs (reason: unused)
  • pluggy (reason: moved to requirements-dev.txt)
  • iniconfig (reason: moved to requirements-dev.txt)
  • black (reason: moved to requirements-dev.txt)
  • jwcrypto 1.5 -> 1.5.6 (reason: improved security)
  • python_jwt -> pyjwt (reason: deprecated)
  • six (reason: unused, also Python 2 support got dropped long ago)

This droppes support for Python 2, which had end-of-life for a long time.

@arneturuc arneturuc self-assigned this Apr 11, 2024
Splits dependencies for production and development
@@ -123,7 +128,7 @@ def main():
log.addHandler(info_handler)

# Error logging
red_formatter = logging.Formatter(Fore.RED + "%(levelname)s: %(message)s" + Fore.RESET)
red_formatter = logging.Formatter("\u001b[31m" + "%(levelname)s: %(message)s" + "\u001b[0m")
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, if we have colorama as a dependency anyways, we might as well use Fore for better readability imo.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess you are right. I was thinking about removing colorama altogether but did like the colored text which of course needs to work on Windows as well (without gibberish).
I'll change that back now.

@@ -57,6 +58,6 @@ def generate_jwt(priv_key: jwk.JWK, user_id: int) -> str:
"""
payload = {"userID": user_id}

token = jwt.generate_jwt(payload, priv_key, "RS256", lifetime=datetime.timedelta(minutes=1))
token = jwt.encode(payload, priv_key, algorithm="RS256", headers={"alg": "RS256", "typ": "JWT"})
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
token = jwt.encode(payload, priv_key, algorithm="RS256", headers={"alg": "RS256", "typ": "JWT"})
token = jwt.encode(payload, priv_key, algorithm="RS256")

Are you sure these headers need to be specified? Some preliminary testing on my local machine has shown that these headers are automatically added.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you are right!
This was because of failing tests, but the reason was something unrelated.

- Uses keys in PEM format
- Update tests
- pytest (reason: moved to requirements-dev.txt)
- py (reasons: maintenance mode, unused)
- attrs (reason: unused)
- pluggy (reason: moved to requirements-dev.txt)
- iniconfig (reason: moved to requirements-dev.txt)
- black (reason: moved to requirements-dev.txt)
- jwcrypto 1.5 -> 1.5.6 (reason: improved security)
- python_jwt -> pyjwt (reason: deprecated)
- six (reason: unused, also Python 2 support got dropped long ago)
@joachimschmidt557 joachimschmidt557 merged commit ef51a3a into main Apr 23, 2024
2 checks passed
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