Skip to content

Commit

Permalink
move configuration and release next version (#18)
Browse files Browse the repository at this point in the history
Did this as a secondary to make upgrading a bit nicer. See the doc
changes for more info.
  • Loading branch information
tgolsson authored Nov 14, 2023
1 parent 9db8afa commit e3c1228
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 15 deletions.
1 change: 0 additions & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ steps:

- label: ":pytest: Run tests @ {{matrix}}"
matrix:
- "pdm25"
- "pdm26"
- "pdm27"
- "pdm29"
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [23.4.0] - 2023-11-14

- Configuration is now expected at `tool.pdm.plugin.torch`. Note the missing `s`. This is to avoid collision with the upstream configuration key.

## [23.3.0] - 2023-11-14

- Add support for PDM 2.9 and 2.10
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This tool generate multiple lockfiles *only for torch* and allows you to use a p
These are the supported options:

```toml
[tool.pdm.plugins.torch]
[tool.pdm.plugin.torch]
dependencies = [
"torch==1.10.2"
]
Expand All @@ -46,11 +46,11 @@ cuda-versions = ["cu111", "cu113"]

## Installation

Currently PDM does not support specifying plugin-dependencies in your pyproject.toml. Thus, we suggest using a setup like the following:
PDM supports specifying plugin-dependencies in your pyproject.toml, which is the suggested installation method. Note that in `pdm-plugin-torch` versions before 23.4.0, our configuration was in `tool.pdm.plugins.torch`. If upgrading, you'll need to also change that to `tool.pdm.plugin.torch`.

``` toml
[tool.pdm.scripts]
post_install = "pdm plugin add pdm-plugin-torch==$VERSION"
[tool.pdm]
plugins = ["pdm-plugin-torch==$VERSION"]
```

## Contribution
Expand Down
14 changes: 10 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,20 @@ dependencies are locked.
Usage
=====

Currently PDM does not support specifying plugin-dependencies in your pyproject.toml. Thus, we suggest using a setup like the following:
PDM supports specifying plugin-dependencies in your pyproject.toml, which is the suggested installation method. Note that in `pdm-plugin-torch` versions before 23.4.0, our configuration was in `tool.pdm.plugins.torch`. If upgrading, you'll need to also change that to `tool.pdm.plugin.torch`.


.. code-block::
[tool.pdm.scripts]
post_install = "pdm plugin add pdm-plugin-torch==$VERSION"
[tool.pdm]
plugins = ["pdm-plugin-torch>=$VERSION"]
It is also suggested to use a `post_lock` hook to update the lockfile when a regular lock is made:

.. code-block::
[tool.pdm.scripts]
post_lock = "pdm torch lock"
Configuration
Expand All @@ -49,7 +55,7 @@ These are the supported options:

.. code-block::
[tool.pdm.plugins.torch]
[tool.pdm.plugin.torch]
dependencies = [
"torch==1.10.2"
]
Expand Down
2 changes: 1 addition & 1 deletion pdm-plugin-torch/pdm_plugin_torch/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def check_lockfile(project: Project, lock_name: str) -> str | None:


def get_settings(project: Project):
return project.pyproject.settings["plugins"]["torch"]
return project.pyproject.settings["plugin"]["torch"]


class InstallCommand(BaseCommand):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pdm-plugin-torch"
version = "23.3.0"
version = "23.4.0"
description = "A plugin to help installing torch versions"
authors = [
{name = "Embark Studios", email = "python@embark-studios.com"},
Expand Down
12 changes: 8 additions & 4 deletions tests/fixtures/cpu-only/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ description = ""
version = "0.0.01"

[build-system]
requires = ["pdm-pep517"]
build-backend = "pdm.pep517.api"
requires = ["pdm-backend"]
build-backend = "pdm.backend"

[tool.pdm.plugins.torch]
[tool.pdm]
plugins = [
"../../"
]

[tool.pdm.plugin.torch]
dependencies = [
"torch==1.11.0"
]
Expand All @@ -27,5 +32,4 @@ enable-cuda = false
cuda-versions = ["cu115", "cu117"]

[tool.pdm.scripts]
post_install = "pdm plugin add ../../"
post_lock = "pdm torch lock"

0 comments on commit e3c1228

Please sign in to comment.