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

fix: get pyproject.toml path from PDM #5

Merged
merged 1 commit into from
Jul 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
version: ${{ matrix.pdm-version }} # The version of PDM to install. Leave it as empty to use the latest version from PyPI, or 'head' to use the latest version from GitHub
prerelease: true # Allow prerelease versions of PDM to be installed
enable-pep582: false # Enable PEP 582 package loading globally
allow-python-prereleases: true # Allow prerelease versions of Python to be installed. For example if only 3.12-dev is available, 3.12 will fallback to 3.12-dev
allow-python-prereleases: true # Allow prerelease versions of Python to be installed. For example if only 3.12-dev is available, 3.12 will fall back to 3.12-dev
- name: Set Cache Variables
id: set_variables
run: |
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "pdm.backend"

[project]
name = "sync-pre-commit-lock"
version = "0.2.0"
version = "0.2.1"
description = "PDM plugin to sync your pre-commit versions with your lockfile, and install them, all automatically."
authors = [{ name = "Gabriel Dugny", email = "sync-pre-commit-lock@dugny.me" }]
dependencies = [
Expand Down Expand Up @@ -121,4 +121,4 @@ exclude_lines = [
# We must configure Poetry as well 🤦
[tool.poetry]
name = "sync-pre-commit-lock"
version = "0.1.0"
version = "0.2.1"
2 changes: 1 addition & 1 deletion src/sync_pre_commit_lock/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class SyncPreCommitLockConfig:


def load_config(path: Path | None = None) -> SyncPreCommitLockConfig:
# XXX We Should not hardcode this, and get the filename from PDM/Poetry/custom resolution
# XXX We should not hard-code this, and get the filename from PDM/Poetry/custom resolution
path = path or Path("pyproject.toml")
with path.open("rb") as file:
config_dict = toml.load(file)
Expand Down
4 changes: 2 additions & 2 deletions src/sync_pre_commit_lock/pdm_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ def on_pdm_install_setup_pre_commit(
def on_pdm_lock_check_pre_commit(
project: Project, *, resolution: dict[str, Candidate], dry_run: bool, **kwargs: Any
) -> None:
plugin_config: SyncPreCommitLockConfig = load_config()
printer = PDMPrinter(project.core.ui)
project_root: Path = project.root
plugin_config: SyncPreCommitLockConfig = load_config(project_root / project.PYPROJECT_FILENAME)
printer = PDMPrinter(project.core.ui)

file_path = project_root / plugin_config.pre_commit_config_file
resolved_packages: dict[str, GenericLockedPackage] = {
Expand Down
Loading