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

docs: extend python cookbook #3738

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

docs: extend python cookbook #3738

wants to merge 2 commits into from

Conversation

Finkregh
Copy link
Contributor

No description provided.

@Finkregh Finkregh marked this pull request as ready for review December 20, 2024 14:17
@Finkregh
Copy link
Contributor Author

Finkregh commented Dec 20, 2024

I did not get passing args via depends= or otherwise to work, perhaps someone could fix that? :)

@jdx


### Configuration files

Recommended configuration
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I certainly don't "recommend" this


Recommended configuration

```tomo [~/.config/mise/config.toml]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo


# This auto-updates tools and plugins
[hooks]
enter = "mise i -q && mise plugins update"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't seem like this should go into the python cookbook

#MISE dir="{{cwd}}"

# does not work with args
#XXMISEXX depends=["preset:python"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would need to be resolved first

mise config set hooks.enter 'if [ -e tests/requirements.txt ] ; then extra_file="tests/requirements.txt" ; fi ; uv pip sync requirements.txt $extra_file'

# this is more or less redundant after the above config, but if you want to run it manually you still can
mise config set tasks.install_deps.description "Install dependencies"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mise task add is a better way to do this


```sh
# for every project
mise tasks run -vvv preset:python 3.13
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why -vvv?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed that, thx

@@ -44,3 +44,171 @@ echo "Project: $PROJECT_NAME"
echo "Virtual Environment: $VIRTUAL_ENV"
'''
```

## Using tasks to create mise.toml for individual projects
Copy link
Contributor

@hverlin hverlin Dec 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe some of this content should go to https://mise.jdx.dev/mise-cookbook/presets.html, it also describes something similar. We can probably link it from the python cookbook page.

Or we can call this section python preset and add a reference to the preset page

@Finkregh Finkregh marked this pull request as draft December 23, 2024 12:00

# install latest versions from {tests/,}requirements.txt when entering the project directory and when the requirements.txts change
#mise config set hooks.enter "uv pip install -r pyproject.toml --all-extras"
mise config set hooks.enter "uv pip sync pyproject.toml"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uv pip sync uses uv as a pip replacement, it's not intended for uv-managed projects.

Did you mean to use uv sync?

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

Successfully merging this pull request may close these issues.

4 participants