-
Notifications
You must be signed in to change notification settings - Fork 19
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
[Feature request] Add option to define running work directory #81
Comments
I'm unsure about this feature because it can often be indispensable. Frequently, we need to use Taskipy in various directories such as scripts, src, tests, docs, etc. This largely depends on the project. For instance, if you aim to avoid repeating the same directory multiple times, you can utilize variables. For example: [tool.taskipy.variables]
path = "path/to/my_module"
[tool.taskipy.tasks]
lint = { cmd = "pylint {path}", use_vars = true }
black = { cmd = "black {path}", use_vars = true } |
Thanks for the reply! The thing is: Can If not, I can not share that setting in a public repo. Am I right? |
Yeah the path It's always relative to your pyproject.toml file. I mean where you declare the pyproject.toml file will be always your work directory. |
Sorry but, can you clarify? That is not what is happening here:
[tool.taskipy.tasks]
test = "cat tests/myfile.txt" It works ok when I'm in the root dir:
But not when I in
|
Hey @Diogo-Rossi ! That is actually a valid point and I think this would make a nice feature. Based on your proposal, I think that following would make a great addition to taskipy:
[tool.taskipy.settings]
cwd = "."
[tool.taskipy.tasks]
lint = { cmd = "pylint", cwd = '.' } Where:
What do you think? Would you like to contribute this feature? |
@illBeRoy Thanks for considering!
I actually think that will be easy, because you already foresaw an argument Lines 16 to 17 in 024933d
But I found some issues in installing dependencies for the project. By running at ~\AppData\Roaming\pypoetry\venv\Lib\site-packages\poetry\installation\chef.py:164 in _prepare
160│
161│ error = ChefBuildError("\n\n".join(message_parts))
162│
163│ if error is not None:
→ 164│ raise error from None
165│
166│ return path
167│
168│ def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:
Note: This error originates from the build backend, and is likely not a problem with poetry but with wrapt (1.13.3) not supporting PEP 517 builds. You can verify this by running 'pip
wheel --no-cache-dir --use-pep517 "wrapt (==1.13.3)"'. Do you know what am I doing wrong? |
I believe there's an issue with python 3.12 and one of the dev dependencies. I'll look into this |
seems like we needed to update pylint. I'm fixing this on #82 |
solved. please pull master and try reinstalling |
It's working now, thanks @illBeRoy! I'll work on the feature |
I ended up using another approach, since the |
If I have a task depending on a directory, as in the docs:
If I run the command
task test
in a folder other than the project's root directory (lets sayscr/
)it will raise an error, since the folder
test/
won't be found.This feature would allow to define a predefined work directory for the task.
It could be relative to the
pyproject.toml
's directory, maybe?Is it feasible?
Thank you very much for this tool!
The text was updated successfully, but these errors were encountered: