Skip to content

Commit

Permalink
fix: get pyproject.toml path from PDM (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
GabDug committed Jul 30, 2023
1 parent 80a5d30 commit 2321f71
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
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

0 comments on commit 2321f71

Please sign in to comment.