Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
5517f371
Commit
5517f371
authored
Apr 21, 2023
by
Bartek Sokorski
Committed by
Bartosz Sokorski
Apr 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update pre-commit config and fix issues
parent
66bb5644
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
32 additions
and
50 deletions
+32
-50
.pre-commit-config.yaml
+6
-6
src/poetry/console/commands/about.py
+2
-4
src/poetry/console/commands/show.py
+3
-3
src/poetry/utils/authenticator.py
+3
-3
src/poetry/utils/dependency_specification.py
+3
-3
tests/console/commands/self/test_add_plugins.py
+4
-8
tests/console/commands/test_init.py
+1
-3
tests/console/commands/test_remove.py
+8
-16
tests/utils/test_env.py
+2
-4
No files found.
.pre-commit-config.yaml
View file @
5517f371
...
@@ -21,7 +21,7 @@ repos:
...
@@ -21,7 +21,7 @@ repos:
-
id
:
check-docstring-first
-
id
:
check-docstring-first
-
repo
:
https://github.com/pre-commit/pygrep-hooks
-
repo
:
https://github.com/pre-commit/pygrep-hooks
rev
:
v1.
9
.0
rev
:
v1.
10
.0
hooks
:
hooks
:
-
id
:
python-check-mock-methods
-
id
:
python-check-mock-methods
-
id
:
python-use-type-annotations
-
id
:
python-use-type-annotations
...
@@ -32,10 +32,10 @@ repos:
...
@@ -32,10 +32,10 @@ repos:
hooks
:
hooks
:
-
id
:
pyupgrade
-
id
:
pyupgrade
args
:
[
--py37-plus
]
args
:
[
--py37-plus
]
exclude
:
^
(install|get)
-poetry.py$
exclude
:
^
install
-poetry.py$
-
repo
:
https://github.com/hadialqattan/pycln
-
repo
:
https://github.com/hadialqattan/pycln
rev
:
v2.1.
2
rev
:
v2.1.
3
hooks
:
hooks
:
-
id
:
pycln
-
id
:
pycln
args
:
[
--all
]
args
:
[
--all
]
...
@@ -49,7 +49,7 @@ repos:
...
@@ -49,7 +49,7 @@ repos:
args
:
[
--add-import
,
from __future__ import annotations
]
args
:
[
--add-import
,
from __future__ import annotations
]
exclude
:
|
exclude
:
|
(?x)(
(?x)(
^
(install|get)
-poetry.py$
^
install
-poetry.py$
| ^src/poetry/__init__.py$
| ^src/poetry/__init__.py$
)
)
-
id
:
isort
-
id
:
isort
...
@@ -58,12 +58,12 @@ repos:
...
@@ -58,12 +58,12 @@ repos:
args
:
[
--lines-after-imports
,
"
-1"
]
args
:
[
--lines-after-imports
,
"
-1"
]
-
repo
:
https://github.com/psf/black
-
repo
:
https://github.com/psf/black
rev
:
2
2.12
.0
rev
:
2
3.3
.0
hooks
:
hooks
:
-
id
:
black
-
id
:
black
-
repo
:
https://github.com/pre-commit/pre-commit
-
repo
:
https://github.com/pre-commit/pre-commit
rev
:
v
2.21.0
rev
:
v
3.2.2
hooks
:
hooks
:
-
id
:
validate_manifest
-
id
:
validate_manifest
...
...
src/poetry/console/commands/about.py
View file @
5517f371
...
@@ -21,8 +21,7 @@ class AboutCommand(Command):
...
@@ -21,8 +21,7 @@ class AboutCommand(Command):
# that.
# that.
version
:
Callable
[[
str
],
str
]
=
metadata
.
version
version
:
Callable
[[
str
],
str
]
=
metadata
.
version
self
.
line
(
self
.
line
(
f
"""
\
f
"""
\
<info>Poetry - Package Management for Python
<info>Poetry - Package Management for Python
Version: {version('poetry')}
Version: {version('poetry')}
...
@@ -31,7 +30,6 @@ Poetry-Core Version: {version('poetry-core')}</info>
...
@@ -31,7 +30,6 @@ Poetry-Core Version: {version('poetry-core')}</info>
<comment>Poetry is a dependency manager tracking local dependencies of your projects
\
<comment>Poetry is a dependency manager tracking local dependencies of your projects
\
and libraries.
and libraries.
See <fg=blue>https://github.com/python-poetry/poetry</> for more information.</comment>
\
See <fg=blue>https://github.com/python-poetry/poetry</> for more information.</comment>
\
"""
"""
)
)
return
0
return
0
src/poetry/console/commands/show.py
View file @
5517f371
...
@@ -257,9 +257,9 @@ lists all packages available."""
...
@@ -257,9 +257,9 @@ lists all packages available."""
latest
=
locked
latest
=
locked
latest_packages
[
locked
.
pretty_name
]
=
latest
latest_packages
[
locked
.
pretty_name
]
=
latest
update_status
=
latest_statuses
[
update_status
=
latest_statuses
[
locked
.
pretty_name
]
=
(
locked
.
pretty_name
self
.
get_update_status
(
latest
,
locked
)
]
=
self
.
get_update_status
(
latest
,
locked
)
)
if
not
self
.
option
(
"outdated"
)
or
update_status
!=
"up-to-date"
:
if
not
self
.
option
(
"outdated"
)
or
update_status
!=
"up-to-date"
:
name_length
=
max
(
name_length
,
current_length
)
name_length
=
max
(
name_length
,
current_length
)
...
...
src/poetry/utils/authenticator.py
View file @
5517f371
...
@@ -397,9 +397,9 @@ class Authenticator:
...
@@ -397,9 +397,9 @@ class Authenticator:
self
.
_configured_repositories
=
{}
self
.
_configured_repositories
=
{}
for
repository_name
in
self
.
_config
.
get
(
"repositories"
,
[]):
for
repository_name
in
self
.
_config
.
get
(
"repositories"
,
[]):
url
=
self
.
_config
.
get
(
f
"repositories.{repository_name}.url"
)
url
=
self
.
_config
.
get
(
f
"repositories.{repository_name}.url"
)
self
.
_configured_repositories
[
self
.
_configured_repositories
[
repository_name
]
=
(
repository_name
AuthenticatorRepositoryConfig
(
repository_name
,
url
)
]
=
AuthenticatorRepositoryConfig
(
repository_name
,
url
)
)
return
self
.
_configured_repositories
return
self
.
_configured_repositories
...
...
src/poetry/utils/dependency_specification.py
View file @
5517f371
...
@@ -96,9 +96,9 @@ def _parse_dependency_specification_path(
...
@@ -96,9 +96,9 @@ def _parse_dependency_specification_path(
return
{
return
{
"name"
:
package
.
name
,
"name"
:
package
.
name
,
"path"
:
path
.
relative_to
(
cwd
)
.
as_posix
()
"path"
:
(
if
not
is_absolute
path
.
relative_to
(
cwd
)
.
as_posix
()
if
not
is_absolute
else
path
.
as_posix
()
else
path
.
as_posix
(
),
),
}
}
return
None
return
None
...
...
tests/console/commands/self/test_add_plugins.py
View file @
5517f371
...
@@ -192,8 +192,7 @@ def test_add_existing_plugin_warns_about_no_operation(
...
@@ -192,8 +192,7 @@ def test_add_existing_plugin_warns_about_no_operation(
)
->
None
:
)
->
None
:
pyproject
=
SelfCommand
.
get_default_system_pyproject_file
()
pyproject
=
SelfCommand
.
get_default_system_pyproject_file
()
with
open
(
pyproject
,
"w"
,
encoding
=
"utf-8"
,
newline
=
""
)
as
f
:
with
open
(
pyproject
,
"w"
,
encoding
=
"utf-8"
,
newline
=
""
)
as
f
:
f
.
write
(
f
.
write
(
f
"""
\
f
"""
\
[tool.poetry]
[tool.poetry]
name = "poetry-instance"
name = "poetry-instance"
version = "1.2.0"
version = "1.2.0"
...
@@ -205,8 +204,7 @@ python = "^3.6"
...
@@ -205,8 +204,7 @@ python = "^3.6"
[tool.poetry.group.{SelfCommand.ADDITIONAL_PACKAGE_GROUP}.dependencies]
[tool.poetry.group.{SelfCommand.ADDITIONAL_PACKAGE_GROUP}.dependencies]
poetry-plugin = "^1.2.3"
poetry-plugin = "^1.2.3"
"""
"""
)
)
installed
.
add_package
(
Package
(
"poetry-plugin"
,
"1.2.3"
))
installed
.
add_package
(
Package
(
"poetry-plugin"
,
"1.2.3"
))
...
@@ -233,8 +231,7 @@ def test_add_existing_plugin_updates_if_requested(
...
@@ -233,8 +231,7 @@ def test_add_existing_plugin_updates_if_requested(
)
->
None
:
)
->
None
:
pyproject
=
SelfCommand
.
get_default_system_pyproject_file
()
pyproject
=
SelfCommand
.
get_default_system_pyproject_file
()
with
open
(
pyproject
,
"w"
,
encoding
=
"utf-8"
,
newline
=
""
)
as
f
:
with
open
(
pyproject
,
"w"
,
encoding
=
"utf-8"
,
newline
=
""
)
as
f
:
f
.
write
(
f
.
write
(
f
"""
\
f
"""
\
[tool.poetry]
[tool.poetry]
name = "poetry-instance"
name = "poetry-instance"
version = "1.2.0"
version = "1.2.0"
...
@@ -246,8 +243,7 @@ python = "^3.6"
...
@@ -246,8 +243,7 @@ python = "^3.6"
[tool.poetry.group.{SelfCommand.ADDITIONAL_PACKAGE_GROUP}.dependencies]
[tool.poetry.group.{SelfCommand.ADDITIONAL_PACKAGE_GROUP}.dependencies]
poetry-plugin = "^1.2.3"
poetry-plugin = "^1.2.3"
"""
"""
)
)
installed
.
add_package
(
Package
(
"poetry-plugin"
,
"1.2.3"
))
installed
.
add_package
(
Package
(
"poetry-plugin"
,
"1.2.3"
))
...
...
tests/console/commands/test_init.py
View file @
5517f371
...
@@ -921,9 +921,7 @@ def test_init_existing_pyproject_consistent_linesep(
...
@@ -921,9 +921,7 @@ def test_init_existing_pyproject_consistent_linesep(
existing_section
=
"""
existing_section
=
"""
[tool.black]
[tool.black]
line-length = 88
line-length = 88
"""
.
replace
(
"""
.
replace
(
"
\n
"
,
linesep
)
"
\n
"
,
linesep
)
with
open
(
pyproject_file
,
"w"
,
newline
=
""
)
as
f
:
with
open
(
pyproject_file
,
"w"
,
newline
=
""
)
as
f
:
f
.
write
(
existing_section
)
f
.
write
(
existing_section
)
tester
.
execute
(
inputs
=
init_basic_inputs
)
tester
.
execute
(
inputs
=
init_basic_inputs
)
...
...
tests/console/commands/test_remove.py
View file @
5517f371
...
@@ -58,14 +58,12 @@ def test_remove_without_specific_group_removes_from_all_groups(
...
@@ -58,14 +58,12 @@ def test_remove_without_specific_group_removes_from_all_groups(
content
=
app
.
poetry
.
file
.
read
()
content
=
app
.
poetry
.
file
.
read
()
groups_content
=
tomlkit
.
parse
(
groups_content
=
tomlkit
.
parse
(
"""
\
"""
\
[tool.poetry.group.bar.dependencies]
[tool.poetry.group.bar.dependencies]
foo = "^2.0.0"
foo = "^2.0.0"
baz = "^1.0.0"
baz = "^1.0.0"
"""
"""
)
)
content
[
"tool"
][
"poetry"
][
"dependencies"
][
"foo"
]
=
"^2.0.0"
content
[
"tool"
][
"poetry"
][
"dependencies"
][
"foo"
]
=
"^2.0.0"
content
[
"tool"
][
"poetry"
][
"group"
]
=
groups_content
[
"tool"
][
"poetry"
][
"group"
]
content
[
"tool"
][
"poetry"
][
"group"
]
=
groups_content
[
"tool"
][
"poetry"
][
"group"
]
app
.
poetry
.
file
.
write
(
content
)
app
.
poetry
.
file
.
write
(
content
)
...
@@ -115,14 +113,12 @@ def test_remove_without_specific_group_removes_from_specific_groups(
...
@@ -115,14 +113,12 @@ def test_remove_without_specific_group_removes_from_specific_groups(
content
=
app
.
poetry
.
file
.
read
()
content
=
app
.
poetry
.
file
.
read
()
groups_content
=
tomlkit
.
parse
(
groups_content
=
tomlkit
.
parse
(
"""
\
"""
\
[tool.poetry.group.bar.dependencies]
[tool.poetry.group.bar.dependencies]
foo = "^2.0.0"
foo = "^2.0.0"
baz = "^1.0.0"
baz = "^1.0.0"
"""
"""
)
)
content
[
"tool"
][
"poetry"
][
"dependencies"
][
"foo"
]
=
"^2.0.0"
content
[
"tool"
][
"poetry"
][
"dependencies"
][
"foo"
]
=
"^2.0.0"
content
[
"tool"
][
"poetry"
][
"group"
]
=
groups_content
[
"tool"
][
"poetry"
][
"group"
]
content
[
"tool"
][
"poetry"
][
"group"
]
=
groups_content
[
"tool"
][
"poetry"
][
"group"
]
app
.
poetry
.
file
.
write
(
content
)
app
.
poetry
.
file
.
write
(
content
)
...
@@ -172,14 +168,12 @@ def test_remove_does_not_live_empty_groups(
...
@@ -172,14 +168,12 @@ def test_remove_does_not_live_empty_groups(
content
=
app
.
poetry
.
file
.
read
()
content
=
app
.
poetry
.
file
.
read
()
groups_content
=
tomlkit
.
parse
(
groups_content
=
tomlkit
.
parse
(
"""
\
"""
\
[tool.poetry.group.bar.dependencies]
[tool.poetry.group.bar.dependencies]
foo = "^2.0.0"
foo = "^2.0.0"
baz = "^1.0.0"
baz = "^1.0.0"
"""
"""
)
)
content
[
"tool"
][
"poetry"
][
"dependencies"
][
"foo"
]
=
"^2.0.0"
content
[
"tool"
][
"poetry"
][
"dependencies"
][
"foo"
]
=
"^2.0.0"
content
[
"tool"
][
"poetry"
][
"group"
]
=
groups_content
[
"tool"
][
"poetry"
][
"group"
]
content
[
"tool"
][
"poetry"
][
"group"
]
=
groups_content
[
"tool"
][
"poetry"
][
"group"
]
app
.
poetry
.
file
.
write
(
content
)
app
.
poetry
.
file
.
write
(
content
)
...
@@ -218,14 +212,12 @@ def test_remove_canonicalized_named_removes_dependency_correctly(
...
@@ -218,14 +212,12 @@ def test_remove_canonicalized_named_removes_dependency_correctly(
content
=
app
.
poetry
.
file
.
read
()
content
=
app
.
poetry
.
file
.
read
()
groups_content
=
tomlkit
.
parse
(
groups_content
=
tomlkit
.
parse
(
"""
\
"""
\
[tool.poetry.group.bar.dependencies]
[tool.poetry.group.bar.dependencies]
foo-bar = "^2.0.0"
foo-bar = "^2.0.0"
baz = "^1.0.0"
baz = "^1.0.0"
"""
"""
)
)
content
[
"tool"
][
"poetry"
][
"dependencies"
][
"foo-bar"
]
=
"^2.0.0"
content
[
"tool"
][
"poetry"
][
"dependencies"
][
"foo-bar"
]
=
"^2.0.0"
content
[
"tool"
][
"poetry"
]
.
value
.
_insert_after
(
content
[
"tool"
][
"poetry"
]
.
value
.
_insert_after
(
"dependencies"
,
"group"
,
groups_content
[
"tool"
][
"poetry"
][
"group"
]
"dependencies"
,
"group"
,
groups_content
[
"tool"
][
"poetry"
][
"group"
]
...
...
tests/utils/test_env.py
View file @
5517f371
...
@@ -1091,13 +1091,11 @@ def test_call_does_not_block_on_full_pipe(
...
@@ -1091,13 +1091,11 @@ def test_call_does_not_block_on_full_pipe(
)
->
None
:
)
->
None
:
"""see https://github.com/python-poetry/poetry/issues/7698"""
"""see https://github.com/python-poetry/poetry/issues/7698"""
script
=
tmp_path
/
"script.py"
script
=
tmp_path
/
"script.py"
script
.
write_text
(
script
.
write_text
(
f
"""
\
f
"""
\
import sys
import sys
for i in range(10000):
for i in range(10000):
print('just print a lot of text to fill the buffer', file={out})
print('just print a lot of text to fill the buffer', file={out})
"""
"""
)
)
def
target
(
result
:
list
[
int
])
->
None
:
def
target
(
result
:
list
[
int
])
->
None
:
tmp_venv
.
run
(
"python"
,
str
(
script
),
call
=
True
)
tmp_venv
.
run
(
"python"
,
str
(
script
),
call
=
True
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment