Loading README.md +19 −19 Changes for README.md: 19 added lines, 19 removed lines. Original line number Diff line number Diff line Loading @@ -78,22 +78,22 @@ keywords = ['packaging', 'poetry'] [tool.poetry.dependencies] python = "~2.7 || ^3.2" # Compatible python versions must be declared here toml = "^0.9" requests = "^2.13" semantic_version = "^2.6" pygments = "^2.2" twine = "^1.8" wheel = "^0.29" pip-tools = "^1.8.2" # Dependencies with extras requests = { version = "^2.13", extras = [ "security" ] } # Python specific dependencies with prereleases allowed pathlib2 = { version = "^2.2", python = "~2.7", allows_prereleases = true } # Git dependencies cleo = { git = "https://github.com/sdispater/cleo.git", branch = "master" } # Optional dependencies (extras) pendulum = { version = "^1.4", optional = true} [tool.poetry.dev-dependencies] pytest = "^3.0" pytest-cov = "^2.4" coverage = "<4.0" httpretty = "^0.8.14" [tool.poetry.scripts] poet = 'poet:app.run' my-script = 'my_package:main' ``` There are some things we can notice here: Loading Loading @@ -632,21 +632,17 @@ poetry = 'poetry:console.run' Here, we will have the `poetry` script installed which will execute `console.run` in the `poetry` package. ### `features` ### `extras` Poetry supports features to allow expression of: Poetry supports extras to allow expression of: * optional dependencies, which enhance a package, but are not required; and * clusters of optional dependencies. ```toml [package] [tool.poetry] name = "awesome" [features] mysql = ["mysqlclient"] pgsql = ["psycopg2"] [dependencies] # These packages are mandatory and form the core of this package’s distribution. mandatory = "^1.0" Loading @@ -655,13 +651,17 @@ mandatory = "^1.0" # above `features`. They can be opted into by apps. psycopg2 = { version = "^2.7", optional = true } mysqlclient = { version = "^1.3", optional = true } [tool.poetry.extras] mysql = ["mysqlclient"] pgsql = ["psycopg2"] ``` When installing packages, you can specify features by using the `-f|--features` option: When installing packages, you can specify features by using the `-E|--extras` option: ```bash poet install --features "mysql pgsql" poet install -f mysql -f pgsql poet install --extras "mysql pgsql" poet install -E mysql -E pgsql ``` ### `plugins` Loading poetry/installation/installer.py +5 −5 Changes for poetry/installation/installer.py: 5 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -230,7 +230,7 @@ class Installer: if operation.skipped: if self._io.is_verbose() and (self._execute_operations or self.is_dry_run()): self._io.writeln( f' - Skipping <info>{operation.package.name}</> ' f' - Skipping <info>{operation.package.pretty_name}</> ' f'(<comment>{operation.package.full_pretty_version}</>) ' f'{operation.skip_reason}') Loading @@ -238,7 +238,7 @@ class Installer: if self._execute_operations or self.is_dry_run(): self._io.writeln( f' - Installing <info>{operation.package.name}</> ' f' - Installing <info>{operation.package.pretty_name}</> ' f'(<comment>{operation.package.full_pretty_version}</>)' ) Loading @@ -254,7 +254,7 @@ class Installer: if operation.skipped: if self._io.is_verbose() and (self._execute_operations or self.is_dry_run()): self._io.writeln( f' - Skipping <info>{target.name}</> ' f' - Skipping <info>{target.pretty_name}</> ' f'(<comment>{target.full_pretty_version}</>) ' f'{operation.skip_reason}') Loading @@ -262,7 +262,7 @@ class Installer: if self._execute_operations or self.is_dry_run(): self._io.writeln( f' - Updating <info>{target.name}</> ' f' - Updating <info>{target.pretty_name}</> ' f'(<comment>{source.pretty_version}</>' f' -> <comment>{target.pretty_version}</>)' ) Loading @@ -275,7 +275,7 @@ class Installer: def _execute_uninstall(self, operation: Uninstall) -> None: if self._execute_operations or self.is_dry_run(): self._io.writeln( f' - Removing <info>{operation.package.name}</> ' f' - Removing <info>{operation.package.pretty_name}</> ' f'(<comment>{operation.package.full_pretty_version}</>)' ) Loading poetry/packages/dependency.py +12 −1 Changes for poetry/packages/dependency.py: 12 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ class Dependency: self._platform = '*' self._platform_constraint = self._parser.parse_constraints('*') self._extras = [] @property def name(self): return self._name Loading Loading @@ -73,12 +75,15 @@ class Dependency: @platform.setter def platform(self, value: str): self._platform = value self._platform_constraint = self._parser.parse_constraints(value) @property def platform_constraint(self): return self._platform_constraint @property def extras(self) -> list: return self._extras def allows_prereleases(self): return self._allows_prereleases Loading Loading @@ -129,6 +134,12 @@ class Dependency: return requirement def activate(self): """ Set the dependency as mandatory. """ self._optional = False def __eq__(self, other): if not isinstance(other, Dependency): return NotImplemented Loading poetry/packages/package.py +6 −1 Changes for poetry/packages/package.py: 6 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ class Package: self.requires = [] self.dev_requires = [] self.extras = {} self._parser = VersionParser() Loading Loading @@ -187,7 +188,7 @@ class Package: python_versions = constraint.get('python') platform = constraint.get('platform') optional = optional or python_versions is not None or not platform is not None optional = optional or python_versions is not None or platform is not None dependency = Dependency( name, version, Loading @@ -201,6 +202,10 @@ class Package: if platform: dependency.platform = platform if 'extras' in constraint: for extra in constraint['extras']: dependency.extras.append(extra) else: dependency = Dependency(name, constraint, category=category) Loading poetry/puzzle/provider.py +2 −1 Changes for poetry/puzzle/provider.py: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -64,7 +64,8 @@ class Provider(SpecificationProvider): packages = self._pool.find_packages( dependency.name, dependency.constraint dependency.constraint, extras=dependency.extras, ) packages.sort( Loading Loading
README.md +19 −19 Changes for README.md: 19 added lines, 19 removed lines. Original line number Diff line number Diff line Loading @@ -78,22 +78,22 @@ keywords = ['packaging', 'poetry'] [tool.poetry.dependencies] python = "~2.7 || ^3.2" # Compatible python versions must be declared here toml = "^0.9" requests = "^2.13" semantic_version = "^2.6" pygments = "^2.2" twine = "^1.8" wheel = "^0.29" pip-tools = "^1.8.2" # Dependencies with extras requests = { version = "^2.13", extras = [ "security" ] } # Python specific dependencies with prereleases allowed pathlib2 = { version = "^2.2", python = "~2.7", allows_prereleases = true } # Git dependencies cleo = { git = "https://github.com/sdispater/cleo.git", branch = "master" } # Optional dependencies (extras) pendulum = { version = "^1.4", optional = true} [tool.poetry.dev-dependencies] pytest = "^3.0" pytest-cov = "^2.4" coverage = "<4.0" httpretty = "^0.8.14" [tool.poetry.scripts] poet = 'poet:app.run' my-script = 'my_package:main' ``` There are some things we can notice here: Loading Loading @@ -632,21 +632,17 @@ poetry = 'poetry:console.run' Here, we will have the `poetry` script installed which will execute `console.run` in the `poetry` package. ### `features` ### `extras` Poetry supports features to allow expression of: Poetry supports extras to allow expression of: * optional dependencies, which enhance a package, but are not required; and * clusters of optional dependencies. ```toml [package] [tool.poetry] name = "awesome" [features] mysql = ["mysqlclient"] pgsql = ["psycopg2"] [dependencies] # These packages are mandatory and form the core of this package’s distribution. mandatory = "^1.0" Loading @@ -655,13 +651,17 @@ mandatory = "^1.0" # above `features`. They can be opted into by apps. psycopg2 = { version = "^2.7", optional = true } mysqlclient = { version = "^1.3", optional = true } [tool.poetry.extras] mysql = ["mysqlclient"] pgsql = ["psycopg2"] ``` When installing packages, you can specify features by using the `-f|--features` option: When installing packages, you can specify features by using the `-E|--extras` option: ```bash poet install --features "mysql pgsql" poet install -f mysql -f pgsql poet install --extras "mysql pgsql" poet install -E mysql -E pgsql ``` ### `plugins` Loading
poetry/installation/installer.py +5 −5 Changes for poetry/installation/installer.py: 5 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -230,7 +230,7 @@ class Installer: if operation.skipped: if self._io.is_verbose() and (self._execute_operations or self.is_dry_run()): self._io.writeln( f' - Skipping <info>{operation.package.name}</> ' f' - Skipping <info>{operation.package.pretty_name}</> ' f'(<comment>{operation.package.full_pretty_version}</>) ' f'{operation.skip_reason}') Loading @@ -238,7 +238,7 @@ class Installer: if self._execute_operations or self.is_dry_run(): self._io.writeln( f' - Installing <info>{operation.package.name}</> ' f' - Installing <info>{operation.package.pretty_name}</> ' f'(<comment>{operation.package.full_pretty_version}</>)' ) Loading @@ -254,7 +254,7 @@ class Installer: if operation.skipped: if self._io.is_verbose() and (self._execute_operations or self.is_dry_run()): self._io.writeln( f' - Skipping <info>{target.name}</> ' f' - Skipping <info>{target.pretty_name}</> ' f'(<comment>{target.full_pretty_version}</>) ' f'{operation.skip_reason}') Loading @@ -262,7 +262,7 @@ class Installer: if self._execute_operations or self.is_dry_run(): self._io.writeln( f' - Updating <info>{target.name}</> ' f' - Updating <info>{target.pretty_name}</> ' f'(<comment>{source.pretty_version}</>' f' -> <comment>{target.pretty_version}</>)' ) Loading @@ -275,7 +275,7 @@ class Installer: def _execute_uninstall(self, operation: Uninstall) -> None: if self._execute_operations or self.is_dry_run(): self._io.writeln( f' - Removing <info>{operation.package.name}</> ' f' - Removing <info>{operation.package.pretty_name}</> ' f'(<comment>{operation.package.full_pretty_version}</>)' ) Loading
poetry/packages/dependency.py +12 −1 Changes for poetry/packages/dependency.py: 12 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ class Dependency: self._platform = '*' self._platform_constraint = self._parser.parse_constraints('*') self._extras = [] @property def name(self): return self._name Loading Loading @@ -73,12 +75,15 @@ class Dependency: @platform.setter def platform(self, value: str): self._platform = value self._platform_constraint = self._parser.parse_constraints(value) @property def platform_constraint(self): return self._platform_constraint @property def extras(self) -> list: return self._extras def allows_prereleases(self): return self._allows_prereleases Loading Loading @@ -129,6 +134,12 @@ class Dependency: return requirement def activate(self): """ Set the dependency as mandatory. """ self._optional = False def __eq__(self, other): if not isinstance(other, Dependency): return NotImplemented Loading
poetry/packages/package.py +6 −1 Changes for poetry/packages/package.py: 6 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ class Package: self.requires = [] self.dev_requires = [] self.extras = {} self._parser = VersionParser() Loading Loading @@ -187,7 +188,7 @@ class Package: python_versions = constraint.get('python') platform = constraint.get('platform') optional = optional or python_versions is not None or not platform is not None optional = optional or python_versions is not None or platform is not None dependency = Dependency( name, version, Loading @@ -201,6 +202,10 @@ class Package: if platform: dependency.platform = platform if 'extras' in constraint: for extra in constraint['extras']: dependency.extras.append(extra) else: dependency = Dependency(name, constraint, category=category) Loading
poetry/puzzle/provider.py +2 −1 Changes for poetry/puzzle/provider.py: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -64,7 +64,8 @@ class Provider(SpecificationProvider): packages = self._pool.find_packages( dependency.name, dependency.constraint dependency.constraint, extras=dependency.extras, ) packages.sort( Loading