Giter VIP home page Giter VIP logo

Comments (6)

nat-n avatar nat-n commented on August 22, 2024 1

This feature is not available in in 0.27.0 🚀
It is documented here.

from poethepoet.

nat-n avatar nat-n commented on August 22, 2024

Hi @jaklan, thanks for the feedback. I see how this would be useful.

I'm currently working on a bit of a refactor of config management works, which adds support for referencing env vars in the include path. So maybe exposing something like ${POE_GIT_ROOT} would do the trick there?

Supporting sub-shell syntax would be a bit of a different story.

from poethepoet.

jaklan avatar jaklan commented on August 22, 2024

@nat-n thanjs for the quick response! Afaik git doesn't expose any envar to identify the repo root, but if you provide it as a custom poe var - I believe it should be good enough for many use-cases (incl. ours).

We would just like to avoid a situation when it's needed to rely on an envar which has to be set locally by all developers.

from poethepoet.

nat-n avatar nat-n commented on August 22, 2024

Hi @jaklan, I was thinking about exactly how to implement this, as a lazily resolve environment variable set by poe, and I realised the problem isn't as it seemed.

Firstly, how exactly should POE_GIT_ROOT be defined by poe? If it's relative to the present working directory then that won't always be inside the project making it brittle. If it's relative to the relevant config file then it gets complicated if you're composing your project with git modules. And if it's relative to the root config file, then you probably already have the answer you care about with the POE_ROOT environment variable without having to consult with git.

What do you think the logic should be to be robust?

EDIT: maybe the way to be consistent despite submodules is git rev-parse --show-superproject-working-tree --show-toplevel ?

from poethepoet.

jaklan avatar jaklan commented on August 22, 2024

@nat-n

I just thought about triggering $(git rev-parse --show-toplevel) in current (or specified) working directory, as an alternative to specifying a shell command directly in include. I won't really help with the submodule case, I don't use them intentionally.

About POE_ROOT:

POE_ROOT: path to the parent directory of the main tasks file (e.g. pyproject.toml).

If we have the structure like:

pyproject.toml
projects/
-- pyproject.toml
-- foobar/
---- pyproject.toml

and define:

[tool.poe]
include = "$POE_ROOT/pyproject.toml" 

in projects/foobar/pyproject.toml - would it refer to the root directory, to projects/, or to projects/foobar? How to understand "the main tasks file" here?

from poethepoet.

jaklan avatar jaklan commented on August 22, 2024

@nat-n that's so cool, thank you!

from poethepoet.

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.