Skip to content

Commit

Permalink
Merge branch 'python-poetry:master' into issue/3097
Browse files Browse the repository at this point in the history
  • Loading branch information
mmacchia authored Oct 31, 2021
2 parents 73b6da5 + 5dcf24d commit f4a159e
Show file tree
Hide file tree
Showing 29 changed files with 43 additions and 87 deletions.
17 changes: 11 additions & 6 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
freebsd_instance:
image_family: freebsd-12-2
image_family: freebsd-13-0

test_task:
name: "Tests / FreeBSD / "
only_if: $CIRRUS_TAG == ''
skip: "!changesInclude('.cirrus.yml', 'poetry.lock', 'pyproject.toml', '**.json','**.py')"
env:
PATH: /.local/bin:${PATH}
matrix:
- PYTHON: python3.6
- PYTHON: python3.8
- PYTHON: python3.9
python_script:
- PYPACKAGE=$(printf '%s' $PYTHON | tr -d '.')
- SQLPACKAGE=$(printf '%s-sqlite3' $PYPACKAGE | sed 's/thon//')
- pkg install -y git-lite $PYPACKAGE $SQLPACKAGE
- pkg install -y git-lite curl $PYPACKAGE $SQLPACKAGE
pip_script:
- $PYTHON -m ensurepip
- $PYTHON -m pip --disable-pip-version-check install -U pip tox virtualenv
- $PYTHON -m pip --disable-pip-version-check install -U --pre poetry
- $PYTHON -m pip --disable-pip-version-check install -U pip
poetry_script:
- curl -sL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py \
| $PYTHON - -y
- poetry config virtualenvs.in-project true
tox_script: $PYTHON -m tox -e py -- -q --junitxml=junit.xml tests
test_script: |
poetry install
poetry run pytest -q --junitxml=junit.xml tests
on_failure:
annotate_failure_artifacts:
path: junit.xml
Expand Down
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2

updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "monthly"
# keep dependency updates manual for now
open-pull-requests-limit: 0
reviewers:
- "python-poetry/triage"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ There are some things we can notice here:
* It will try to enforce [semantic versioning](<http://semver.org>) as the best practice in version naming.
* You can specify the readme, included and excluded files: no more `MANIFEST.in`.
`poetry` will also use VCS ignore files (like `.gitignore`) to populate the `exclude` section.
* Keywords (up to 5) can be specified and will act as tags on the packaging site.
* Keywords can be specified and will act as tags on the packaging site.
* The dependencies sections support caret, tilde, wildcard, inequality and multiple requirements.
* You must specify the python versions for which your package is compatible.

Expand Down
2 changes: 1 addition & 1 deletion docs/basic-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pendulum = "^2.1"
As you can see, it takes a mapping of **package names** and **version constraints**.

Poetry uses this information to search for the right set of files in package "repositories" that you register
in the `tool.poetry.repositories` section, or on [PyPI](https://pypi.org) by default.
in the `tool.poetry.source` section, or on [PyPI](https://pypi.org) by default.

Also, instead of modifying the `pyproject.toml` file by hand, you can use the `add` command.

Expand Down
6 changes: 3 additions & 3 deletions docs/managing-environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ to activate one explicitly, see [Switching environments](#switching-between-envi
To easily switch between Python versions, it is recommended to
use [pyenv](https://github.com/pyenv/pyenv) or similar tools.

For instance, if your project is Python 2.7 only, a standard workflow
For instance, if your project is Python 3.6 only, a standard workflow
would be:

```bash
pyenv install 2.7.15
pyenv local 2.7.15 # Activate Python 2.7 for the current project
pyenv install 3.6.15
pyenv local 3.6.15 # Activate Python 3.6 for the current project
poetry install
```
{{% /note %}}
Expand Down
2 changes: 1 addition & 1 deletion docs/pyproject.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ An URL to the documentation of the project. **Optional**

## keywords

A list of keywords (max: 5) that the package is related to. **Optional**
A list of keywords that the package is related to. **Optional**

## classifiers

Expand Down
20 changes: 8 additions & 12 deletions poetry/factory.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from __future__ import absolute_import
from __future__ import unicode_literals

from pathlib import Path
from typing import TYPE_CHECKING
from typing import Dict
Expand All @@ -10,17 +7,16 @@
from cleo.io.io import IO
from cleo.io.null_io import NullIO

from poetry.config.config import Config
from poetry.config.file_config_source import FileConfigSource
from poetry.core.factory import Factory as BaseFactory
from poetry.core.toml.file import TOMLFile

from .config.config import Config
from .config.file_config_source import FileConfigSource
from .locations import CONFIG_DIR
from .packages.locker import Locker
from .packages.project_package import ProjectPackage
from .plugins.plugin_manager import PluginManager
from .poetry import Poetry
from .repositories.pypi_repository import PyPiRepository
from poetry.locations import CONFIG_DIR
from poetry.packages.locker import Locker
from poetry.packages.project_package import ProjectPackage
from poetry.plugins.plugin_manager import PluginManager
from poetry.poetry import Poetry
from poetry.repositories.pypi_repository import PyPiRepository


if TYPE_CHECKING:
Expand Down
2 changes: 0 additions & 2 deletions poetry/masonry/builders/editable.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import unicode_literals

import hashlib
import os
import shutil
Expand Down
6 changes: 1 addition & 5 deletions poetry/repositories/installed_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ def get_package_paths(cls, env: Env, name: str) -> Set[Path]:
if line and not line.startswith(("#", "import ", "import\t")):
path = Path(line)
if not path.is_absolute():
try:
path = lib.joinpath(path).resolve()
except FileNotFoundError:
# this is required to handle pathlib oddity on win32 python==3.5
path = lib.joinpath(path)
path = lib.joinpath(path).resolve()
paths.add(path)

src_path = env.path / "src" / name
Expand Down
2 changes: 0 additions & 2 deletions sonnet
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,6 @@ class MakeReleaseCommand(Command):
subprocess.check_output(
[python, "-V"], stderr=subprocess.STDOUT, shell=WINDOWS
)
if version == "3.4" and WINDOWS:
continue

subprocess.check_output([python, "-m", "pip", "install", "pip", "-U"])
except subprocess.CalledProcessError:
Expand Down
3 changes: 0 additions & 3 deletions tests/console/commands/test_export.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import pytest

from tests.helpers import get_package
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from distutils.core import setup

packages = ["project_with_extras"]
Expand Down
1 change: 0 additions & 1 deletion tests/fixtures/git/github.com/demo/demo/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from setuptools import setup


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from setuptools import setup


Expand Down
1 change: 0 additions & 1 deletion tests/fixtures/git/github.com/demo/no-version/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import ast
import os

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from setuptools import setup


Expand Down
2 changes: 0 additions & 2 deletions tests/fixtures/project_with_setup/setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

from setuptools import setup


Expand Down
3 changes: 0 additions & 3 deletions tests/installation/test_executor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import json
import re
import shutil
Expand Down
9 changes: 1 addition & 8 deletions tests/installation/test_installer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
from __future__ import unicode_literals

import itertools
import json
import sys

from pathlib import Path

Expand Down Expand Up @@ -1751,11 +1748,7 @@ def test_installer_test_solver_finds_compatible_package_for_dependency_python_no

expected = fixture("with-conditional-dependency")
assert locker.written_data == expected

if sys.version_info >= (3, 5, 0):
assert 1 == installer.executor.installations_count
else:
assert 0 == installer.executor.installations_count
assert 1 == installer.executor.installations_count


def test_installer_required_extras_should_not_be_removed_when_updating_single_dependency(
Expand Down
9 changes: 1 addition & 8 deletions tests/installation/test_installer_old.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
from __future__ import unicode_literals

import itertools
import sys

from pathlib import Path

Expand Down Expand Up @@ -1447,11 +1444,7 @@ def test_installer_test_solver_finds_compatible_package_for_dependency_python_no
assert locker.written_data == expected

installs = installer.installer.installs

if sys.version_info >= (3, 5, 0):
assert len(installs) == 1
else:
assert len(installs) == 0
assert len(installs) == 1


def test_installer_required_extras_should_not_be_removed_when_updating_single_dependency(
Expand Down
3 changes: 0 additions & 3 deletions tests/masonry/builders/test_editable_builder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import os
import shutil

Expand Down
4 changes: 0 additions & 4 deletions tests/test_factory.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals

from pathlib import Path

import pytest
Expand Down
2 changes: 0 additions & 2 deletions tests/utils/fixtures/setups/ansible/setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import json
import os
import os.path
Expand Down
1 change: 0 additions & 1 deletion tests/utils/fixtures/setups/flask/setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import re
from collections import OrderedDict
Expand Down
1 change: 0 additions & 1 deletion tests/utils/fixtures/setups/pendulum/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from distutils.core import setup

from build import *
Expand Down
7 changes: 2 additions & 5 deletions tests/utils/fixtures/setups/pyyaml/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,7 @@ def run(self):
build_cmd = self.get_finalized_command("build")
build_cmd.run()
sys.path.insert(0, build_cmd.build_lib)
if sys.version_info[0] < 3:
sys.path.insert(0, "tests/lib")
else:
sys.path.insert(0, "tests/lib3")
sys.path.insert(0, "tests/lib3")
import test_all

if not test_all.main([]):
Expand All @@ -337,7 +334,7 @@ def run(self):
url=URL,
download_url=DOWNLOAD_URL,
classifiers=CLASSIFIERS,
package_dir={"": {2: "lib", 3: "lib3"}[sys.version_info[0]]},
package_dir={"": "lib3"},
packages=["yaml"],
ext_modules=[
Extension(
Expand Down
2 changes: 0 additions & 2 deletions tests/utils/fixtures/setups/sqlalchemy/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from setuptools.command.test import test as TestCommand

cmdclass = {}
if sys.version_info < (2, 7):
raise Exception("SQLAlchemy requires Python 2.7 or higher.")

cpython = platform.python_implementation() == "CPython"

Expand Down
7 changes: 1 addition & 6 deletions tests/utils/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,12 +963,7 @@ def test_env_system_packages(tmp_path, config):

EnvManager(config).build_venv(path=venv_path, flags={"system-site-packages": True})

if sys.version_info >= (3, 3):
assert "include-system-site-packages = true" in pyvenv_cfg.read_text()
elif (2, 6) < sys.version_info < (3, 0):
assert not venv_path.joinpath(
"lib", "python2.7", "no-global-site-packages.txt"
).exists()
assert "include-system-site-packages = true" in pyvenv_cfg.read_text()


def test_env_finds_the_correct_executables(tmp_dir, manager):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
minversion = 3.3.0
isolated_build = True
envlist = py36, py37, py38, py39, doc
envlist = py36, py37, py38, py39

[testenv]
whitelist_externals = poetry
Expand Down

0 comments on commit f4a159e

Please sign in to comment.