Skip to content

Commit

Permalink
Do not freeze file-based Poetry dependency version
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipuniverse committed Nov 18, 2021
1 parent 5db0e3f commit cea6d0a
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def freeze_top_level_dependencies_except(dependencies)

next unless (locked_version = locked_details&.fetch("version"))

next if locked_details&.dig("source", "type") == "directory"
next if locked_details&.dig("source", "type") == "directory" || locked_details&.dig("source", "type") == "file"

if locked_details&.dig("source", "type") == "git"
poetry_object[key][dep_name] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,20 @@
)
end
end

context "with file dependencies" do
let(:dependencies) { [] }

let(:pyproject_lock_fixture_name) { "file_dependency.lock" }
let(:pyproject_fixture_name) { "file_dependency.toml" }

it { is_expected.to include("pytest = \"3.7.4\"\n") }
it "does not include the version for path deps" do
expect(freeze_top_level_dependencies_except).to_not include(
"path = \"toml-8.2.54.tar.gz\"\n"\
"version = \"8.2.54\"\n"
)
end
end
end
end
14 changes: 14 additions & 0 deletions python/spec/fixtures/pyproject_files/file_dependency.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[tool.poetry]
name = "PythonProjects"
version = "2.0.0"
homepage = "https://github.com/roghu/py3_projects"
license = "MIT"
readme = "README.md"
authors = ["Dependabot <[email protected]>"]
description = "Various small python projects."

[tool.poetry.dependencies]
python = "^3.7"
toml = { path = "toml-8.2.54.tar.gz" }
pytest = "*"

114 changes: 114 additions & 0 deletions python/spec/fixtures/pyproject_locks/file_dependency.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
[[package]]
category = "main"
description = "Atomic file writes."
name = "atomicwrites"
optional = false
platform = "*"
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "1.2.1"

[[package]]
category = "main"
description = "Classes Without Boilerplate"
name = "attrs"
optional = false
platform = "*"
python-versions = "*"
version = "18.2.0"

[[package]]
category = "main"
description = "Cross-platform colored terminal text."
name = "colorama"
optional = false
platform = "UNKNOWN"
python-versions = "*"
version = "0.3.9"

[package.requirements]
platform = "win32"

[[package]]
category = "main"
description = "More routines for operating on iterables, beyond itertools"
name = "more-itertools"
optional = false
platform = "*"
python-versions = "*"
version = "4.3.0"

[package.dependencies]
six = ">=1.0.0,<2.0.0"

[[package]]
category = "main"
description = "plugin and hook calling mechanisms for python"
name = "pluggy"
optional = false
platform = "unix"
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "0.7.1"

[[package]]
category = "main"
description = "library with cross-python path, ini-parsing, io, code, log facilities"
name = "py"
optional = false
platform = "unix"
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "1.6.0"

[[package]]
category = "main"
description = "pytest: simple powerful testing with Python"
name = "pytest"
optional = false
platform = "unix"
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "3.7.4"

[package.dependencies]
atomicwrites = ">=1.0"
attrs = ">=17.4.0"
more-itertools = ">=4.0.0"
pluggy = ">=0.7"
py = ">=1.5.0"
setuptools = "*"
six = ">=1.10.0"

[package.dependencies.colorama]
platform = "win32"
version = "*"

[[package]]
category = "main"
description = "Python 2 and 3 compatibility utilities"
name = "six"
optional = false
platform = "*"
python-versions = "*"
version = "1.11.0"

[[package]]
category = "main"
description = ""
name = "toml"
optional = false
platform = "*"
python-versions = "*"
version = "0.10.0"

[package.source]
type = "file"
url = "toml-8.2.54.tar.gz"

[metadata.hashes]
atomicwrites = ["0312ad34fcad8fac3704d441f7b317e50af620823353ec657a53e981f92920c0", "ec9ae8adaae229e4f8446952d204a3e4b5fdd2d099f9be3aaf556120135fb3ee"]
attrs = ["10cbf6e27dbce8c30807caf056c8eb50917e0eaafe86347671b57254006c3e69", "ca4be454458f9dec299268d472aaa5a11f67a4ff70093396e1ceae9c76cf4bbb"]
colorama = ["463f8483208e921368c9f306094eb6f725c6ca42b0f97e313cb5d5512459feda", "48eb22f4f8461b1df5734a074b57042430fb06e1d61bd1e11b078c0fe6d7a1f1"]
more-itertools = ["c187a73da93e7a8acc0001572aebc7e3c69daf7bf6881a2cea10650bd4420092", "c476b5d3a34e12d40130bc2f935028b5f636df8f372dc2c1c01dc19681b2039e", "fcbfeaea0be121980e15bc97b3817b5202ca73d0eae185b4550cbfce2a3ebb3d"]
pluggy = ["6e3836e39f4d36ae72840833db137f7b7d35105079aee6ec4a62d9f80d594dd1", "95eb8364a4708392bae89035f45341871286a333f749c3141c20573d2b3876e1"]
py = ["06a30435d058473046be836d3fc4f27167fd84c45b99704f2fb5509ef61f9af1", "50402e9d1c9005d759426988a492e0edaadb7f4e68bcddfea586bc7432d009c6"]
pytest = ["2d7c49e931316cc7d1638a3e5f54f5d7b4e5225972b3c9838f3584788d27f349", "ad0c7db7b5d4081631e0155f5c61b80ad76ce148551aaafe3a718d65a7508b18"]
six = ["70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", "832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb"]
toml = []

0 comments on commit cea6d0a

Please sign in to comment.