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
30c7b8ac
Unverified
Commit
30c7b8ac
authored
Oct 30, 2019
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate allows-prereleases in favor of allow-prereleases for consistency
parent
54bc8dfe
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
44 additions
and
7 deletions
+44
-7
poetry/console/commands/add.py
+1
-1
poetry/console/config/application_config.py
+4
-3
poetry/console/logging/io_handler.py
+1
-1
poetry/factory.py
+11
-0
poetry/json/schemas/poetry-schema.json
+8
-0
poetry/packages/package.py
+16
-1
tests/console/commands/test_check.py
+1
-0
tests/fixtures/invalid_pyproject/pyproject.toml
+1
-0
tests/puzzle/test_solver.py
+1
-1
No files found.
poetry/console/commands/add.py
View file @
30c7b8ac
...
@@ -105,7 +105,7 @@ If you do not specify a version constraint, poetry will choose a suitable one ba
...
@@ -105,7 +105,7 @@ If you do not specify a version constraint, poetry will choose a suitable one ba
constraint
[
"optional"
]
=
True
constraint
[
"optional"
]
=
True
if
self
.
option
(
"allow-prereleases"
):
if
self
.
option
(
"allow-prereleases"
):
constraint
[
"allow
s
-prereleases"
]
=
True
constraint
[
"allow-prereleases"
]
=
True
if
self
.
option
(
"extras"
):
if
self
.
option
(
"extras"
):
extras
=
[]
extras
=
[]
...
...
poetry/console/config/application_config.py
View file @
30c7b8ac
...
@@ -46,13 +46,14 @@ class ApplicationConfig(BaseApplicationConfig):
...
@@ -46,13 +46,14 @@ class ApplicationConfig(BaseApplicationConfig):
io
=
event
.
io
io
=
event
.
io
if
not
command
.
loggers
:
loggers
=
[
"poetry.packages.package"
]
return
loggers
+=
command
.
loggers
handler
=
IOHandler
(
io
)
handler
=
IOHandler
(
io
)
handler
.
setFormatter
(
IOFormatter
())
handler
.
setFormatter
(
IOFormatter
())
for
logger
in
command
.
loggers
:
for
logger
in
loggers
:
logger
=
logging
.
getLogger
(
logger
)
logger
=
logging
.
getLogger
(
logger
)
logger
.
handlers
=
[
handler
]
logger
.
handlers
=
[
handler
]
...
...
poetry/console/logging/io_handler.py
View file @
30c7b8ac
...
@@ -19,7 +19,7 @@ class IOHandler(logging.Handler):
...
@@ -19,7 +19,7 @@ class IOHandler(logging.Handler):
level
=
record
.
levelname
.
lower
()
level
=
record
.
levelname
.
lower
()
err
=
level
in
(
"warning"
,
"error"
,
"exception"
,
"critical"
)
err
=
level
in
(
"warning"
,
"error"
,
"exception"
,
"critical"
)
if
err
:
if
err
:
self
.
_io
.
error
(
msg
,
newline
=
True
)
self
.
_io
.
error
_line
(
msg
)
else
:
else
:
self
.
_io
.
write_line
(
msg
)
self
.
_io
.
write_line
(
msg
)
except
Exception
:
except
Exception
:
...
...
poetry/factory.py
View file @
30c7b8ac
...
@@ -290,6 +290,17 @@ class Factory:
...
@@ -290,6 +290,17 @@ class Factory:
"Consider specifying a more explicit one."
"Consider specifying a more explicit one."
)
)
for
name
,
constraint
in
config
[
"dependencies"
]
.
items
():
if
not
isinstance
(
constraint
,
dict
):
continue
if
"allows-prereleases"
in
constraint
:
result
[
"warnings"
]
.
append
(
'The "{}" dependency specifies '
'the "allows-prereleases" property, which is deprecated. '
'Use "allow-preleases" instead.'
.
format
(
name
)
)
# Checking for scripts with extras
# Checking for scripts with extras
if
"scripts"
in
config
:
if
"scripts"
in
config
:
scripts
=
config
[
"scripts"
]
scripts
=
config
[
"scripts"
]
...
...
poetry/json/schemas/poetry-schema.json
View file @
30c7b8ac
...
@@ -247,6 +247,10 @@
...
@@ -247,6 +247,10 @@
"type"
:
"string"
,
"type"
:
"string"
,
"description"
:
"The PEP 508 compliant environment markers for which the dependency should be installed."
"description"
:
"The PEP 508 compliant environment markers for which the dependency should be installed."
},
},
"allow-prereleases"
:
{
"type"
:
"boolean"
,
"description"
:
"Whether the dependency allows prereleases or not."
},
"allows-prereleases"
:
{
"allows-prereleases"
:
{
"type"
:
"boolean"
,
"type"
:
"boolean"
,
"description"
:
"Whether the dependency allows prereleases or not."
"description"
:
"Whether the dependency allows prereleases or not."
...
@@ -304,6 +308,10 @@
...
@@ -304,6 +308,10 @@
"type"
:
"string"
,
"type"
:
"string"
,
"description"
:
"The PEP 508 compliant environment markers for which the dependency should be installed."
"description"
:
"The PEP 508 compliant environment markers for which the dependency should be installed."
},
},
"allow-prereleases"
:
{
"type"
:
"boolean"
,
"description"
:
"Whether the dependency allows prereleases or not."
},
"allows-prereleases"
:
{
"allows-prereleases"
:
{
"type"
:
"boolean"
,
"type"
:
"boolean"
,
"description"
:
"Whether the dependency allows prereleases or not."
"description"
:
"Whether the dependency allows prereleases or not."
...
...
poetry/packages/package.py
View file @
30c7b8ac
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
copy
import
copy
import
logging
import
re
import
re
from
contextlib
import
contextmanager
from
contextlib
import
contextmanager
from
typing
import
Union
from
typing
import
Union
from
warnings
import
warn
from
poetry.semver
import
Version
from
poetry.semver
import
Version
from
poetry.semver
import
parse_constraint
from
poetry.semver
import
parse_constraint
...
@@ -24,6 +26,8 @@ from .utils.utils import create_nested_marker
...
@@ -24,6 +26,8 @@ from .utils.utils import create_nested_marker
AUTHOR_REGEX
=
re
.
compile
(
r"(?u)^(?P<name>[- .,\w\d'’\"()]+)(?: <(?P<email>.+?)>)?$"
)
AUTHOR_REGEX
=
re
.
compile
(
r"(?u)^(?P<name>[- .,\w\d'’\"()]+)(?: <(?P<email>.+?)>)?$"
)
logger
=
logging
.
getLogger
(
__name__
)
class
Package
(
object
):
class
Package
(
object
):
...
@@ -270,7 +274,18 @@ class Package(object):
...
@@ -270,7 +274,18 @@ class Package(object):
python_versions
=
constraint
.
get
(
"python"
)
python_versions
=
constraint
.
get
(
"python"
)
platform
=
constraint
.
get
(
"platform"
)
platform
=
constraint
.
get
(
"platform"
)
markers
=
constraint
.
get
(
"markers"
)
markers
=
constraint
.
get
(
"markers"
)
allows_prereleases
=
constraint
.
get
(
"allows-prereleases"
,
False
)
if
"allows-prereleases"
in
constraint
:
message
=
(
'The "{}" dependency specifies '
'the "allows-prereleases" property, which is deprecated. '
'Use "allow-preleases" instead.'
.
format
(
name
)
)
warn
(
message
,
DeprecationWarning
)
logger
.
warning
(
message
)
allows_prereleases
=
constraint
.
get
(
"allow-prereleases"
,
constraint
.
get
(
"allows-prereleases"
,
False
)
)
if
"git"
in
constraint
:
if
"git"
in
constraint
:
# VCS dependency
# VCS dependency
...
...
tests/console/commands/test_check.py
View file @
30c7b8ac
...
@@ -42,6 +42,7 @@ Warning: A wildcard Python dependency is ambiguous. Consider specifying a more e
...
@@ -42,6 +42,7 @@ Warning: A wildcard Python dependency is ambiguous. Consider specifying a more e
Error: 'description' is a required property
Error: 'description' is a required property
Error: INVALID is not a valid license
Error: INVALID is not a valid license
Warning: A wildcard Python dependency is ambiguous. Consider specifying a more explicit one.
Warning: A wildcard Python dependency is ambiguous. Consider specifying a more explicit one.
Warning: The "pendulum" dependency specifies the "allows-prereleases" property, which is deprecated. Use "allow-preleases" instead.
"""
"""
assert
expected
==
tester
.
io
.
fetch_output
()
assert
expected
==
tester
.
io
.
fetch_output
()
tests/fixtures/invalid_pyproject/pyproject.toml
View file @
30c7b8ac
...
@@ -8,3 +8,4 @@ license = "INVALID"
...
@@ -8,3 +8,4 @@ license = "INVALID"
[tool.poetry.dependencies]
[tool.poetry.dependencies]
python
=
"*"
python
=
"*"
pendulum
=
{
"version"
=
"^2.0.5"
,
allows-prereleases
=
true
}
tests/puzzle/test_solver.py
View file @
30c7b8ac
...
@@ -430,7 +430,7 @@ def test_solver_returns_extras_if_requested(solver, repo, package):
...
@@ -430,7 +430,7 @@ def test_solver_returns_extras_if_requested(solver, repo, package):
def
test_solver_returns_prereleases_if_requested
(
solver
,
repo
,
package
):
def
test_solver_returns_prereleases_if_requested
(
solver
,
repo
,
package
):
package
.
add_dependency
(
"A"
)
package
.
add_dependency
(
"A"
)
package
.
add_dependency
(
"B"
)
package
.
add_dependency
(
"B"
)
package
.
add_dependency
(
"C"
,
{
"version"
:
"*"
,
"allow
s
-prereleases"
:
True
})
package
.
add_dependency
(
"C"
,
{
"version"
:
"*"
,
"allow-prereleases"
:
True
})
package_a
=
get_package
(
"A"
,
"1.0"
)
package_a
=
get_package
(
"A"
,
"1.0"
)
package_b
=
get_package
(
"B"
,
"1.0"
)
package_b
=
get_package
(
"B"
,
"1.0"
)
...
...
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