Commit 845ae55c by Sébastien Eustace

Merge branch 'master' into develop

parents 3fa47e02 66790b4d
---
name: Bug report
about: Report errors and problems
name: "\U0001F41E Bug Report"
about: Did you find a bug?
title: ''
labels: 'Bug'
assignees: ''
---
......
---
name: Documentation issue
about: Report errors and problems with the documentation (https://poetry.eustace.io/docs/)
name: "\U0001F4DA Documentation"
about: Did you find errors, problems, or anything unintelligible in the docs (https://poetry.eustace.io/docs)?
title: ''
labels: 'Documentation'
assignees: ''
---
......
---
name: "\U0001F5C3 Everything Else"
about: For questions and issues that do not fall in any of the other categories. This
can include questions about Poetry's roadmap. For support questions, please post
on StackOverflow.
title: ''
labels: ''
assignees: ''
---
<!-- Describe your question and issue here. This space is meant to be used for general questions that are neither bugs, feature requests, nor documentation issues. A good example would be a question regarding Poetry's roadmap, for example. If you're looking for help when it comes to using Poetry, consider posting a question on StackOverflow instead: http://stackoverflow.com/questions/tagged/python-poetry -->
<!-- Checked checkbox should look like this: [x] -->
- [ ] I have searched the [issues](https://github.com/sdispater/poetry/issues) of this repo and believe that this is not a duplicate.
- [ ] I have searched the [documentation](https://poetry.eustace.io/docs/) and believe that my question is not covered.
## Issue
<!-- Now feel free to write your issue, but please be descriptive! Thanks again 🙌 ❤️ -->
\ No newline at end of file
---
name: Feature request
about: Ideas for new features and improvements
name: "\U0001F381 Feature Request"
about: Do you have ideas for new features and improvements?
title: ''
labels: 'Feature'
assignees: ''
---
......
---
name: Support question
about: Questions about Poetry that are not covered in the documentation (https://poetry.eustace.io/docs/)
---
<!--
Hi there! Thank you for wanting to make Poetry better.
Before you submit this; let's make sure of a few things.
Please make sure the following boxes are ticked if they are correct.
If not, please try and fulfill these first.
-->
<!-- Checked checkbox should look like this: [x] -->
- [ ] I have searched the [issues](https://github.com/sdispater/poetry/issues) of this repo and believe that this is not a duplicate.
- [ ] I have searched the [documentation](https://poetry.eustace.io/docs/) and believe that my question is not covered.
## Question
<!-- Now feel free to write your question. Thanks again 🙌 ❤️ -->
......@@ -144,7 +144,7 @@ pathlib2 = { version = "^2.2", python = "~2.7" }
```toml
[tool.poetry.dependencies]
pathlib2 = { version = "^2.2", python = ["~2.7", "^3.2"] }
pathlib2 = { version = "^2.2", python = "~2.7 || ^3.2" }
```
### Using environment markers
......
......@@ -5,7 +5,7 @@ class AboutCommand(Command):
name = "about"
description = "Short information about Poetry."
description = "Shows information about Poetry."
def handle(self):
self.line(
......
......@@ -8,11 +8,11 @@ from .env_command import EnvCommand
class AddCommand(EnvCommand, InitCommand):
name = "add"
description = "Add a new dependency to <comment>pyproject.toml</>."
description = "Adds a new dependency to <comment>pyproject.toml</>."
arguments = [argument("name", "Packages to add.", multiple=True)]
arguments = [argument("name", "The packages to add.", multiple=True)]
options = [
option("dev", "D", "Add package as development dependency."),
option("dev", "D", "Add as a development dependency."),
option(
"extras",
"E",
......@@ -24,20 +24,20 @@ class AddCommand(EnvCommand, InitCommand):
option(
"python",
None,
"Python version for which the dependencies must be installed.",
"Python version for which the dependency must be installed.",
flag=False,
),
option(
"platform",
None,
"Platforms for which the dependencies must be installed.",
"Platforms for which the dependency must be installed.",
flag=False,
),
option("allow-prereleases", None, "Accept prereleases."),
option(
"dry-run",
None,
"Outputs the operations but will not execute anything (implicitly enables --verbose).",
"Output the operations but do not execute anything (implicitly enables --verbose).",
),
]
......
......@@ -9,7 +9,7 @@ class BuildCommand(EnvCommand):
description = "Builds a package, as a tarball and a wheel by default."
options = [
option("format", "f", "Limit the format to either wheel or sdist.", flag=False)
option("format", "f", "Limit the format to either sdist or wheel.", flag=False)
]
def handle(self):
......
......@@ -12,7 +12,7 @@ class CacheClearCommand(Command):
description = "Clears Poetry's cache."
arguments = [argument("cache", description="The name of the cache to clear.")]
options = [option("all", description="Clear all entries in cache.")]
options = [option("all", description="Clear all entries in the cache.")]
def handle(self):
from cachy import CacheManager
......
......@@ -15,7 +15,7 @@ from .command import Command
class ConfigCommand(Command):
name = "config"
description = "Sets/Gets config options."
description = "Manages configuration settings."
arguments = [
argument("key", "Setting key.", optional=True),
......
......@@ -14,7 +14,7 @@ class DebugResolveCommand(Command):
description = "Debugs dependency resolution."
arguments = [
argument("package", "Packages to resolve.", optional=True, multiple=True)
argument("package", "The packages to resolve.", optional=True, multiple=True)
]
options = [
option(
......@@ -25,7 +25,7 @@ class DebugResolveCommand(Command):
multiple=True,
),
option("python", None, "Python version(s) to use for resolution.", flag=False),
option("tree", None, "Displays the dependency tree."),
option("tree", None, "Display the dependency tree."),
option("install", None, "Show what would be installed for the current system."),
]
......
......@@ -6,7 +6,7 @@ from ..command import Command
class EnvInfoCommand(Command):
name = "info"
description = "Display information about the current environment."
description = "Displays information about the current environment."
options = [option("path", "p", "Only display the environment's path.")]
......
......@@ -6,7 +6,7 @@ from ..command import Command
class EnvListCommand(Command):
name = "list"
description = "List all virtualenvs associated with the current project."
description = "Lists all virtualenvs associated with the current project."
options = [option("full-path", None, "Output the full paths of the virtualenvs.")]
......
......@@ -6,7 +6,7 @@ from ..command import Command
class EnvRemoveCommand(Command):
name = "remove"
description = "Remove a specific virtualenv associated with the project."
description = "Removes a specific virtualenv associated with the project."
arguments = [
argument("python", "The python executable to remove the virtualenv for.")
......
......@@ -6,7 +6,7 @@ from ..command import Command
class EnvUseCommand(Command):
name = "use"
description = "Activate or create a new virtualenv for the current project."
description = "Activates or creates a new virtualenv for the current project."
arguments = [argument("python", "The python executable to use.")]
......
......@@ -35,7 +35,7 @@ class InitCommand(Command):
option(
"dependency",
None,
"Package to require with an optional version constraint, "
"Package to require, with an optional version constraint, "
"e.g. requests:^2.10.0 or requests=2.11.1.",
flag=False,
multiple=True,
......@@ -43,7 +43,7 @@ class InitCommand(Command):
option(
"dev-dependency",
None,
"Package to require for development with an optional version constraint, "
"Package to require for development, with an optional version constraint, "
"e.g. requests:^2.10.0 or requests=2.11.1.",
flag=False,
multiple=True,
......
......@@ -9,14 +9,14 @@ class InstallCommand(EnvCommand):
description = "Installs the project dependencies."
options = [
option("no-dev", None, "Do not install dev dependencies."),
option("no-dev", None, "Do not install the development dependencies."),
option(
"no-root", None, "Do not install the root package (the current project)."
),
option(
"dry-run",
None,
"Outputs the operations but will not execute anything "
"Output the operations but do not execute anything "
"(implicitly enables --verbose).",
),
option(
......
......@@ -7,7 +7,7 @@ from .command import Command
class NewCommand(Command):
name = "new"
description = "Creates a new Python project at <path>"
description = "Creates a new Python project at <path>."
arguments = [argument("path", "The path to create the project at.")]
options = [
......
......@@ -9,13 +9,13 @@ class RemoveCommand(EnvCommand):
name = "remove"
description = "Removes a package from the project dependencies."
arguments = [argument("packages", "Packages that should be removed", multiple=True)]
arguments = [argument("packages", "The packages to remove.", multiple=True)]
options = [
option("dev", "D", "Removes a package from the development dependencies."),
option("dev", "D", "Remove a package from the development dependencies."),
option(
"dry-run",
None,
"Outputs the operations but will not execute anything "
"Output the operations but do not execute anything "
"(implicitly enables --verbose).",
),
]
......
......@@ -10,7 +10,7 @@ class SearchCommand(Command):
description = "Searches for packages on remote repositories."
arguments = [argument("tokens", "The tokens to search for.", multiple=True)]
options = [option("only-name", "N", "Search only in name.")]
options = [option("only-name", "N", "Search only by name.")]
def handle(self):
from poetry.repositories.pypi_repository import PyPiRepository
......
......@@ -24,7 +24,7 @@ from ..command import Command
class SelfUpdateCommand(Command):
name = "update"
description = "Updates poetry to the latest version."
description = "Updates Poetry to the latest version."
arguments = [argument("version", "The version to update to.", optional=True)]
options = [option("preview", None, "Install prereleases.")]
......
......@@ -10,9 +10,9 @@ class ShowCommand(EnvCommand):
name = "show"
description = "Shows information about packages."
arguments = [argument("package", "Package to inspect", optional=True)]
arguments = [argument("package", "The package to inspect", optional=True)]
options = [
option("no-dev", None, "Do not list the dev dependencies."),
option("no-dev", None, "Do not list the development dependencies."),
option("tree", "t", "List the dependencies as a tree."),
option("latest", "l", "Show the latest version."),
option(
......
......@@ -8,14 +8,14 @@ class UpdateCommand(EnvCommand):
name = "update"
description = (
"Update dependencies as according to the <comment>pyproject.toml</> file."
"Update the dependencies as according to the <comment>pyproject.toml</> file."
)
arguments = [
argument("packages", "The packages to update", optional=True, multiple=True)
]
options = [
option("no-dev", None, "Do not update dev dependencies."),
option("no-dev", None, "Do not update the development dependencies."),
option(
"dry-run",
None,
......
......@@ -135,10 +135,15 @@ class PipInstaller(BaseInstaller):
return req
if package.source_type == "git":
return "git+{}@{}#egg={}".format(
req = "git+{}@{}#egg={}".format(
package.source_url, package.source_reference, package.name
)
if package.develop:
req = ["-e", req]
return req
if package.source_type == "url":
return "{}#egg={}".format(package.source_url, package.name)
......@@ -225,6 +230,6 @@ class PipInstaller(BaseInstaller):
pkg = Package(package.name, package.version)
pkg.source_type = "directory"
pkg.source_url = str(src_dir)
pkg.develop = True
pkg.develop = package.develop
self.install_directory(pkg)
......@@ -403,15 +403,6 @@ class Provider:
os.chdir(current_dir)
package = Package(package_name, package_version)
if name and name != package.name:
# For now, the dependency's name must match the actual package's name
raise RuntimeError(
"The dependency name for {} does not match the actual package's name: {}".format(
name, package_name
)
)
package.description = package_summary
for req in reqs:
......@@ -429,6 +420,14 @@ class Provider:
if python_requires:
package.python_versions = python_requires
if name and name != package.name:
# For now, the dependency's name must match the actual package's name
raise RuntimeError(
"The dependency name for {} does not match the actual package's name: {}".format(
name, package.name
)
)
package.source_type = "directory"
package.source_url = directory.as_posix()
......
......@@ -234,9 +234,17 @@ class PyPiRepository(Repository):
hits = client.search(search, "or")
for hit in hits:
result = Package(hit["name"], hit["version"], hit["version"])
result.description = to_str(hit["summary"])
results.append(result)
try:
result = Package(hit["name"], hit["version"], hit["version"])
result.description = to_str(hit["summary"])
results.append(result)
except ParseVersionError:
self._log(
'Unable to parse version "{}" for the {} package, skipping'.format(
hit["version"], hit["name"]
),
level="debug",
)
return results
......
import pytest
from poetry.installation.pip_installer import PipInstaller
from poetry.io.null_io import NullIO
from poetry.packages.package import Package
......@@ -6,9 +8,26 @@ from poetry.repositories.pool import Pool
from poetry.utils.env import NullEnv
def test_requirement():
installer = PipInstaller(NullEnv(), NullIO(), Pool())
@pytest.fixture
def package_git():
package = Package("demo", "1.0.0")
package.source_type = "git"
package.source_url = "git@github.com:demo/demo.git"
package.source_reference = "master"
return package
@pytest.fixture
def pool():
return Pool()
@pytest.fixture
def installer(pool):
return PipInstaller(NullEnv(), NullIO(), pool)
def test_requirement(installer):
package = Package("ipython", "7.5.0")
package.hashes = [
"md5:dbdc53e3918f28fa335a173432402a00",
......@@ -39,17 +58,21 @@ def test_requirement_source_type_url():
assert expected == result
def test_install_with_non_pypi_default_repository():
pool = Pool()
def test_requirement_git_develop_false(installer, package_git):
package_git.develop = False
result = installer.requirement(package_git)
expected = "git+git@github.com:demo/demo.git@master#egg=demo"
assert expected == result
def test_install_with_non_pypi_default_repository(pool, installer):
default = LegacyRepository("default", "https://default.com")
another = LegacyRepository("another", "https://another.com")
pool.add_repository(default, default=True)
pool.add_repository(another)
installer = PipInstaller(NullEnv(), NullIO(), pool)
foo = Package("foo", "0.0.0")
foo.source_type = "legacy"
foo.source_reference = default._name
......@@ -61,3 +84,11 @@ def test_install_with_non_pypi_default_repository():
installer.install(foo)
installer.install(bar)
def test_requirement_git_develop_true(installer, package_git):
package_git.develop = True
result = installer.requirement(package_git)
expected = ["-e", "git+git@github.com:demo/demo.git@master#egg=demo"]
assert expected == result
......@@ -253,7 +253,8 @@ def test_search_for_directory_setup_read_setup_with_no_dependencies(provider, mo
def test_search_for_directory_poetry(provider):
dependency = DirectoryDependency(
"demo", Path(__file__).parent.parent / "fixtures" / "project_with_extras"
"project-with-extras",
Path(__file__).parent.parent / "fixtures" / "project_with_extras",
)
package = provider.search_for_directory(dependency)[0]
......@@ -269,7 +270,8 @@ def test_search_for_directory_poetry(provider):
def test_search_for_directory_poetry_with_extras(provider):
dependency = DirectoryDependency(
"demo", Path(__file__).parent.parent / "fixtures" / "project_with_extras"
"project-with-extras",
Path(__file__).parent.parent / "fixtures" / "project_with_extras",
)
dependency.extras.append("extras_a")
......
{
"info":{
"author":"eric dexter",
"author_email":"irc.dexter@gmail.com",
"bugtrack_url":null,
"classifiers":[
"Topic :: Multimedia :: Sound/Audio :: Editors"
],
"description":"a clickable grid for drum machines, piano rolls that is customizble from an init \r\nfile)or will be) that will include the script to be ran when a definable button is \r\nhit written in pygame and tested with python 2.5",
"description_content_type":null,
"docs_url":null,
"download_url":"http://www.ziddu.com/download/5498230/pygamepianorollbeta.90.zip.html",
"downloads":{
"last_day":-1,
"last_month":-1,
"last_week":-1
},
"home_page":"http://dexrowem.blogspot.com/search?q=pygame+music+grid",
"keywords":"python, pygame, drum machine, piano roll",
"license":"",
"maintainer":"",
"maintainer_email":"",
"name":"pygame-music-grid",
"package_url":"https://pypi.org/project/pygame-music-grid/",
"platform":"",
"project_url":"https://pypi.org/project/pygame-music-grid/",
"project_urls":{
"Download":"http://www.ziddu.com/download/5498230/pygamepianorollbeta.90.zip.html",
"Homepage":"http://dexrowem.blogspot.com/search?q=pygame+music+grid"
},
"release_url":"https://pypi.org/project/pygame-music-grid/.9/",
"requires_dist":null,
"requires_python":null,
"summary":"a grid for music programs",
"version":".9"
},
"last_serial":710340,
"releases":{
".9":[
{
"comment_text": "",
"digests": {
"md5": "76e2c2e8adea20377d9a7e6b6713c952",
"sha256": "8d6d96001aa7f0a6a4a95e8143225b5d06e41b1131044913fecb8f85a125714b"
},
"downloads": -1,
"filename": "PyYAML-4.2b4-cp27-cp27m-win32.whl",
"has_sig": false,
"md5_digest": "76e2c2e8adea20377d9a7e6b6713c952",
"packagetype": "bdist_wheel",
"python_version": "cp27",
"requires_python": null,
"size": 104988,
"upload_time": "2018-07-02T03:17:55",
"url": "https://files.pythonhosted.org/packages/12/9b/efdbaa3c9694b6315a4410e0d494ad50c5ade22ce33f4b482bfaea3930fd/PyYAML-4.2b4-cp27-cp27m-win32.whl"
}
],
"1.0":[
{
"comment_text": "",
"digests": {
"md5": "a83441aa7004e474bed6f6daeb61f27a",
"sha256": "d5eef459e30b09f5a098b9cea68bebfeb268697f78d647bd255a085371ac7f3f"
},
"downloads": -1,
"filename": "PyYAML-3.13-cp27-cp27m-win32.whl",
"has_sig": false,
"md5_digest": "a83441aa7004e474bed6f6daeb61f27a",
"packagetype": "bdist_wheel",
"python_version": "cp27",
"requires_python": null,
"size": 191712,
"upload_time": "2018-07-05T22:53:15",
"url": "https://files.pythonhosted.org/packages/b8/2e/9c2285870c9de070a1fa5ede702ab5fb329901b3cc4028c24f44eda27c5f/PyYAML-3.13-cp27-cp27m-win32.whl"
}
]
},
"urls":[
]
}
......@@ -176,3 +176,12 @@ def test_pypi_repository_supports_reading_bz2_files():
assert expected_extras[name] == sorted(
package.extras[name], key=lambda r: r.name
)
def test_invalid_versions_ignored():
repo = MockRepository()
# the json metadata for this package contains one malformed version
# and a correct one.
packages = repo.find_packages("pygame-music-grid")
assert len(packages) == 1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment