Skip to content

Commit 96dc2f9

Browse files
authored
fix: update project templates for Poetry v2.x compatibility (#1049)
### Description - Relax version poetry in template ### Issues - Closes: #954
1 parent 82b3219 commit 96dc2f9

File tree

4 files changed

+23
-27
lines changed

4 files changed

+23
-27
lines changed

src/crawlee/project_template/hooks/pre_gen_project.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
except OSError as exc:
88
raise RuntimeError('You chose to use the Poetry package manager, but it does not seem to be installed') from exc
99

10-
if not re.match(r'Poetry \(version 1\..*\)', version):
11-
raise RuntimeError(f'Poetry 1.x is required, but "{version}" is installed')
10+
if not re.match(r'Poetry \(version 2\..*\)', version):
11+
raise RuntimeError(f'Poetry 2.x is required, but "{version}" is installed')
1212
# % endif

src/crawlee/project_template/{{cookiecutter.project_name}}/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ RUN apt update && apt install -yq git && rm -rf /var/lib/apt/lists/*
1414

1515
# % if cookiecutter.package_manager == 'poetry'
1616
RUN pip install -U pip setuptools \
17-
&& pip install 'poetry<2' \
18-
&& poetry self add 'poetry-plugin-export<1.9.0'
17+
&& pip install 'poetry<3' \
18+
&& poetry self add 'poetry-plugin-export'
1919

2020
# Second, copy just poetry.lock and pyproject.toml into the Actor image,
2121
# since those should be the only files that affects the dependency install in the next step,

src/crawlee/project_template/{{cookiecutter.project_name}}/_pyproject.toml

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,30 @@
77
# % do extras.append('curl-impersonate')
88
# % endif
99

10-
# % if cookiecutter.package_manager == 'poetry'
11-
[tool.poetry]
10+
[project]
1211
name = "{{cookiecutter.project_name}}"
1312
version = "0.0.1"
1413
description = ""
15-
authors = ["Your Name <[email protected]>"]
14+
authors = [
15+
{name = "Your Name",email = "[email protected]"}
16+
]
1617
readme = "README.md"
17-
package-mode = false
18+
requires-python = ">=3.9,<4.0"
19+
dependencies = [
20+
"crawlee[{{ extras|join(',') }}]",
21+
# % if cookiecutter.crawler_type == 'playwright-camoufox'
22+
"camoufox[geoip]>=0.4.5",
23+
# % endif
24+
# % if cookiecutter.enable_apify_integration
25+
"apify",
26+
# % endif
27+
]
1828

19-
[tool.poetry.dependencies]
20-
python = "^3.9"
21-
# % if cookiecutter.crawler_type == 'playwright-camoufox'
22-
camoufox = {version= ">=0.4.5", extras = ["geoip"]}
23-
# % endif
24-
# % if cookiecutter.enable_apify_integration
25-
apify = "*"
26-
# % endif
27-
crawlee = {version = "*", extras = {{ extras | tojson }}}
29+
# % if cookiecutter.package_manager == 'poetry'
30+
[tool.poetry]
31+
package-mode = false
2832

2933
[build-system]
30-
requires = ["poetry-core"]
34+
requires = ["poetry-core>=2.0.0,<3.0.0"]
3135
build-backend = "poetry.core.masonry.api"
32-
# % else
33-
[project]
34-
name = "{{cookiecutter.project_name}}"
35-
version = "0.0.1"
36-
description = ""
37-
authors = ["Your Name <[email protected]>"]
38-
readme = "README.md"
39-
requires-python = ">=3.9"
4036
# % endif

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)