Skip to content

Commit

Permalink
Merge pull request #156 from jedie/fix-uv
Browse files Browse the repository at this point in the history
Bugfix uv-python
  • Loading branch information
jedie authored Nov 13, 2024
2 parents ff48b81 + ec1837b commit 8e360b3
Show file tree
Hide file tree
Showing 9 changed files with 188 additions and 129 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ Usage: ./dev-cli.py [OPTIONS] COMMAND [ARGS]...
[comment]: <> (✂✂✂ auto generated history start ✂✂✂)

* [v0.5.0](https://github.com/jedie/cookiecutter_templates/compare/v0.3.0...v0.5.0)
* 2024-11-13 - Bugfix uv-python
* 2024-10-29 - Add "uv-python" template
* 2024-09-26 - Move pip-compile settings into pyproject.toml + create pywheel hashes
* 2024-09-26 - Add "setup Python" to YunoHost template
Expand Down
2 changes: 1 addition & 1 deletion generated_templates/uv-python/your_cool_package/dev-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def main(argv):
verbose_check_call(PYTHON_PATH, '-m', 'pip', 'install', '-U', 'uv')

# install requirements
verbose_check_call(UV_PATH, 'sync', '--frozen', '--only-dev')
verbose_check_call(UV_PATH, 'sync')

# install project
verbose_check_call(PIP_PATH, 'install', '--no-deps', '-e', '.')
Expand Down
15 changes: 4 additions & 11 deletions generated_templates/uv-python/your_cool_package/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ dev = [
"manageprojects", # https://github.com/jedie/manageprojects
"urllib3", # for bx_py_utils.test_utils.deny_requests.deny_any_real_request() in tests
"uv", # https://github.com/astral-sh/uv
"setuptools", # https://github.com/pypa/setuptools
"build", # https://github.com/pypa/build
"tox", # https://github.com/tox-dev/tox
"tox-uv", # https://github.com/tox-dev/tox-uv
"coverage", # https://github.com/nedbat/coveragepy
Expand Down Expand Up @@ -50,15 +52,6 @@ dev = [
'backports.tarfile', # via jaraco-context -> keyring -> twine
]

[tool.pip-tools.compile]
index-url="https://pypi.org/simple"
extra-index-url=["https://www.piwheels.org/simple"] # Add hashes of piwheels packages, too!
generate-hashes = true
# https://pip-tools.readthedocs.io/en/stable/#deprecations
allow-unsafe = true
resolver="backtracking"
strip-extras = true

[project.urls]
Documentation = "https://github.com/john-doh/your_cool_package"
Source = "https://github.com/john-doh/your_cool_package"
Expand Down Expand Up @@ -141,11 +134,11 @@ isolated_build = true
env_list = ["3.13", "3.12", "3.11"]
skip_missing_interpreters = true

[tool.tox.testenv]
[tool.tox.env_run_base]
runner = "uv-venv-lock-runner"
with_dev = true
commands = [
["python3", "-m", "coverage", "run", "--context='{envname}'"]
["python3", "-m", "coverage", "run", "--context", "'{envname}'"]
]


Expand Down
138 changes: 87 additions & 51 deletions generated_templates/uv-python/your_cool_package/uv.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def install():
Install requirements and 'your_cool_package' via pip as editable.
"""
tools_executor = ToolsExecutor(cwd=PACKAGE_ROOT)
tools_executor.verbose_check_call('uv', 'sync', '--only-dev')
tools_executor.verbose_check_call('uv', 'sync')
tools_executor.verbose_check_call('pip', 'install', '--no-deps', '-e', '.')


Expand Down
2 changes: 1 addition & 1 deletion uv-python/{{ cookiecutter.package_name }}/dev-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def main(argv):
verbose_check_call(PYTHON_PATH, '-m', 'pip', 'install', '-U', 'uv')

# install requirements
verbose_check_call(UV_PATH, 'sync', '--frozen', '--only-dev')
verbose_check_call(UV_PATH, 'sync')

# install project
verbose_check_call(PIP_PATH, 'install', '--no-deps', '-e', '.')
Expand Down
15 changes: 4 additions & 11 deletions uv-python/{{ cookiecutter.package_name }}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ dev = [
"manageprojects", # https://github.com/jedie/manageprojects
"urllib3", # for bx_py_utils.test_utils.deny_requests.deny_any_real_request() in tests
"uv", # https://github.com/astral-sh/uv
"setuptools", # https://github.com/pypa/setuptools
"build", # https://github.com/pypa/build
"tox", # https://github.com/tox-dev/tox
"tox-uv", # https://github.com/tox-dev/tox-uv
"coverage", # https://github.com/nedbat/coveragepy
Expand Down Expand Up @@ -50,15 +52,6 @@ dev = [
'backports.tarfile', # via jaraco-context -> keyring -> twine
]

[tool.pip-tools.compile]
index-url="https://pypi.org/simple"
extra-index-url=["https://www.piwheels.org/simple"] # Add hashes of piwheels packages, too!
generate-hashes = true
# https://pip-tools.readthedocs.io/en/stable/#deprecations
allow-unsafe = true
resolver="backtracking"
strip-extras = true

[project.urls]
Documentation = "{{ cookiecutter.package_url }}"
Source = "{{ cookiecutter.package_url }}"
Expand Down Expand Up @@ -141,11 +134,11 @@ isolated_build = true
env_list = ["3.13", "3.12", "3.11"]
skip_missing_interpreters = true

[tool.tox.testenv]
[tool.tox.env_run_base]
runner = "uv-venv-lock-runner"
with_dev = true
commands = [
["python3", "-m", "coverage", "run", "--context='{envname}'"]
["python3", "-m", "coverage", "run", "--context", "'{envname}'"]
]


Expand Down
140 changes: 88 additions & 52 deletions uv-python/{{ cookiecutter.package_name }}/uv.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def install():
Install requirements and '{{ cookiecutter.package_name }}' via pip as editable.
"""
tools_executor = ToolsExecutor(cwd=PACKAGE_ROOT)
tools_executor.verbose_check_call('uv', 'sync', '--only-dev')
tools_executor.verbose_check_call('uv', 'sync')
tools_executor.verbose_check_call('pip', 'install', '--no-deps', '-e', '.')


Expand Down

0 comments on commit 8e360b3

Please sign in to comment.