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

fix: Fix tox.ini for pre-commit #2294

Closed
wants to merge 2 commits into from
Closed

Conversation

koxudaxi
Copy link
Owner

@koxudaxi koxudaxi commented Feb 1, 2025

No description provided.

Copy link

codecov bot commented Feb 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.86%. Comparing base (96a023e) to head (e12309f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2294   +/-   ##
=======================================
  Coverage   97.86%   97.86%           
=======================================
  Files          38       38           
  Lines        4305     4305           
  Branches      838      838           
=======================================
  Hits         4213     4213           
  Misses         63       63           
  Partials       29       29           
Flag Coverage Δ
unittests 97.83% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

codspeed-hq bot commented Feb 1, 2025

CodSpeed Performance Report

Merging #2294 will not alter performance

Comparing fix-tox-ini-for-pre-commit (e12309f) with main (96a023e)

Summary

✅ 31 untouched benchmarks

@koxudaxi
Copy link
Owner Author

koxudaxi commented Feb 1, 2025

@gaborbernat
Could you please review this PR?
I can't run tox and I fixed small things.
I have used tox+pip but that was probably 5+ years ago so I am not familiar with it 😅

@@ -43,6 +43,8 @@ deps =
pre-commit-uv>=4.1.4
commands =
pre-commit run --all-files --show-diff-on-failure
allowlist_externals =
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not needed as is installed via above deps.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I got the error.
Can I run the test for all Python verisons with the command?

$ tox run
fix: uv-sync> uv sync --frozen --python-preference system --no-dev --group test -p /Users/koudai/.local/share/uv/tools/tox/bin/python
fix: commands[0]> pre-commit run --all-files --show-diff-on-failure
fix: failed with pre-commit is not allowed, use allowlist_externals to allow it
fix: FAIL ✖ in 0.02 seconds

Copy link
Collaborator

Choose a reason for hiding this comment

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

That error doesn't make sense, can you post the full output of tox run -rvve fix?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Thank you, I ran it in main branch.

tox run -rvve fix  2>&1 | pbcopy
fix: 86 W remove tox env folder /Users/koudai/PycharmProjects/datamodel-code-generator/.tox/fix [tox/tox_env/api.py:332]
fix: 182 W venv> /Users/koudai/.local/share/uv/tools/tox/bin/uv venv -p /Users/koudai/.local/share/uv/tools/tox/bin/python --allow-existing -v --python-preference system /Users/koudai/PycharmProjects/datamodel-code-generator/.tox/fix [tox/tox_env/api.py:434]
DEBUG uv 0.5.26 (5ef3d5139 2025-01-30)
DEBUG Found project root: `/Users/koudai/PycharmProjects/datamodel-code-generator`
DEBUG No workspace root found, using project root
DEBUG Using Python request `/Users/koudai/.local/share/uv/tools/tox/bin/python` from explicit request
DEBUG Checking for Python interpreter at path `/Users/koudai/.local/share/uv/tools/tox/bin/python`
Using CPython 3.13.1 interpreter at: /Users/koudai/.local/share/uv/tools/tox/bin/python
Creating virtual environment at: .tox/fix
DEBUG Assessing Python executable as base candidate: /Users/koudai/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none/bin/python3.13
DEBUG Using base executable for virtual environment: /Users/koudai/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none/bin/python3.13
DEBUG Allowing existing directory
fix: 193 I exit 0 (0.01 seconds) /Users/koudai/PycharmProjects/datamodel-code-generator> /Users/koudai/.local/share/uv/tools/tox/bin/uv venv -p /Users/koudai/.local/share/uv/tools/tox/bin/python --allow-existing -v --python-preference system /Users/koudai/PycharmProjects/datamodel-code-generator/.tox/fix pid=15888 [tox/execute/api.py:294]
fix: 193 W uv-sync> uv sync --frozen --python-preference system --no-dev -v --group test -p /Users/koudai/.local/share/uv/tools/tox/bin/python [tox/tox_env/api.py:434]
DEBUG uv 0.5.26 (5ef3d5139 2025-01-30)
DEBUG Found project root: `/Users/koudai/PycharmProjects/datamodel-code-generator`
DEBUG No workspace root found, using project root
DEBUG Using Python request `/Users/koudai/.local/share/uv/tools/tox/bin/python` from explicit request
DEBUG Checking for Python environment at `.tox/fix`
DEBUG The virtual environment's Python version satisfies `/Users/koudai/.local/share/uv/tools/tox/bin/python`
DEBUG Using request timeout of 30s
DEBUG Directory source requirement already cached: datamodel-code-generator==0.26.6.dev6+ge12309f8 (from file:///Users/koudai/PycharmProjects/datamodel-code-generator)
DEBUG Requirement already cached: diff-cover==9.2.2
DEBUG Requirement already cached: freezegun==1.5.1
DEBUG Requirement already cached: pytest==8.3.4
DEBUG Requirement already cached: pytest-benchmark==5.1.0
DEBUG Requirement already cached: pytest-codspeed==3.1.2
DEBUG Requirement already cached: pytest-cov==6.0.0
DEBUG Requirement already cached: pytest-mock==3.14.0
DEBUG Requirement already cached: pytest-xdist==3.6.1
DEBUG Requirement already cached: argcomplete==3.5.3
DEBUG Requirement already cached: black==24.10.0
DEBUG Requirement already cached: genson==1.3.0
DEBUG Requirement already cached: graphql-core==3.2.6
DEBUG Requirement already cached: httpx==0.28.1
DEBUG Requirement already cached: inflect==5.6.2
DEBUG Requirement already cached: isort==5.13.2
DEBUG Requirement already cached: jinja2==3.1.5
DEBUG Requirement already cached: openapi-spec-validator==0.6.0
DEBUG Requirement already cached: packaging==24.2
DEBUG Requirement already cached: prance==23.6.21.0
DEBUG Requirement already cached: pydantic==2.10.6
DEBUG Requirement already cached: pysnooper==1.2.1
DEBUG Requirement already cached: pyyaml==6.0.2
DEBUG Requirement already cached: chardet==5.2.0
DEBUG Requirement already cached: pluggy==1.5.0
DEBUG Requirement already cached: pygments==2.19.1
DEBUG Requirement already cached: python-dateutil==2.9.0.post0
DEBUG Requirement already cached: iniconfig==2.0.0
DEBUG Requirement already cached: py-cpuinfo==9.0.0
DEBUG Requirement already cached: cffi==1.17.1
DEBUG Requirement already cached: rich==13.9.4
DEBUG Requirement already cached: coverage==7.6.10
DEBUG Requirement already cached: execnet==2.1.1
DEBUG Requirement already cached: click==8.1.8
DEBUG Requirement already cached: mypy-extensions==1.0.0
DEBUG Requirement already cached: pathspec==0.12.1
DEBUG Requirement already cached: platformdirs==4.3.6
DEBUG Requirement already cached: anyio==4.8.0
DEBUG Requirement already cached: certifi==2024.12.14
DEBUG Requirement already cached: httpcore==1.0.7
DEBUG Requirement already cached: idna==3.10
DEBUG Requirement already cached: markupsafe==3.0.2
DEBUG Requirement already cached: jsonschema==4.23.0
DEBUG Requirement already cached: jsonschema-spec==0.2.4
DEBUG Registry requirement already cached: lazy-object-proxy==1.10.0
DEBUG Requirement already cached: openapi-schema-validator==0.6.3
DEBUG Requirement already cached: requests==2.32.3
DEBUG Requirement already cached: ruamel-yaml==0.18.10
DEBUG Requirement already cached: six==1.17.0
DEBUG Requirement already cached: annotated-types==0.7.0
DEBUG Requirement already cached: pydantic-core==2.27.2
DEBUG Requirement already cached: typing-extensions==4.12.2
DEBUG Requirement already cached: pycparser==2.22
DEBUG Requirement already cached: markdown-it-py==3.0.0
DEBUG Requirement already cached: sniffio==1.3.1
DEBUG Requirement already cached: h11==0.14.0
DEBUG Requirement already cached: attrs==25.1.0
DEBUG Requirement already cached: jsonschema-specifications==2023.7.1
DEBUG Requirement already cached: referencing==0.30.2
DEBUG Requirement already cached: rpds-py==0.22.3
DEBUG Requirement already cached: pathable==0.4.4
DEBUG Requirement already cached: rfc3339-validator==0.1.4
DEBUG Requirement already cached: charset-normalizer==3.4.1
DEBUG Requirement already cached: urllib3==2.3.0
DEBUG Requirement already cached: mdurl==0.1.2
Installed 65 packages in 52ms
 + annotated-types==0.7.0
 + anyio==4.8.0
 + argcomplete==3.5.3
 + attrs==25.1.0
 + black==24.10.0
 + certifi==2024.12.14
 + cffi==1.17.1
 + chardet==5.2.0
 + charset-normalizer==3.4.1
 + click==8.1.8
 + coverage==7.6.10
 + datamodel-code-generator==0.26.6.dev6+ge12309f8 (from file:///Users/koudai/PycharmProjects/datamodel-code-generator)
 + diff-cover==9.2.2
 + execnet==2.1.1
 + freezegun==1.5.1
 + genson==1.3.0
 + graphql-core==3.2.6
 + h11==0.14.0
 + httpcore==1.0.7
 + httpx==0.28.1
 + idna==3.10
 + inflect==5.6.2
 + iniconfig==2.0.0
 + isort==5.13.2
 + jinja2==3.1.5
 + jsonschema==4.23.0
 + jsonschema-spec==0.2.4
 + jsonschema-specifications==2023.7.1
 + lazy-object-proxy==1.10.0
 + markdown-it-py==3.0.0
 + markupsafe==3.0.2
 + mdurl==0.1.2
 + mypy-extensions==1.0.0
 + openapi-schema-validator==0.6.3
 + openapi-spec-validator==0.6.0
 + packaging==24.2
 + pathable==0.4.4
 + pathspec==0.12.1
 + platformdirs==4.3.6
 + pluggy==1.5.0
 + prance==23.6.21.0
 + py-cpuinfo==9.0.0
 + pycparser==2.22
 + pydantic==2.10.6
 + pydantic-core==2.27.2
 + pygments==2.19.1
 + pysnooper==1.2.1
 + pytest==8.3.4
 + pytest-benchmark==5.1.0
 + pytest-codspeed==3.1.2
 + pytest-cov==6.0.0
 + pytest-mock==3.14.0
 + pytest-xdist==3.6.1
 + python-dateutil==2.9.0.post0
 + pyyaml==6.0.2
 + referencing==0.30.2
 + requests==2.32.3
 + rfc3339-validator==0.1.4
 + rich==13.9.4
 + rpds-py==0.22.3
 + ruamel-yaml==0.18.10
 + six==1.17.0
 + sniffio==1.3.1
 + typing-extensions==4.12.2
 + urllib3==2.3.0
fix: 267 I exit 0 (0.07 seconds) /Users/koudai/PycharmProjects/datamodel-code-generator> uv sync --frozen --python-preference system --no-dev -v --group test -p /Users/koudai/.local/share/uv/tools/tox/bin/python pid=15889 [tox/execute/api.py:294]
fix: 268 W commands[0]> pre-commit run --all-files --show-diff-on-failure [tox/tox_env/api.py:434]
fix: 268 E failed with pre-commit is not allowed, use allowlist_externals to allow it [tox/session/cmd/run/single.py:57]
  fix: FAIL code 1 (0.18 seconds)
  evaluation failed :( (0.21 seconds)

Copy link
Collaborator

Choose a reason for hiding this comment

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

filled #2296 to replace this PR

Copy link
Collaborator

@gaborbernat gaborbernat Feb 2, 2025

Choose a reason for hiding this comment

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

Note you do not have to use tox to run the pre-commit fixes, 😊 I often run those via pre-commit run --all-files, but is nice to have the option to do it so when is otherwise not setup on your machine.

@koxudaxi koxudaxi closed this Feb 2, 2025
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