Skip to content

Commit 9d0dfad

Browse files
Merge branch '909-make-bitbucket-ci-config-backend-agnostic' of https://github.com/nathanjmcdougall/usethis-python into 909-make-bitbucket-ci-config-backend-agnostic
2 parents b9bed93 + ccc827f commit 9d0dfad

13 files changed

Lines changed: 65 additions & 30 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
PYTHONIOENCODING: utf-8
3030
steps:
3131
- name: Checkout code
32-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3333
with:
3434
persist-credentials: false
3535

@@ -39,13 +39,13 @@ jobs:
3939
git config --global user.email placeholder@example.com
4040
4141
- name: Set up uv
42-
uses: astral-sh/setup-uv@f94ec6bedd8674c4426838e6b50417d36b6ab231 # v5.3.1
42+
uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
4343
with:
4444
version: ${{ matrix.uv_version || 'latest' }}
4545
enable-cache: true
4646

4747
- name: Set up Python
48-
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
48+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
4949
with:
5050
python-version: ${{ matrix.python_version }}
5151

@@ -69,7 +69,7 @@ jobs:
6969
7070
- name: Run pytest
7171
uses: pavelzw/pytest-action@510c5e90c360a185039bea56ce8b3e7e51a16507 # v2.2.0
72-
if: ${{ (matrix.pytest == null || matrix.pytest == 'true') && (github.event_name == 'schedule' || matrix.dependencies != 'max') }}
72+
if: ${{ matrix.pytest == null || matrix.pytest == 'true' }}
7373
with:
7474
custom-pytest: uv run --frozen pytest
7575
custom-arguments: --cov --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
@@ -83,7 +83,7 @@ jobs:
8383
run: uv run --frozen pytest --codspeed
8484

8585
- name: Upload coverage reports to Codecov
86-
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
86+
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
8787
if: ${{ matrix.codecov != null && matrix.codecov == 'true' }}
8888
with:
8989
token: ${{ secrets.CODECOV_TOKEN }}
@@ -116,7 +116,7 @@ jobs:
116116
python_version: "3.10"
117117
uv_version: "0.6.8"
118118
pre_commit: "false"
119-
- dependencies: "max" # Cron only (Pytest skipped)
119+
- dependencies: "max"
120120
python_version: "3.14"
121121
pre_commit: "false"
122122
- codecov: "true"

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ jobs:
2727
- language: python
2828
steps:
2929
- name: Checkout repository
30-
uses: actions/checkout@v4
30+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3131
with:
3232
persist-credentials: false
3333
- name: Initialize CodeQL
34-
uses: github/codeql-action/init@v3
34+
uses: github/codeql-action/init@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v4.30.8
3535
with:
3636
languages: ${{ matrix.language }}
3737
build-mode: none
3838
- name: Perform CodeQL Analysis
39-
uses: github/codeql-action/analyze@v3
39+
uses: github/codeql-action/analyze@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v4.30.8
4040
with:
4141
category: "/language:${{matrix.language}}"

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ jobs:
1515
id-token: write # Needed for trusted publishing
1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1919
with:
2020
persist-credentials: false
2121

2222
- name: Set up uv
23-
uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254 # v3.2.0
23+
uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
2424
with:
2525
version: "latest"
2626
enable-cache: false
2727

