Giter Site home page Giter Site logo

Comments (7)

vikigenius avatar vikigenius commented on June 12, 2024

Maybe pdm can also install the user script to the bin location and then set sys.argv[0] appropriately.

from pdm.

frostming avatar frostming commented on June 12, 2024

[tool.poetry.scripts] is the way to expose a console script entry point for the installable package. The equivalent in PDM is the PEP standard [project.scripts]. And you must run pdm install, which installs the project itself, to make it work.

On the contrast, [tool.pdm.scripts] is a table of tasks with a name for each.

from pdm.

vikigenius avatar vikigenius commented on June 12, 2024

@frostming pdm install does not seem to work or install the project itself.

I added the following to pyproject.toml after removing the [tool.pdm.scripts]

[project.scripts]
llmft = "llmft.cli:run"

After doing pdm install it doesn't say anything about installing the project. Just says all packages are synced nothing to do.

When I do pdm run llmft it says

[PdmUsageError]: Command 'llmft' is not found in your PATH.

I try to manually run pdm run python llmft/cli.py

λ pdm run python llmft/cli.py
Traceback (most recent call last):
  File "/home/void/Projects/Research/llmft/llmft/cli.py", line 3, in <module>
    from llmft.fit import fit
ModuleNotFoundError: No module named 'llmft'

So the project itself is not being installed?

from pdm.

pawamoy avatar pawamoy commented on June 12, 2024

I think you need to give a name to your project:

[project]
name = "llmft-or-something-like-that"

Otherwise PDM doesn't consider your project as a package and does not try to install it.

from pdm.

vikigenius avatar vikigenius commented on June 12, 2024

@pawamoy

I do have it, here is my pyproject.toml

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

[project]
name = "llmft"
version = "0.1.0"
description = "LLM Finetuner"
authors = [
    {name = "Vikash Balasubramanian", email = "[email protected]"},
]
dependencies = [
    "torch>=2.1.2",
    "numpy>=1.26.3",
    "transformers>=4.36.2",
    "peft>=0.7.1",
    "datasets>=2.16.1",
    "arger>=1.4.8",
    "pytorch-lightning>=2.1.3",
]
requires-python = "==3.11.*"
readme = "README.md"
license = {text = "MIT"}

[project.scripts]
llmft = "llmft.cli:run"

[tool.pdm]
package-type = "application"

[tool.pdm.dev-dependencies]
qa = [
    "ruff>=0.1.11",
    "mypy>=1.8.0",
]
tools = [
    "python-lsp-server>=1.9.0",
    "ruff-lsp>=0.0.49",
]

from pdm.

frostming avatar frostming commented on June 12, 2024

the package type has to be "library" to make it installable

from pdm.

vikigenius avatar vikigenius commented on June 12, 2024

@frostming Ok thanks for that. Maybe it would be helpful if the document made it a bit more clear the differences between application and library.

I thought my project was an application since it had a console script entry point as a CLI application.

from pdm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.