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
0ff5a6a0
Commit
0ff5a6a0
authored
Jun 02, 2022
by
David Hotham
Committed by
Bjorn Neergaard
Jun 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleo-typechecking
parent
17b6a78c
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
76 additions
and
61 deletions
+76
-61
src/poetry/console/commands/about.py
+3
-1
src/poetry/console/commands/add.py
+1
-1
src/poetry/console/commands/build.py
+3
-1
src/poetry/console/commands/cache/list.py
+2
-2
src/poetry/console/commands/config.py
+2
-2
src/poetry/console/commands/debug/info.py
+1
-1
src/poetry/console/commands/debug/resolve.py
+1
-1
src/poetry/console/commands/env/info.py
+3
-3
src/poetry/console/commands/env/list.py
+3
-1
src/poetry/console/commands/env/remove.py
+3
-1
src/poetry/console/commands/env/use.py
+6
-4
src/poetry/console/commands/install.py
+3
-3
src/poetry/console/commands/new.py
+3
-1
src/poetry/console/commands/plugin/add.py
+2
-2
src/poetry/console/commands/plugin/remove.py
+2
-2
src/poetry/console/commands/plugin/show.py
+2
-2
src/poetry/console/commands/publish.py
+2
-2
src/poetry/console/commands/remove.py
+1
-1
src/poetry/console/commands/run.py
+2
-3
src/poetry/console/commands/search.py
+3
-1
src/poetry/console/commands/self/self_command.py
+1
-1
src/poetry/console/commands/self/update.py
+3
-3
src/poetry/console/commands/shell.py
+4
-2
src/poetry/console/commands/show.py
+9
-11
src/poetry/console/commands/source/add.py
+1
-1
src/poetry/console/commands/source/remove.py
+1
-1
src/poetry/console/commands/source/show.py
+1
-1
src/poetry/console/commands/version.py
+3
-1
src/poetry/utils/env.py
+5
-5
No files found.
src/poetry/console/commands/about.py
View file @
0ff5a6a0
...
@@ -15,7 +15,7 @@ class AboutCommand(Command):
...
@@ -15,7 +15,7 @@ class AboutCommand(Command):
description
=
"Shows information about Poetry."
description
=
"Shows information about Poetry."
def
handle
(
self
)
->
None
:
def
handle
(
self
)
->
int
:
from
poetry.utils._compat
import
metadata
from
poetry.utils._compat
import
metadata
# The metadata.version that we import for Python 3.7 is untyped, work around
# The metadata.version that we import for Python 3.7 is untyped, work around
...
@@ -34,3 +34,5 @@ Poetry-Core Version: {version('poetry-core')}</info>
...
@@ -34,3 +34,5 @@ Poetry-Core Version: {version('poetry-core')}</info>
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
src/poetry/console/commands/add.py
View file @
0ff5a6a0
...
@@ -245,7 +245,7 @@ The add command adds required packages to your <comment>pyproject.toml</> and in
...
@@ -245,7 +245,7 @@ The add command adds required packages to your <comment>pyproject.toml</> and in
self
.
_installer
.
set_package
(
self
.
poetry
.
package
)
self
.
_installer
.
set_package
(
self
.
poetry
.
package
)
self
.
_installer
.
dry_run
(
self
.
option
(
"dry-run"
))
self
.
_installer
.
dry_run
(
self
.
option
(
"dry-run"
))
self
.
_installer
.
verbose
(
self
.
_
io
.
is_verbose
())
self
.
_installer
.
verbose
(
self
.
io
.
is_verbose
())
self
.
_installer
.
update
(
True
)
self
.
_installer
.
update
(
True
)
if
self
.
option
(
"lock"
):
if
self
.
option
(
"lock"
):
self
.
_installer
.
lock
()
self
.
_installer
.
lock
()
...
...
src/poetry/console/commands/build.py
View file @
0ff5a6a0
...
@@ -21,7 +21,7 @@ class BuildCommand(EnvCommand):
...
@@ -21,7 +21,7 @@ class BuildCommand(EnvCommand):
"poetry.core.masonry.builders.wheel"
,
"poetry.core.masonry.builders.wheel"
,
]
]
def
handle
(
self
)
->
None
:
def
handle
(
self
)
->
int
:
from
poetry.core.masonry.builder
import
Builder
from
poetry.core.masonry.builder
import
Builder
with
build_environment
(
poetry
=
self
.
poetry
,
env
=
self
.
env
,
io
=
self
.
io
)
as
env
:
with
build_environment
(
poetry
=
self
.
poetry
,
env
=
self
.
env
,
io
=
self
.
io
)
as
env
:
...
@@ -33,3 +33,5 @@ class BuildCommand(EnvCommand):
...
@@ -33,3 +33,5 @@ class BuildCommand(EnvCommand):
builder
=
Builder
(
self
.
poetry
)
builder
=
Builder
(
self
.
poetry
)
builder
.
build
(
fmt
,
executable
=
env
.
python
)
builder
.
build
(
fmt
,
executable
=
env
.
python
)
return
0
src/poetry/console/commands/cache/list.py
View file @
0ff5a6a0
...
@@ -9,7 +9,7 @@ class CacheListCommand(Command):
...
@@ -9,7 +9,7 @@ class CacheListCommand(Command):
name
=
"cache list"
name
=
"cache list"
description
=
"List Poetry's caches."
description
=
"List Poetry's caches."
def
handle
(
self
)
->
int
|
None
:
def
handle
(
self
)
->
int
:
config
=
Config
.
create
()
config
=
Config
.
create
()
if
config
.
repository_cache_directory
.
exists
():
if
config
.
repository_cache_directory
.
exists
():
caches
=
sorted
(
config
.
repository_cache_directory
.
iterdir
())
caches
=
sorted
(
config
.
repository_cache_directory
.
iterdir
())
...
@@ -19,4 +19,4 @@ class CacheListCommand(Command):
...
@@ -19,4 +19,4 @@ class CacheListCommand(Command):
return
0
return
0
self
.
line_error
(
"<warning>No caches found</>"
)
self
.
line_error
(
"<warning>No caches found</>"
)
return
None
return
0
src/poetry/console/commands/config.py
View file @
0ff5a6a0
...
@@ -120,7 +120,7 @@ To remove a repository (repo is a short alias for repositories):
...
@@ -120,7 +120,7 @@ To remove a repository (repo is a short alias for repositories):
return
unique_config_values
return
unique_config_values
def
handle
(
self
)
->
int
|
None
:
def
handle
(
self
)
->
int
:
from
pathlib
import
Path
from
pathlib
import
Path
from
poetry.core.pyproject.exceptions
import
PyProjectException
from
poetry.core.pyproject.exceptions
import
PyProjectException
...
@@ -195,7 +195,7 @@ To remove a repository (repo is a short alias for repositories):
...
@@ -195,7 +195,7 @@ To remove a repository (repo is a short alias for repositories):
if
setting_key
in
unique_config_values
:
if
setting_key
in
unique_config_values
:
if
self
.
option
(
"unset"
):
if
self
.
option
(
"unset"
):
config
.
config_source
.
remove_property
(
setting_key
)
config
.
config_source
.
remove_property
(
setting_key
)
return
None
return
0
return
self
.
_handle_single_value
(
return
self
.
_handle_single_value
(
config
.
config_source
,
config
.
config_source
,
...
...
src/poetry/console/commands/debug/info.py
View file @
0ff5a6a0
...
@@ -25,5 +25,5 @@ class DebugInfoCommand(Command):
...
@@ -25,5 +25,5 @@ class DebugInfoCommand(Command):
)
)
command
=
self
.
application
.
get
(
"env info"
)
command
=
self
.
application
.
get
(
"env info"
)
exit_code
:
int
=
command
.
run
(
self
.
_
io
)
exit_code
:
int
=
command
.
run
(
self
.
io
)
return
exit_code
return
exit_code
src/poetry/console/commands/debug/resolve.py
View file @
0ff5a6a0
...
@@ -86,7 +86,7 @@ class DebugResolveCommand(InitCommand):
...
@@ -86,7 +86,7 @@ class DebugResolveCommand(InitCommand):
pool
=
self
.
poetry
.
pool
pool
=
self
.
poetry
.
pool
solver
=
Solver
(
package
,
pool
,
Repository
(),
Repository
(),
self
.
_
io
)
solver
=
Solver
(
package
,
pool
,
Repository
(),
Repository
(),
self
.
io
)
ops
=
solver
.
solve
()
.
calculate_operations
()
ops
=
solver
.
solve
()
.
calculate_operations
()
...
...
src/poetry/console/commands/env/info.py
View file @
0ff5a6a0
...
@@ -18,7 +18,7 @@ class EnvInfoCommand(Command):
...
@@ -18,7 +18,7 @@ class EnvInfoCommand(Command):
options
=
[
option
(
"path"
,
"p"
,
"Only display the environment's path."
)]
options
=
[
option
(
"path"
,
"p"
,
"Only display the environment's path."
)]
def
handle
(
self
)
->
int
|
None
:
def
handle
(
self
)
->
int
:
from
poetry.utils.env
import
EnvManager
from
poetry.utils.env
import
EnvManager
env
=
EnvManager
(
self
.
poetry
)
.
get
()
env
=
EnvManager
(
self
.
poetry
)
.
get
()
...
@@ -29,10 +29,10 @@ class EnvInfoCommand(Command):
...
@@ -29,10 +29,10 @@ class EnvInfoCommand(Command):
self
.
line
(
str
(
env
.
path
))
self
.
line
(
str
(
env
.
path
))
return
None
return
0
self
.
_display_complete_info
(
env
)
self
.
_display_complete_info
(
env
)
return
None
return
0
def
_display_complete_info
(
self
,
env
:
Env
)
->
None
:
def
_display_complete_info
(
self
,
env
:
Env
)
->
None
:
env_python_version
=
"."
.
join
(
str
(
s
)
for
s
in
env
.
version_info
[:
3
])
env_python_version
=
"."
.
join
(
str
(
s
)
for
s
in
env
.
version_info
[:
3
])
...
...
src/poetry/console/commands/env/list.py
View file @
0ff5a6a0
...
@@ -12,7 +12,7 @@ class EnvListCommand(Command):
...
@@ -12,7 +12,7 @@ class EnvListCommand(Command):
options
=
[
option
(
"full-path"
,
None
,
"Output the full paths of the virtualenvs."
)]
options
=
[
option
(
"full-path"
,
None
,
"Output the full paths of the virtualenvs."
)]
def
handle
(
self
)
->
None
:
def
handle
(
self
)
->
int
:
from
poetry.utils.env
import
EnvManager
from
poetry.utils.env
import
EnvManager
manager
=
EnvManager
(
self
.
poetry
)
manager
=
EnvManager
(
self
.
poetry
)
...
@@ -29,3 +29,5 @@ class EnvListCommand(Command):
...
@@ -29,3 +29,5 @@ class EnvListCommand(Command):
continue
continue
self
.
line
(
name
)
self
.
line
(
name
)
return
0
src/poetry/console/commands/env/remove.py
View file @
0ff5a6a0
...
@@ -29,7 +29,7 @@ class EnvRemoveCommand(Command):
...
@@ -29,7 +29,7 @@ class EnvRemoveCommand(Command):
),
),
]
]
def
handle
(
self
)
->
None
:
def
handle
(
self
)
->
int
:
from
poetry.utils.env
import
EnvManager
from
poetry.utils.env
import
EnvManager
pythons
=
self
.
argument
(
"python"
)
pythons
=
self
.
argument
(
"python"
)
...
@@ -46,3 +46,5 @@ class EnvRemoveCommand(Command):
...
@@ -46,3 +46,5 @@ class EnvRemoveCommand(Command):
for
venv
in
manager
.
list
():
for
venv
in
manager
.
list
():
manager
.
remove_venv
(
venv
.
path
)
manager
.
remove_venv
(
venv
.
path
)
self
.
line
(
f
"Deleted virtualenv: <comment>{venv.path}</comment>"
)
self
.
line
(
f
"Deleted virtualenv: <comment>{venv.path}</comment>"
)
return
0
src/poetry/console/commands/env/use.py
View file @
0ff5a6a0
...
@@ -12,16 +12,18 @@ class EnvUseCommand(Command):
...
@@ -12,16 +12,18 @@ class EnvUseCommand(Command):
arguments
=
[
argument
(
"python"
,
"The python executable to use."
)]
arguments
=
[
argument
(
"python"
,
"The python executable to use."
)]
def
handle
(
self
)
->
None
:
def
handle
(
self
)
->
int
:
from
poetry.utils.env
import
EnvManager
from
poetry.utils.env
import
EnvManager
manager
=
EnvManager
(
self
.
poetry
)
manager
=
EnvManager
(
self
.
poetry
)
if
self
.
argument
(
"python"
)
==
"system"
:
if
self
.
argument
(
"python"
)
==
"system"
:
manager
.
deactivate
(
self
.
_
io
)
manager
.
deactivate
(
self
.
io
)
return
return
0
env
=
manager
.
activate
(
self
.
argument
(
"python"
),
self
.
_
io
)
env
=
manager
.
activate
(
self
.
argument
(
"python"
),
self
.
io
)
self
.
line
(
f
"Using virtualenv: <comment>{env.path}</>"
)
self
.
line
(
f
"Using virtualenv: <comment>{env.path}</>"
)
return
0
src/poetry/console/commands/install.py
View file @
0ff5a6a0
...
@@ -101,7 +101,7 @@ dependencies and not including the current project, run the command with the
...
@@ -101,7 +101,7 @@ dependencies and not including the current project, run the command with the
self
.
_installer
.
only_groups
(
self
.
activated_groups
)
self
.
_installer
.
only_groups
(
self
.
activated_groups
)
self
.
_installer
.
dry_run
(
self
.
option
(
"dry-run"
))
self
.
_installer
.
dry_run
(
self
.
option
(
"dry-run"
))
self
.
_installer
.
requires_synchronization
(
with_synchronization
)
self
.
_installer
.
requires_synchronization
(
with_synchronization
)
self
.
_installer
.
verbose
(
self
.
_
io
.
is_verbose
())
self
.
_installer
.
verbose
(
self
.
io
.
is_verbose
())
return_code
=
self
.
_installer
.
run
()
return_code
=
self
.
_installer
.
run
()
...
@@ -112,7 +112,7 @@ dependencies and not including the current project, run the command with the
...
@@ -112,7 +112,7 @@ dependencies and not including the current project, run the command with the
return
0
return
0
try
:
try
:
builder
=
EditableBuilder
(
self
.
poetry
,
self
.
_env
,
self
.
_
io
)
builder
=
EditableBuilder
(
self
.
poetry
,
self
.
_env
,
self
.
io
)
except
ModuleOrPackageNotFound
:
except
ModuleOrPackageNotFound
:
# This is likely due to the fact that the project is an application
# This is likely due to the fact that the project is an application
# not following the structure expected by Poetry
# not following the structure expected by Poetry
...
@@ -124,7 +124,7 @@ dependencies and not including the current project, run the command with the
...
@@ -124,7 +124,7 @@ dependencies and not including the current project, run the command with the
f
" <c1>{self.poetry.package.pretty_name}</c1>"
f
" <c1>{self.poetry.package.pretty_name}</c1>"
f
" (<{{tag}}>{self.poetry.package.pretty_version}</>)"
f
" (<{{tag}}>{self.poetry.package.pretty_version}</>)"
)
)
overwrite
=
self
.
_
io
.
output
.
is_decorated
()
and
not
self
.
io
.
is_debug
()
overwrite
=
self
.
io
.
output
.
is_decorated
()
and
not
self
.
io
.
is_debug
()
self
.
line
(
""
)
self
.
line
(
""
)
self
.
write
(
log_install
.
format
(
tag
=
"c2"
))
self
.
write
(
log_install
.
format
(
tag
=
"c2"
))
if
not
overwrite
:
if
not
overwrite
:
...
...
src/poetry/console/commands/new.py
View file @
0ff5a6a0
...
@@ -27,7 +27,7 @@ class NewCommand(Command):
...
@@ -27,7 +27,7 @@ class NewCommand(Command):
),
),
]
]
def
handle
(
self
)
->
None
:
def
handle
(
self
)
->
int
:
from
pathlib
import
Path
from
pathlib
import
Path
from
poetry.core.vcs.git
import
GitConfig
from
poetry.core.vcs.git
import
GitConfig
...
@@ -87,3 +87,5 @@ class NewCommand(Command):
...
@@ -87,3 +87,5 @@ class NewCommand(Command):
f
"Created package <info>{layout_._package_name}</> in"
f
"Created package <info>{layout_._package_name}</> in"
f
" <fg=blue>{path.as_posix()}</>"
f
" <fg=blue>{path.as_posix()}</>"
)
)
return
0
src/poetry/console/commands/plugin/add.py
View file @
0ff5a6a0
...
@@ -60,8 +60,8 @@ It works similarly to the <c1>add</c1> command:
...
@@ -60,8 +60,8 @@ It works similarly to the <c1>add</c1> command:
exit_code
:
int
=
command
.
run
(
exit_code
:
int
=
command
.
run
(
IO
(
IO
(
StringInput
(
" "
.
join
(
argv
)),
StringInput
(
" "
.
join
(
argv
)),
self
.
_
io
.
output
,
self
.
io
.
output
,
self
.
_
io
.
error_output
,
self
.
io
.
error_output
,
)
)
)
)
return
exit_code
return
exit_code
src/poetry/console/commands/plugin/remove.py
View file @
0ff5a6a0
...
@@ -55,8 +55,8 @@ class PluginRemoveCommand(Command):
...
@@ -55,8 +55,8 @@ class PluginRemoveCommand(Command):
exit_code
:
int
=
command
.
run
(
exit_code
:
int
=
command
.
run
(
IO
(
IO
(
StringInput
(
" "
.
join
(
argv
)),
StringInput
(
" "
.
join
(
argv
)),
self
.
_
io
.
output
,
self
.
io
.
output
,
self
.
_
io
.
error_output
,
self
.
io
.
error_output
,
)
)
)
)
return
exit_code
return
exit_code
src/poetry/console/commands/plugin/show.py
View file @
0ff5a6a0
...
@@ -32,8 +32,8 @@ class PluginShowCommand(Command):
...
@@ -32,8 +32,8 @@ class PluginShowCommand(Command):
exit_code
:
int
=
command
.
run
(
exit_code
:
int
=
command
.
run
(
IO
(
IO
(
StringInput
(
""
),
StringInput
(
""
),
self
.
_
io
.
output
,
self
.
io
.
output
,
self
.
_
io
.
error_output
,
self
.
io
.
error_output
,
)
)
)
)
return
exit_code
return
exit_code
src/poetry/console/commands/publish.py
View file @
0ff5a6a0
...
@@ -47,7 +47,7 @@ the config command.
...
@@ -47,7 +47,7 @@ the config command.
loggers
=
[
"poetry.masonry.publishing.publisher"
]
loggers
=
[
"poetry.masonry.publishing.publisher"
]
def
handle
(
self
)
->
int
|
None
:
def
handle
(
self
)
->
int
:
from
poetry.publishing.publisher
import
Publisher
from
poetry.publishing.publisher
import
Publisher
publisher
=
Publisher
(
self
.
poetry
,
self
.
io
)
publisher
=
Publisher
(
self
.
poetry
,
self
.
io
)
...
@@ -90,4 +90,4 @@ the config command.
...
@@ -90,4 +90,4 @@ the config command.
self
.
option
(
"skip-existing"
),
self
.
option
(
"skip-existing"
),
)
)
return
None
return
0
src/poetry/console/commands/remove.py
View file @
0ff5a6a0
...
@@ -105,7 +105,7 @@ list of installed packages
...
@@ -105,7 +105,7 @@ list of installed packages
self
.
_installer
.
set_package
(
self
.
poetry
.
package
)
self
.
_installer
.
set_package
(
self
.
poetry
.
package
)
self
.
_installer
.
dry_run
(
self
.
option
(
"dry-run"
,
False
))
self
.
_installer
.
dry_run
(
self
.
option
(
"dry-run"
,
False
))
self
.
_installer
.
verbose
(
self
.
_
io
.
is_verbose
())
self
.
_installer
.
verbose
(
self
.
io
.
is_verbose
())
self
.
_installer
.
update
(
True
)
self
.
_installer
.
update
(
True
)
self
.
_installer
.
whitelist
(
removed_set
)
self
.
_installer
.
whitelist
(
removed_set
)
...
...
src/poetry/console/commands/run.py
View file @
0ff5a6a0
from
__future__
import
annotations
from
__future__
import
annotations
from
typing
import
TYPE_CHECKING
from
typing
import
TYPE_CHECKING
from
typing
import
Any
from
cleo.helpers
import
argument
from
cleo.helpers
import
argument
...
@@ -21,7 +20,7 @@ class RunCommand(EnvCommand):
...
@@ -21,7 +20,7 @@ class RunCommand(EnvCommand):
argument
(
"args"
,
"The command and arguments/options to run."
,
multiple
=
True
)
argument
(
"args"
,
"The command and arguments/options to run."
,
multiple
=
True
)
]
]
def
handle
(
self
)
->
Any
:
def
handle
(
self
)
->
int
:
args
=
self
.
argument
(
"args"
)
args
=
self
.
argument
(
"args"
)
script
=
args
[
0
]
script
=
args
[
0
]
scripts
=
self
.
poetry
.
local_config
.
get
(
"scripts"
)
scripts
=
self
.
poetry
.
local_config
.
get
(
"scripts"
)
...
@@ -46,7 +45,7 @@ class RunCommand(EnvCommand):
...
@@ -46,7 +45,7 @@ class RunCommand(EnvCommand):
return
module
return
module
def
run_script
(
self
,
script
:
str
|
dict
[
str
,
str
],
args
:
str
)
->
Any
:
def
run_script
(
self
,
script
:
str
|
dict
[
str
,
str
],
args
:
str
)
->
int
:
if
isinstance
(
script
,
dict
):
if
isinstance
(
script
,
dict
):
script
=
script
[
"callable"
]
script
=
script
[
"callable"
]
...
...
src/poetry/console/commands/search.py
View file @
0ff5a6a0
...
@@ -12,7 +12,7 @@ class SearchCommand(Command):
...
@@ -12,7 +12,7 @@ class SearchCommand(Command):
arguments
=
[
argument
(
"tokens"
,
"The tokens to search for."
,
multiple
=
True
)]
arguments
=
[
argument
(
"tokens"
,
"The tokens to search for."
,
multiple
=
True
)]
def
handle
(
self
)
->
None
:
def
handle
(
self
)
->
int
:
from
poetry.repositories.pypi_repository
import
PyPiRepository
from
poetry.repositories.pypi_repository
import
PyPiRepository
results
=
PyPiRepository
()
.
search
(
self
.
argument
(
"tokens"
))
results
=
PyPiRepository
()
.
search
(
self
.
argument
(
"tokens"
))
...
@@ -27,3 +27,5 @@ class SearchCommand(Command):
...
@@ -27,3 +27,5 @@ class SearchCommand(Command):
if
result
.
description
:
if
result
.
description
:
self
.
line
(
f
" {result.description}"
)
self
.
line
(
f
" {result.description}"
)
return
0
src/poetry/console/commands/self/self_command.py
View file @
0ff5a6a0
...
@@ -83,7 +83,7 @@ class SelfCommand(InstallerCommand):
...
@@ -83,7 +83,7 @@ class SelfCommand(InstallerCommand):
with
directory
(
self
.
system_pyproject
.
parent
):
with
directory
(
self
.
system_pyproject
.
parent
):
self
.
generate_system_pyproject
()
self
.
generate_system_pyproject
()
self
.
_poetry
=
Factory
()
.
create_poetry
(
self
.
_poetry
=
Factory
()
.
create_poetry
(
self
.
system_pyproject
.
parent
,
io
=
self
.
_
io
,
disable_plugins
=
True
self
.
system_pyproject
.
parent
,
io
=
self
.
io
,
disable_plugins
=
True
)
)
@property
@property
...
...
src/poetry/console/commands/self/update.py
View file @
0ff5a6a0
...
@@ -40,7 +40,7 @@ environment.
...
@@ -40,7 +40,7 @@ environment.
application
=
cast
(
Application
,
self
.
application
)
application
=
cast
(
Application
,
self
.
application
)
add_command
:
AddCommand
=
cast
(
AddCommand
,
application
.
find
(
"add"
))
add_command
:
AddCommand
=
cast
(
AddCommand
,
application
.
find
(
"add"
))
add_command
.
set_env
(
self
.
env
)
add_command
.
set_env
(
self
.
env
)
application
.
configure_installer_for_command
(
add_command
,
self
.
_
io
)
application
.
configure_installer_for_command
(
add_command
,
self
.
io
)
argv
=
[
"add"
,
f
"poetry@{self.argument('version')}"
]
argv
=
[
"add"
,
f
"poetry@{self.argument('version')}"
]
...
@@ -53,8 +53,8 @@ environment.
...
@@ -53,8 +53,8 @@ environment.
exit_code
:
int
=
add_command
.
run
(
exit_code
:
int
=
add_command
.
run
(
IO
(
IO
(
StringInput
(
" "
.
join
(
argv
)),
StringInput
(
" "
.
join
(
argv
)),
self
.
_
io
.
output
,
self
.
io
.
output
,
self
.
_
io
.
error_output
,
self
.
io
.
error_output
,
)
)
)
)
return
exit_code
return
exit_code
src/poetry/console/commands/shell.py
View file @
0ff5a6a0
...
@@ -18,7 +18,7 @@ class ShellCommand(EnvCommand):
...
@@ -18,7 +18,7 @@ class ShellCommand(EnvCommand):
If one doesn't exist yet, it will be created.
If one doesn't exist yet, it will be created.
"""
"""
def
handle
(
self
)
->
None
:
def
handle
(
self
)
->
int
:
from
poetry.utils.shell
import
Shell
from
poetry.utils.shell
import
Shell
# Check if it's already activated or doesn't exist and won't be created
# Check if it's already activated or doesn't exist and won't be created
...
@@ -30,7 +30,7 @@ If one doesn't exist yet, it will be created.
...
@@ -30,7 +30,7 @@ If one doesn't exist yet, it will be created.
f
"Virtual environment already activated: <info>{self.env.path}</>"
f
"Virtual environment already activated: <info>{self.env.path}</>"
)
)
return
return
0
self
.
line
(
f
"Spawning shell within <info>{self.env.path}</>"
)
self
.
line
(
f
"Spawning shell within <info>{self.env.path}</>"
)
...
@@ -39,3 +39,5 @@ If one doesn't exist yet, it will be created.
...
@@ -39,3 +39,5 @@ If one doesn't exist yet, it will be created.
shell
=
Shell
.
get
()
shell
=
Shell
.
get
()
shell
.
activate
(
self
.
env
)
# type: ignore[arg-type]
shell
.
activate
(
self
.
env
)
# type: ignore[arg-type]
environ
.
pop
(
"POETRY_ACTIVE"
)
environ
.
pop
(
"POETRY_ACTIVE"
)
return
0
src/poetry/console/commands/show.py
View file @
0ff5a6a0
...
@@ -72,7 +72,7 @@ lists all packages available."""
...
@@ -72,7 +72,7 @@ lists all packages available."""
colors
=
[
"cyan"
,
"yellow"
,
"green"
,
"magenta"
,
"blue"
]
colors
=
[
"cyan"
,
"yellow"
,
"green"
,
"magenta"
,
"blue"
]
def
handle
(
self
)
->
int
|
None
:
def
handle
(
self
)
->
int
:
from
cleo.io.null_io
import
NullIO
from
cleo.io.null_io
import
NullIO
from
cleo.terminal
import
Terminal
from
cleo.terminal
import
Terminal
...
@@ -105,7 +105,7 @@ lists all packages available."""
...
@@ -105,7 +105,7 @@ lists all packages available."""
return
1
return
1
if
self
.
option
(
"outdated"
):
if
self
.
option
(
"outdated"
):
self
.
_
io
.
input
.
set_option
(
"latest"
,
True
)
self
.
io
.
input
.
set_option
(
"latest"
,
True
)
if
not
self
.
poetry
.
locker
.
is_locked
():
if
not
self
.
poetry
.
locker
.
is_locked
():
self
.
line_error
(
self
.
line_error
(
...
@@ -124,7 +124,7 @@ lists all packages available."""
...
@@ -124,7 +124,7 @@ lists all packages available."""
for
p
in
packages
:
for
p
in
packages
:
for
require
in
requires
:
for
require
in
requires
:
if
p
.
name
==
require
.
name
:
if
p
.
name
==
require
.
name
:
self
.
display_package_tree
(
self
.
_
io
,
p
,
locked_repo
)
self
.
display_package_tree
(
self
.
io
,
p
,
locked_repo
)
break
break
return
0
return
0
...
@@ -175,17 +175,15 @@ lists all packages available."""
...
@@ -175,17 +175,15 @@ lists all packages available."""
# if no rev-deps exist we'll make this clear as it can otherwise
# if no rev-deps exist we'll make this clear as it can otherwise
# look very odd for packages that also have no or few direct
# look very odd for packages that also have no or few direct
# dependencies
# dependencies
self
.
_io
.
write_line
(
self
.
io
.
write_line
(
f
"Package {package} is a direct dependency."
)
f
"Package {package} is a direct dependency."
)
for
p
in
packages
:
for
p
in
packages
:
self
.
display_package_tree
(
self
.
display_package_tree
(
self
.
_
io
,
p
,
locked_repo
,
why_package
=
pkg
self
.
io
,
p
,
locked_repo
,
why_package
=
pkg
)
)
else
:
else
:
self
.
display_package_tree
(
self
.
_
io
,
pkg
,
locked_repo
)
self
.
display_package_tree
(
self
.
io
,
pkg
,
locked_repo
)
return
0
return
0
...
@@ -230,7 +228,7 @@ lists all packages available."""
...
@@ -230,7 +228,7 @@ lists all packages available."""
continue
continue
current_length
=
len
(
locked
.
pretty_name
)
current_length
=
len
(
locked
.
pretty_name
)
if
not
self
.
_
io
.
output
.
is_decorated
():
if
not
self
.
io
.
output
.
is_decorated
():
installed_status
=
self
.
get_installed_status
(
locked
,
installed_repo
)
installed_status
=
self
.
get_installed_status
(
locked
,
installed_repo
)
if
installed_status
==
"not-installed"
:
if
installed_status
==
"not-installed"
:
...
@@ -311,7 +309,7 @@ lists all packages available."""
...
@@ -311,7 +309,7 @@ lists all packages available."""
if
installed_status
==
"not-installed"
:
if
installed_status
==
"not-installed"
:
color
=
"red"
color
=
"red"
if
not
self
.
_
io
.
output
.
is_decorated
():
if
not
self
.
io
.
output
.
is_decorated
():
# Non installed in non decorated mode
# Non installed in non decorated mode
install_marker
=
" (!)"
install_marker
=
" (!)"
...
@@ -372,7 +370,7 @@ lists all packages available."""
...
@@ -372,7 +370,7 @@ lists all packages available."""
self
.
line
(
line
)
self
.
line
(
line
)
return
None
return
0
def
display_package_tree
(
def
display_package_tree
(
self
,
self
,
...
...
src/poetry/console/commands/source/add.py
View file @
0ff5a6a0
...
@@ -49,7 +49,7 @@ class SourceAddCommand(Command):
...
@@ -49,7 +49,7 @@ class SourceAddCommand(Command):
source_table
.
add
(
nl
())
source_table
.
add
(
nl
())
return
source_table
return
source_table
def
handle
(
self
)
->
int
|
None
:
def
handle
(
self
)
->
int
:
from
poetry.factory
import
Factory
from
poetry.factory
import
Factory
from
poetry.repositories
import
Pool
from
poetry.repositories
import
Pool
...
...
src/poetry/console/commands/source/remove.py
View file @
0ff5a6a0
...
@@ -36,7 +36,7 @@ class SourceRemoveCommand(Command):
...
@@ -36,7 +36,7 @@ class SourceRemoveCommand(Command):
source_table
.
add
(
nl
())
source_table
.
add
(
nl
())
return
source_table
return
source_table
def
handle
(
self
)
->
int
|
None
:
def
handle
(
self
)
->
int
:
name
=
self
.
argument
(
"name"
)
name
=
self
.
argument
(
"name"
)
sources
=
AoT
([])
sources
=
AoT
([])
...
...
src/poetry/console/commands/source/show.py
View file @
0ff5a6a0
...
@@ -18,7 +18,7 @@ class SourceShowCommand(Command):
...
@@ -18,7 +18,7 @@ class SourceShowCommand(Command):
),
),
]
]
def
handle
(
self
)
->
int
|
None
:
def
handle
(
self
)
->
int
:
sources
=
self
.
poetry
.
get_sources
()
sources
=
self
.
poetry
.
get_sources
()
names
=
self
.
argument
(
"source"
)
names
=
self
.
argument
(
"source"
)
...
...
src/poetry/console/commands/version.py
View file @
0ff5a6a0
...
@@ -57,7 +57,7 @@ patch, minor, major, prepatch, preminor, premajor, prerelease.
...
@@ -57,7 +57,7 @@ patch, minor, major, prepatch, preminor, premajor, prerelease.
"prerelease"
,
"prerelease"
,
}
}
def
handle
(
self
)
->
None
:
def
handle
(
self
)
->
int
:
version
=
self
.
argument
(
"version"
)
version
=
self
.
argument
(
"version"
)
if
version
:
if
version
:
...
@@ -89,6 +89,8 @@ patch, minor, major, prepatch, preminor, premajor, prerelease.
...
@@ -89,6 +89,8 @@ patch, minor, major, prepatch, preminor, premajor, prerelease.
f
" <info>{self.poetry.package.pretty_version}</>"
f
" <info>{self.poetry.package.pretty_version}</>"
)
)
return
0
def
increment_version
(
self
,
version
:
str
,
rule
:
str
)
->
Version
:
def
increment_version
(
self
,
version
:
str
,
rule
:
str
)
->
Version
:
from
poetry.core.semver.version
import
Version
from
poetry.core.semver.version
import
Version
...
...
src/poetry/utils/env.py
View file @
0ff5a6a0
...
@@ -1484,7 +1484,7 @@ class Env:
...
@@ -1484,7 +1484,7 @@ class Env:
return
decode
(
output
)
return
decode
(
output
)
def
execute
(
self
,
bin
:
str
,
*
args
:
str
,
**
kwargs
:
Any
)
->
int
|
None
:
def
execute
(
self
,
bin
:
str
,
*
args
:
str
,
**
kwargs
:
Any
)
->
int
:
command
=
self
.
get_command_from_bin
(
bin
)
+
list
(
args
)
command
=
self
.
get_command_from_bin
(
bin
)
+
list
(
args
)
env
=
kwargs
.
pop
(
"env"
,
dict
(
os
.
environ
))
env
=
kwargs
.
pop
(
"env"
,
dict
(
os
.
environ
))
...
@@ -1753,7 +1753,7 @@ class VirtualEnv(Env):
...
@@ -1753,7 +1753,7 @@ class VirtualEnv(Env):
return
environ
return
environ
def
execute
(
self
,
bin
:
str
,
*
args
:
str
,
**
kwargs
:
Any
)
->
int
|
None
:
def
execute
(
self
,
bin
:
str
,
*
args
:
str
,
**
kwargs
:
Any
)
->
int
:
kwargs
[
"env"
]
=
self
.
get_temp_environ
(
environ
=
kwargs
.
get
(
"env"
))
kwargs
[
"env"
]
=
self
.
get_temp_environ
(
environ
=
kwargs
.
get
(
"env"
))
return
super
()
.
execute
(
bin
,
*
args
,
**
kwargs
)
return
super
()
.
execute
(
bin
,
*
args
,
**
kwargs
)
...
@@ -1836,7 +1836,7 @@ class GenericEnv(VirtualEnv):
...
@@ -1836,7 +1836,7 @@ class GenericEnv(VirtualEnv):
paths
:
dict
[
str
,
str
]
=
json
.
loads
(
output
)
paths
:
dict
[
str
,
str
]
=
json
.
loads
(
output
)
return
paths
return
paths
def
execute
(
self
,
bin
:
str
,
*
args
:
str
,
**
kwargs
:
Any
)
->
int
|
None
:
def
execute
(
self
,
bin
:
str
,
*
args
:
str
,
**
kwargs
:
Any
)
->
int
:
command
=
self
.
get_command_from_bin
(
bin
)
+
list
(
args
)
command
=
self
.
get_command_from_bin
(
bin
)
+
list
(
args
)
env
=
kwargs
.
pop
(
"env"
,
dict
(
os
.
environ
))
env
=
kwargs
.
pop
(
"env"
,
dict
(
os
.
environ
))
...
@@ -1880,12 +1880,12 @@ class NullEnv(SystemEnv):
...
@@ -1880,12 +1880,12 @@ class NullEnv(SystemEnv):
return
super
()
.
_run
(
cmd
,
**
kwargs
)
return
super
()
.
_run
(
cmd
,
**
kwargs
)
return
0
return
0
def
execute
(
self
,
bin
:
str
,
*
args
:
str
,
**
kwargs
:
Any
)
->
int
|
None
:
def
execute
(
self
,
bin
:
str
,
*
args
:
str
,
**
kwargs
:
Any
)
->
int
:
self
.
executed
.
append
([
bin
]
+
list
(
args
))
self
.
executed
.
append
([
bin
]
+
list
(
args
))
if
self
.
_execute
:
if
self
.
_execute
:
return
super
()
.
execute
(
bin
,
*
args
,
**
kwargs
)
return
super
()
.
execute
(
bin
,
*
args
,
**
kwargs
)
return
None
return
0
def
_bin
(
self
,
bin
:
str
)
->
str
:
def
_bin
(
self
,
bin
:
str
)
->
str
:
return
bin
return
bin
...
...
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