2828
- name: "Set up Python"
29-
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
29+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
3030
with:
3131
python-version: 3.12
3232

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ You could consider [this template](https://github.com/pawamoy/copier-uv) or [thi
174174
175175
If you're using Cookiecutter, then you can update to a latest version of a template using a tool like [cruft](https://github.com/cruft/cruft). Copier has inbuilt support for template updating. Another template-style option which provides updating is [jaraco/skeleton](https://blog.jaraco.com/skeleton/), which is a specific, git-based template rather than a general templating system.
176176

177+
If you're not interested in templating automations, then [configurator](https://github.com/jamesbraza/configurator) provides a list of useful tooling and configuration to consider for your Python projects.
178+
177179
## 🚀 Development
178180

179181
[![Commits since latest release](https://img.shields.io/github/commits-since/usethis-python/usethis-python/latest.svg)](https://github.com/usethis-python/usethis-python/releases)

docs/similar-projects.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ You could consider [this template](https://github.com/pawamoy/copier-uv) or [thi
1111
You can still use usethis as a part of a templates using [hooks](https://cookiecutter.readthedocs.io/en/latest/advanced/hooks.html#using-pre-post-generate-hooks-0-7-0) for Cookiecutter and [tasks](https://copier.readthedocs.io/en/stable/configuring/#tasks) for Copier.
1212

1313
If you're using Cookiecutter, then you can update to a latest version of a template using a tool like [cruft](https://github.com/cruft/cruft). Copier has inbuilt support for template updating. Another template-style option which provides updating is [jaraco/skeleton](https://blog.jaraco.com/skeleton/), which is a specific, git-based template rather than a general templating system.
14+
15+
If you're not interested in templating automations, then [configurator](https://github.com/jamesbraza/configurator) provides a list of useful tooling and configuration to consider for your Python projects.

src/usethis/_core/tool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def use_deptry(*, remove: bool = False, how: bool = False) -> None:
117117
else:
118118
tool.update_bitbucket_steps()
119119

120+
tool.add_configs()
120121
tool.print_how_to_use()
121122
else:
122123
tool.remove_pre_commit_repo_configs()

src/usethis/_tool/impl/deptry.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,16 @@ def get_config_spec(self) -> ConfigSpec:
7373
ConfigItem(
7474
description="Overall config",
7575
root={Path("pyproject.toml"): ConfigEntry(keys=["tool", "deptry"])},
76-
)
76+
),
77+
ConfigItem(
78+
description="Ignore notebooks",
79+
root={
80+
Path("pyproject.toml"): ConfigEntry(
81+
keys=["tool", "deptry", "ignore_notebooks"],
82+
get_value=lambda: False,
83+
)
84+
},
85+
),
7786
],
7887
)
7988

src/usethis/_toolset/lint.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33

44
def use_linters(remove: bool = False, how: bool = False):
5-
use_ruff(linter=True, formatter=False, remove=remove, how=how)
5+
# Use deptry first since it determines that we use 'pyproject.toml' for Ruff.
66
use_deptry(remove=remove, how=how)
7+
use_ruff(linter=True, formatter=False, remove=remove, how=how)

tests/usethis/_core/test_core_tool.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,18 @@ def test_dependency_added(self, uv_init_dir: Path):
579579
(dev_dep,) = get_deps_from_group("dev")
580580
assert dev_dep == Dependency(name="deptry")
581581

582+
@pytest.mark.usefixtures("_vary_network_conn")
583+
def test_ignore_notebooks(self, uv_init_dir: Path):
584+
# Act
585+
with change_cwd(uv_init_dir), PyprojectTOMLManager():
586+
use_deptry()
587+
588+
# Assert
589+
assert (
590+
PyprojectTOMLManager()[["tool", "deptry", "ignore_notebooks"]]
591+
is False
592+
)
593+
582594
@pytest.mark.usefixtures("_vary_network_conn")
583595
def test_stdout(
584596
self,
@@ -594,6 +606,7 @@ def test_stdout(
594606
assert out == (
595607
"✔ Adding dependency 'deptry' to the 'dev' group in 'pyproject.toml'.\n"
596608
"☐ Install the dependency 'deptry'.\n"
609+
"✔ Adding deptry config to 'pyproject.toml'.\n"
597610
"☐ Run 'uv run deptry src' to run deptry.\n"
598611
)
599612

@@ -617,6 +630,7 @@ def test_stdout_unfrozen(
617630
out, _ = capfd.readouterr()
618631
assert out == (
619632
"✔ Adding dependency 'deptry' to the 'dev' group in 'pyproject.toml'.\n"
633+
"✔ Adding deptry config to 'pyproject.toml'.\n"
620634
"☐ Run 'uv run deptry src' to run deptry.\n"
621635
)
622636

@@ -693,6 +707,7 @@ def test_pre_commit_after(
693707
assert out == (
694708
"✔ Adding dependency 'deptry' to the 'dev' group in 'pyproject.toml'.\n"
695709
"☐ Install the dependency 'deptry'.\n"
710+
"✔ Adding deptry config to 'pyproject.toml'.\n"
696711
"☐ Run 'uv run deptry src' to run deptry.\n"
697712
"✔ Adding dependency 'pre-commit' to the 'dev' group in 'pyproject.toml'.\n"
698713
"☐ Install the dependency 'pre-commit'.\n"
@@ -854,6 +869,7 @@ def test_pre_commit_first(
854869
"✔ Adding dependency 'deptry' to the 'dev' group in 'pyproject.toml'.\n"
855870
"☐ Install the dependency 'deptry'.\n"
856871
"✔ Adding hook 'deptry' to '.pre-commit-config.yaml'.\n"
872+
"✔ Adding deptry config to 'pyproject.toml'.\n"
857873
"☐ Run 'uv run deptry src' to run deptry.\n"
858874
)
859875

@@ -886,6 +902,7 @@ def test_placeholder_removed(
886902
"✔ Adding dependency 'deptry' to the 'dev' group in 'pyproject.toml'.\n"
887903
"☐ Install the dependency 'deptry'.\n"
888904
"✔ Adding hook 'deptry' to '.pre-commit-config.yaml'.\n"
905+
"✔ Adding deptry config to 'pyproject.toml'.\n"
889906
"☐ Run 'uv run deptry src' to run deptry.\n"
890907
)
891908

tests/usethis/_core/test_rule.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def test_deptry_rule_selected(
4040
assert out == (
4141
"✔ Adding dependency 'deptry' to the 'dev' group in 'pyproject.toml'.\n"
4242
"☐ Install the dependency 'deptry'.\n"
43+
"✔ Adding deptry config to 'pyproject.toml'.\n"
4344
"☐ Run 'uv run deptry src' to run deptry.\n"
4445
"ℹ All deptry rules are always implicitly selected.\n" # noqa: RUF001
4546
)

0 commit comments

Comments
 (0)