Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 regex safe constraints path #57

Merged
merged 3 commits into from
Jan 9, 2024
Merged

🐛 regex safe constraints path #57

merged 3 commits into from
Jan 9, 2024

Conversation

juftin
Copy link
Owner

@juftin juftin commented Jan 8, 2024

Closes #56

@juftin juftin added the bug Something isn't working label Jan 8, 2024
@juftin juftin self-assigned this Jan 8, 2024
@juftin
Copy link
Owner Author

juftin commented Jan 8, 2024

😠 This test fixture doesn't seem to be working on the Windows tests

@pytest.fixture(autouse=True)
def pip_compile_disable(monkeypatch: pytest.MonkeyPatch) -> None:
"""
Delete the PIP_COMPILE_DISABLE environment variable
"""
monkeypatch.delenv("PIP_COMPILE_DISABLE", raising=False)

https://github.com/juftin/hatch-pip-compile/actions/runs/7450650936/job/20270034562

EDIT: Actually, this looks like it's happening outside of the tests 🤔

@@ -54,7 +54,7 @@ def process_lock(self, lockfile: pathlib.Path) -> None:
)
if self.constraints_file is not None:
constraint_sha = hashlib.sha256(self.constraints_file.read_bytes()).hexdigest()
constraints_path = self.constraints_file.relative_to(self.project_root)
constraints_path = self.constraints_file.relative_to(self.project_root).as_posix()
constraints_line = f"# [constraints] {constraints_path} (SHA256: {constraint_sha})"
joined_dependencies = "\n".join([constraints_line, "#", joined_dependencies])
cleaned_input_file = re.sub(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I was referring to, I think it should work

-                f"-c {constraints_path}",
+                lambda m: f"-c {constraints_path}",

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying that here, I will test it out. I appreciate the help on this, RegEx is my developer kryptonite.

Comment on lines 91 to 98
- {
name: Hatch-Windows,
python: "3.11",
command: "matrix:cov",
matrix: "+py=3.11",
hatch_version: "1.0",
os: windows-latest,
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This testing matrix is actually kind of problematic. See https://github.com/juftin/hatch-pip-compile/actions/runs/7450650936/job/20270034562

It looks like changing between Linux and Windows makes hatch-pip-compile try to recreate the lockfile.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason when running in Windows lockfile_up_to_date is False but lockfile_up_to_date is True when run on Linux.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split this out into #58 so this fix can unblock #56

@juftin juftin changed the title 🐛 use posix constraints paths 🐛 regex safe constraints path Jan 8, 2024
@juftin juftin requested a review from oprypin January 8, 2024 23:40
@juftin juftin merged commit 9924e1f into main Jan 9, 2024
9 checks passed
@juftin juftin deleted the fix/windows_paths_regex branch January 9, 2024 04:49
github-actions bot added a commit that referenced this pull request Jan 9, 2024
# [v1.9.1](v1.9.0...v1.9.1) (2024-01-09)

## 🐛 Bug Fixes
- [`9924e1f`](9924e1f)  regex safe constraints path (Issues: [`#57`](#57))

[skip ci]
@juftin
Copy link
Owner Author

juftin commented Jan 9, 2024

🎉 This PR is included in version 1.9.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@juftin juftin added the released label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regex error when installing pydantic as dependency
2 participants