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

Build fails on requirements.txt schema not followed correctly #206

Closed
kenyerman opened this issue May 14, 2024 · 4 comments · Fixed by #207
Closed

Build fails on requirements.txt schema not followed correctly #206

kenyerman opened this issue May 14, 2024 · 4 comments · Fixed by #207
Assignees
Labels
bug Something isn't working in-progress We are working on this Issue

Comments

@kenyerman
Copy link

Current Behavior

Since python-poetry/poetry-plugin-export#258 was merged, the temporary requirements.txt format's changed. This makes local project dependencies unparseable, making the build fail.

Relevant snippets

tailored output

npx nx run myapp:build --skip-nx-cache

   ⠸    Nx is waiting on 1 dependent project tasks before running tasks from myapp...
  - Built mylib-1.0.0.tar.gz

   ✔    1/1 dependent project tasks succeeded [0 read from cache]


> nx run myapp:build


  Building project  myapp ...

  Copying project files to a temporary folder
  Resolving dependencies...
    • Adding -e file:///Users/user/path-to-project/libs/mylib ==undefined dependency

   ERROR  Package -e file:///Users/user/path-to-project/libs/mylib  not found in poetry.lock


 >  NX   Ran target build for project myapp and 1 task(s) they depend on (1s)
 
    ✖    1/2 failed
    ✔    1/2 succeeded [0 read from cache]
 

requirements.txt with [email protected]

aniso8601==9.0.1 ; python_version >= "3.9" and python_version < "3.11"
mylib @ file:///Users/user/path-to-project/libs/mylib ; python_version >= "3.9" and python_version < "3.11"
annotated-types==0.6.0 ; python_version >= "3.9" and python_version < "3.11"
anyio==4.3.0 ; python_version >= "3.9" and python_version < "3.11"
.
.
.

requirements.txt with [email protected]

-e file:///Users/user/path-to-project/libs/mylib ; python_version >= "3.9" and python_version < "3.11"
aniso8601==9.0.1 ; python_version >= "3.9" and python_version < "3.11"
annotated-types==0.6.0 ; python_version >= "3.9" and python_version < "3.11"
anyio==4.3.0 ; python_version >= "3.9" and python_version < "3.11"
.
.
.

Expected Behavior

build succeeds

Steps to Reproduce

1. install latest poetry-export-plugin

poetry self add  poetry-plugin-export@latest

2. watch the build fail

npx nx run myapp:build

Nx Report

Node   : 20.10.0
   OS     : darwin-arm64
   npm    : 10.2.3
   
   nx                 : 17.2.8
   @nx/js             : 17.2.8
   @nx/jest           : 17.2.8
   @nx/linter         : 17.2.8
   @nx/eslint         : 17.2.8
   @nx/workspace      : 17.2.8
   @nx/angular        : 17.2.8
   @nx/cypress        : 17.2.8
   @nx/devkit         : 17.2.8
   @nx/esbuild        : 17.2.8
   @nx/eslint-plugin  : 17.2.8
   @nx/nest           : 17.2.8
   @nx/node           : 17.2.8
   @nrwl/tao          : 17.2.8
   @nx/web            : 17.2.8
   @nx/webpack        : 17.2.8
   typescript         : 5.2.2
   ---------------------------------------
   Community plugins:
   @nxlv/python : 18.0.1
   ng-mocks     : 14.12.2

Failure Logs

No response

Additional Information

The error is in:
packages/nx-python/src/executors/build/resolvers/locked.ts:67

strategy of parsing local dependencies from requirements.txt must be rewritten.

@kenyerman kenyerman added bug Something isn't working needs-triage This issue needs triage labels May 14, 2024
@kenyerman
Copy link
Author

Workaround

downgrade poetry-plugin-export to 1.7.1

poetry self add  [email protected]

@kenyerman
Copy link
Author

the issue can be also resolved by setting the develop=true to false for the dependency in the pyproject.toml

    [tool.poetry.dependencies.mylib]
    path = "../../../libs/mylib"
-   develop = true
+   develop = false

@lucasvieirasilva
Copy link
Owner

@kenyerman thanks for reporting this issue, well, the problem with the develop=false setting is that you need to build your local dependency to reflect the changes in the project that you are referencing, the develop=true creates an link between the projects.

I'll work on this poetry-plugin-export 1.7.1> support.

@lucasvieirasilva lucasvieirasilva added in-progress We are working on this Issue and removed needs-triage This issue needs triage labels May 14, 2024
@lucasvieirasilva lucasvieirasilva self-assigned this May 14, 2024
lucasvieirasilva added a commit that referenced this issue May 14, 2024
In the [email protected] the requirements.txt format has changed for local dependencies
from `<packageName> @ file://<location>` to `-e file:///`

re #206
@lucasvieirasilva lucasvieirasilva linked a pull request May 14, 2024 that will close this issue
lucasvieirasilva added a commit that referenced this issue May 14, 2024
In the [email protected] the requirements.txt format has changed for local dependencies
from `<packageName> @ file://<location>` to `-e file:///`

re #206
github-actions bot pushed a commit that referenced this issue May 14, 2024
# [18.1.0](nx-python-v18.0.1...nx-python-v18.1.0) (2024-05-14)

### Features

* **nx-python:** add support for [email protected] ([#207](#207)) ([28d4ae3](28d4ae3)), closes [#206](#206)
@kenyerman
Copy link
Author

kenyerman commented May 15, 2024

#207 solves this issue, confirmed.

Thanks for the very quick support!

🎉🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in-progress We are working on this Issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants