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 prompt for main python version #27

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

synacktraa
Copy link

PR Checklist

  • A description of the changes is added to the description of this PR.
  • If there is a related issue, make sure it is linked to this PR.
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated

Description of changes

  • Main python version prompt so the user can decide the version matrix to use. It applies to .github, tox.ini and pyproject.toml. Selected main version is applied to Dockerfile.
  • Pytest coverage in tox is not ran if codecov is disabled.
  • Added conditional Jinja templates in cookiecutter's template README.md, pyproject.toml and docs so the project doesn't end up containing dead links.

@@ -50,9 +50,11 @@ jobs:
run: uv run mypy

{% if cookiecutter.codecov == "y" %}
- name: Upload coverage reports to Codecov with GitHub Action on Python 3.11
- name: Upload coverage reports to Codecov with GitHub Action on Python 3.12
Copy link
Owner

Choose a reason for hiding this comment

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

shouldn't this be changed to the main python version?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, let me update it.

uses: codecov/codecov-action@v4
if: {% raw %}${{ matrix.python-version == '3.11' }}{% endraw %}
if: {% raw %}${{ matrix.python-version == '3.12' }}{% endraw %}
Copy link
Owner

Choose a reason for hiding this comment

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

shouldn't this be changed to the main python version?

@@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: {{ cookiecutter._python_version_matrix }}
Copy link
Owner

Choose a reason for hiding this comment

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

I just tried it by selecting main_python_version 3.13, and I ended up with only 3.13? IMO we should still test for all current Python versions that are not EOL.

@@ -5,23 +5,24 @@ description = "{{cookiecutter.project_description}}"
authors = [{ name = "{{cookiecutter.author}}", email = "{{cookiecutter.email}}" }]
readme = "README.md"
keywords = ['python']
requires-python = ">=3.9,<4.0"
{%- set minor_version = cookiecutter.main_python_version.split('.')|map('int')|list %}
requires-python = ">={{cookiecutter.main_python_version}},<4.0"
Copy link
Owner

Choose a reason for hiding this comment

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

Still should remain 3.9; not the main_python_version acts as a minimum python version. A good Python package should aim to support all currently supported Python versions.

At least, a package should start with this. If for some reason some versions need to be dropped, e.g. because some dependencies only support >=3.10, then it makes sense to update this manually.

Copy link
Author

Choose a reason for hiding this comment

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

Okay, I had no idea what you meant earlier by main python version. I thought it was supposed to be the minimum version. So, it should be ">=3.9,<3.13" if I select 3.12 as main_python_version, right?

Copy link
Author

Choose a reason for hiding this comment

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

Still should remain 3.9; not the main_python_version acts as a minimum python version. A good Python package should aim to support all currently supported Python versions.

I get it, I add all supported versions in my packages. I just thought this version selection would be an interesting addition.

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