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

Add poetry scripts for common commands #578

Closed
wants to merge 3 commits into from

Conversation

seladb
Copy link
Contributor

@seladb seladb commented Oct 12, 2022

This PR adds poetry scripts with some common commands that I always forget and need to look up 😄
Please let me know if you're open to this idea, otherwise I can close the PR.

It currently adds the following scripts (we can always add more or change as we go):

  • poetry run docs - build docs
  • poetry run test - runs tests
    • Can accept specific directories/file and will run only them, for example: poetry run test tests/caching
  • poetry run lint - runs pylint from pre-commit
    • Can accept specific directories/files and will run only them, for example: poetry run lint starlite/cache/**
  • poetry run fmt - runs black, isort, prettier, blacken-docs from pre-commit
    • Can accept specific directories/files and will run only them, for example: poetry run fmt starlite/cache/**
  • poetry run type_check - runs mypy from pre-commit
    • Can accept specific directories/files and will run only them, for example: poetry run type_check starlite/cache/**
  • poetry run all_checks - runs all pre-commit checks
    • Can accept specific directories/files and will run only them, for example: poetry run all_checks starlite/cache/**

PR Checklist

  • Have you followed the guidelines in CONTRIBUTING.md?
  • Have you got 100% test coverage on new code?
  • Have you updated the prose documentation?
  • Have you updated the reference documentation?

@seladb seladb changed the title Add poetry scripts Add poetry scripts for common commands Oct 12, 2022
@seladb seladb marked this pull request as ready for review October 12, 2022 09:46
@@ -83,6 +83,14 @@ structlog = ["structlog"]
redis = ["redis"]
memcached = ["aiomcache"]

[tool.poetry.scripts]
Copy link
Member

@cofin cofin Oct 12, 2022

Choose a reason for hiding this comment

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

I like this idea, but I think entries in poetry.scripts will be installed on any pip install/poetry install execution (even outside of development). I think we'd only want these in a developer environment.

The leaves something like poethepoet or poetry-pyinvoke-plugin as a potential option. Alternately, a Makefile could be a solid alternative that requires no additional deps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see what you're saying, and it's specifically mentioned here: python-poetry/poetry#241 (comment)

@peterschutt
Copy link
Contributor

tox can also be used to abstract commands away like this too, e.g. see the refactor branch of example app that I'm working on: tox -e lint, tox -e test etc etc. Also, we already have tox.ini in the project.

@seladb
Copy link
Contributor Author

seladb commented Oct 12, 2022

I'll close this PR and try to use tox for this. If it doesn't work we can use a Makefile

@seladb seladb closed this Oct 12, 2022
@seladb seladb mentioned this pull request Oct 13, 2022
4 tasks
@seladb seladb deleted the poetry-scripts branch October 13, 2022 21:24
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.

3 participants