Skip to content

Commit

Permalink
Start on blog post.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Nov 25, 2024
1 parent 7e73a16 commit 10fc51f
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 0 deletions.
115 changes: 115 additions & 0 deletions website/blog/2024-11-25_moon-v1.30.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
slug: moon-v1.30
title: moon v1.30 - Python support, self-hosted remote caching, task graph, and more!
authors: [milesj]
tags: [affected, detection, tracker, task, graph, self-hosted, remote, cache, python, toolchain]
image: ./img/moon/v1.30.png
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

It's been almost 2 months since our last release, and we're excited to announce some major features
requested by the community!

<!--truncate-->

## Experimental Python tier 2 and 3 support

Thanks to a contribution from [@harlequin](https://github.com/harlequin), we now provide Python tier
[2](/docs/how-it-works/languages#tier-2--platform) and
[3](/docs/how-it-works/languages#tier-3--toolchain) support. Python is a very popular language, so
it was about time that we officially supported it in some capacity. When enabling Python in moon,
the following functionality will be enabled:

- Will download and install Python into the toolchain (if `python.version` is defined).
- Will parse `requirements.txt` to extract dependency and version information for hashing.
- Will automatically activate virtual environments and setup `PATH` for tasks.
- Will automatically install dependencies for `requirements.txt` via pip.
- And a handful of internal interoperability features.

However, we're still marking this implementation as experimental, as it hasn't been thoroughly
tested, and we're not 100% positive the workflows are what users expect. So please provide any
feedback, good or bad!

Furthermore, as mentioned above, we install dependencies with pip (the version of pip that comes
pre-installed with the current Python version). At this time, _we do not support_ other package
managers like Poetry, Hatch, PDM, Rye, or uv, but we will in the future!

### New `python` configurations

Languages in
[moon are enabled through configuration](/docs/how-it-works/languages#enabling-a-language) blocks in
[`.moon/toolchain.yml`](/docs/config/toolchain), and Python is no different. We now support a
[`python`](/docs/config/toolchain#python) toolchain setting
([view all available settings](/docs/config/toolchain)).

```yaml title=".moon/toolchain.yml"
python:
version: '3.14.0'
```

When the `python` setting is defined, it will enable the language and
[deep platform integration](/docs/how-it-works/languages#tier-2--platform), and when the
`python.version` field is defined, it will further enable
[toolchain support](/docs/how-it-works/languages#tier-3--toolchain). Both of these features provide
heavy automation, improving the overall developer experience.

This is fantastic, but what if another Python project in the monorepo requires a different toolchain
channel/version? If so, they can use the new [`toolchain.python`](/docs/config/project#python)
setting in [`moon.yml`](/docs/config/project) to define project-level overrides.

```yaml title="<project>/moon.yml"
toolchain:
python:
version: '3.12.0'
```

### Built-in virtual environments

Of course we also have support for Python virtual environments. When running a task, moon will
automatically enable the virtual environment in the workspace root or a project root (depending on
config)! The name of the venv can be customized with the
[`python.venvName`](/docs/config/toolchain#venvname) setting, otherwise it defaults to `.venv`.

```yaml title=".moon/toolchain.yml"
python:
venvName: '.venvcustom'
```

## Unstable self-hosted remote caching

## New task graph and improved affected tracker

In our [last release](./moon-v1.29#new-affected-projects-tracker), we announced a new affected
tracker for projects, but _not_ for tasks. The reason behind this was simple, we couldn't! Up until
now, we had no concept of a task graph, we had a project graph (that had tasks) and an action graph
(that ran tasks), but the relationships between tasks were split across both of these graphs.

This made it complicated to support tasks for the new affected tracker, as the action graph
_consumes_ the tracker, not the other way around. To remedy this issue, we now support an official
task graph, which is derived from the project graph, and then feeds into the action graph. Since the
task graph sits outside of the action graph, we're now able to support tasks in the affected
tracker!

Because of the new task graph, the following improvements have been introduced:

- Tasks are now supported in the affected tracker (as mentioned).
- We can now properly query dependencies and dependents of specific tasks.
- We can now associate types to relationships (graph edges). For example, in the future we can add
optional, cleanup, and other kinds of dependencies.
- We've added a new command, [`moon task-graph`](/docs/commands/task-graph), that can visualize
tasks in isolation.
- We've updated the [`moon query tasks`](/docs/commands/query/tasks) to derive information from the
task graph.

## Other changes

View the [official release](https://github.com/moonrepo/moon/releases/tag/v1.30.0) for a full list
of changes.

- Added basic support for Git submodules, and will now extract touched files from all submodules.
- Added 7 new token variables: `$arch`, `$os`, `$osFamily`, `$vcsBranch`, `$vcsRepository`,
`$vcsRevision`, `$workingDir`
- Added a `rust.binstallVersion` setting to `.moon/toolchain.yml`.
- Updated Pkl configurations to support `read()` for environment variables.
Binary file added website/blog/img/moon/v1.30.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 10fc51f

Please sign in to comment.