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

new: Add Python tier 2 and 3 support. #1694

Open
wants to merge 30 commits into
base: develop-1.30
Choose a base branch
from

Conversation

harlequin
Copy link
Contributor

@harlequin harlequin commented Oct 18, 2024

Support python as a tier level 3 language in moon.

  • Added Python tier 3 support.
    • Will download and install Python into the toolchain when a version is configured.
    • Will parse the requirements.txt to resolve and install dependencies.
    • Added a python.version setting to .moon/toolchain.yml.
    • Added a toolchain.python setting to moon.yml.
    • Updated moon bin commands to support Python.

Would close Issues

@milesj
Copy link
Collaborator

milesj commented Oct 18, 2024

@harlequin Awesome stuff! I don't know Python at all, so I'll probably be asking a bunch of dumb questions.

Also, since this is a pretty large feature, it should merge into a dev branch. I've created develop-1.30, so can you update the merge base to that.

let args = vec![
"-m",
"venv",
virtual_environment.as_os_str().to_str().unwrap(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need an absolute path? Could it just be &python.config.venv_name?

milesj and others added 2 commits October 19, 2024 19:25
* Add workspace crate.

* Add projects loading.

* Add build.

* Clean up build data.

* Flesh out build.

* Add caching.

* Add to session.

* Use focused graphs.

* Add workspace mocker.

* Delete old graph builder.

* Polish.

* Fix tests.

* Fix tests.
@harlequin harlequin changed the base branch from master to develop-1.30 October 30, 2024 07:06
@milesj
Copy link
Collaborator

milesj commented Nov 3, 2024

Can you rebase develop-1.30 so that the diff is nice.

@harlequin harlequin changed the title [WIP] Python plattform support Tier Level 3 new: Add Python tier 2 and 3 support. Nov 4, 2024
@harlequin
Copy link
Contributor Author

harlequin commented Nov 4, 2024

Hey @milesj

I have done the re-work you have suggested and from my point of view it shall be complete.
Therefore I have removed the WIP tag on this commit.

Rebase to the develop-1.30 is done.

@harlequin harlequin marked this pull request as ready for review November 4, 2024 09:38
.yarn/versions/3fbef0f1.yml Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
- remove yarn version modification
- remove version configuration for pip, if user want's to update the pip dependency he can do this via the requirements.txt or installArgs method
- add root_requirements_only, to be able to create venv in project scope or in workspace scope
- pip_requirements fixed the occupied/vaccant
- clean up Cargo.toml
- reworked and rethinked the install_deps and setup_tool function; install_deps phase is absolute sufficient
- remove not needed comments
- remove all references to get_workspace_root
- Cleaned up CHANGELOG.md
@harlequin
Copy link
Contributor Author

I have updated today again main parts of the implementation, and also re-thought about the setup_tools and other areas.
I have now re-worked that the venv and deps install will be executed on the install_deps phase which is absolutely sufficient.

Additional I have removed all the dead code and not needed comments.

These are the areas were I have had a look into ... hope that I didn't missed something ;)

  • remove yarn version modification
  • remove version configuration for pip, if user want's to update the pip dependency he can do this via the requirements.txt or installArgs method
  • add root_requirements_only, to be able to create venv in project scope or in workspace scope
  • pip_requirements fixed the occupied/vaccant
  • clean up Cargo.toml
  • reworked and rethinked the install_deps and setup_tool function; install_deps phase is absolute sufficient
  • remove not needed comments
  • remove all references to get_workspace_root
  • Cleaned up CHANGELOG.md

#[setting(nested)]
pub pip: Option<PipConfig>,

#[setting(default = ".venv", skip)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add a description then run just schemas.

);
}

if let Some(install_args) = &pip_config.install_args {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should probably still pip install even if there are no custom args yeah? The args from the config should just append.

}
}

if let Some(req) = requirements_path {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually what's the difference between this block, and the one above? They both pip install.

hasher: &mut ContentHasher,
_hasher_config: &HasherConfig,
) -> miette::Result<()> {
if let Some(python_version) = &self.config.version {
Copy link
Collaborator

@milesj milesj Nov 12, 2024

Choose a reason for hiding this comment

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

We should probably still hash the dependencies, even if no version is configured.

hasher: &mut ContentHasher,
_hasher_config: &HasherConfig,
) -> miette::Result<()> {
if let Some(python_version) = &self.config.version {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here.

@milesj
Copy link
Collaborator

milesj commented Nov 12, 2024

@harlequin Awesome work, just left a few more comments/questions.

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

Successfully merging this pull request may close these issues.

2 participants