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

atlas use project2 does not resolve to a project2 existing in the workspace #71

Open
heysokam opened this issue Sep 12, 2023 · 2 comments

Comments

@heysokam
Copy link

I'm trying to make atlas understand local development packages that already exist in the workspace.
image
I don't want to use URL, the point of the folder structure is to not need url at all
But im having a hard time making atlas understand this structure

The documentation reads:

A workspace contains one or multiple "projects". These projects can use each other and it is easy to develop multiple projects at the same time.
https://github.com/nim-lang/atlas/blob/master/doc/atlas.md#projects

But I'm not quite getting how that is going to happen if atlas use mypkg is not finding the folder right next to itself, which exists inside the workspace structure already.

I know about atlas use /path/to/package.... but that is adding requires "file://path/to/package" to the nimble file, and that is incompatible syntax with nimble, which makes nimble completely break and not able to run at all.
(I may not want to use nimble myself, but I cannot force that choice on everybody, specially with atlas being in such early dev state. So I don't want to make my nimble files unusable just because I chose atlas)

The main problem is that I don't want to have my dependencies in a subfolder. I have to maintain a set of modules like this:
image
And the list is only growing. Which is why I'm turning to atlas, in the hopes that I can finally use nimble develop like I used to do without issues, but since that feature is very broken in Nimble, I'm hoping that atlas can solve the problem.

I have even tried nim.cfg with both nimble and raw nim c and no nimble at all... and they both fail to resolve the sub-dependencies. Which is extremely frustrating, because it means I have to reupload the package, remove it from local, redownload my own package, and repeat.... for every single line I change, which is just ridiculous.

The main goal is being able to keep my current folder structure of dependencies all stored at the root of the workspace, and make each dependency understand that its dependencies exist in the folder right next to them.
How can I approach this with atlas?

@heysokam
Copy link
Author

image
To showcase the issue a bit more, this is the result of atlas use https://github.com/heysokam/ngpu in that same triangle test package.

All of the dependencies marked with arrows are not mine. They are external. And, as such, should go into a subfolder... not into the root of my workspace.

@heysokam
Copy link
Author

Sorry for the noise. I think I figured it out by trial/error and experimenting with different options.
image

This is the step by step, would be useful to have it somewhere in the documentation as an alternative:

# How to create a Package + Sub-Packages structure
## Initialize Atlas, specifying `subfolder` for its dependencies
mkdir workspace
cd workspace
atlas init --deps:depsfolder

## Clone our packages into the workspace root `workspace/*` manually first
> (important) must happen before `atlas use url/to/packageN`
git clone url/to/package1
git clone url/to/package2
git clone url/to/package3
git clone url/to/package4

## Create a new package into the atlas workspace root `workspace/*`
mkdir myproject
cd myproject

## Tell atlas that we use our project dependencies, giving it their URL
atlas use url/to/package1 
atlas use url/to/package2
atlas use url/to/package3
atlas use url/to/package4

> As a result, all of the sub-dependencies of package1-4 will go into `workspace/depsfolder`
> And all our required packages stay at the root of the atlas workspace

> The order or operations is important.
> Otherwise atlas would consider package1-4 as dependencies
> and store them in `workspace/depsfolder`,
> instead of keeping them at the root of the workspace like we want

## Resulting tree:
workspace
|
|-- myproject   -> (has access to package1, package2, package3, package4)
|    |- nim.cfg
|    |_ myproject.nimble
|
|-- package1
|-- package2
|-- package3
|-- package4
|
|-- libs
|    |- external_dependency1   (from package1)
|    |- external_dependency2   (from package1)
|    |- external_dependency3   (from package2)
|    |_..... etc
|
|_ atlas.workspace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant