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

Merged
merged 34 commits into from
Nov 15, 2024

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.

- 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

);
}

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes you are right, even with the next comment (difference first and second pip install)
Therefore I have re-worked the strategy that in before the args will be constructed.

And if these are not empty, only one pip install will be executed.

}
}

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above

@milesj
Copy link
Collaborator

milesj commented Nov 12, 2024

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

@milesj
Copy link
Collaborator

milesj commented Nov 14, 2024

@harlequin Looks good! Just need to fix the conflict.

The docker check can be ignored. I don't think that works in forks.

@milesj milesj merged commit e02b73c into moonrepo:develop-1.30 Nov 15, 2024
26 of 27 checks passed
@milesj
Copy link
Collaborator

milesj commented Nov 15, 2024

Awesome stuff, thanks for all the hard work!!!

milesj added a commit that referenced this pull request Nov 24, 2024
* Save my work

* next iteration

* Latest version

* Run linter

* run pip with install args

* build: Prepare v1.30 release.

* new: Add new workspace builder. (#1697)

* 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.

* Add Tests and re-work based on discussions

* Add documentation

* Resolve conflict

* Save my work

* next iteration

* Latest version

* Run linter

* run pip with install args

* Add Tests and re-work based on discussions

* Add documentation

* new: Add new workspace builder. (#1697)

* 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.

* Add last commit

* Rebase completed

* Revert new language

* Final commit after format, lint and build

* Resolve Issues based on suggestions

- 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

* Execute lint and format

* Fix testing for python areas

* Fix project_config_test

* Resolve latest comments

* Update changelog.md

---------

Co-authored-by: Miles Johnson <mileswjohnson@gmail.com>
Co-authored-by: Miles Johnson <milesj@users.noreply.github.com>
milesj added a commit that referenced this pull request Nov 25, 2024
* Save my work

* next iteration

* Latest version

* Run linter

* run pip with install args

* build: Prepare v1.30 release.

* new: Add new workspace builder. (#1697)

* 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.

* Add Tests and re-work based on discussions

* Add documentation

* Resolve conflict

* Save my work

* next iteration

* Latest version

* Run linter

* run pip with install args

* Add Tests and re-work based on discussions

* Add documentation

* new: Add new workspace builder. (#1697)

* 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.

* Add last commit

* Rebase completed

* Revert new language

* Final commit after format, lint and build

* Resolve Issues based on suggestions

- 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

* Execute lint and format

* Fix testing for python areas

* Fix project_config_test

* Resolve latest comments

* Update changelog.md

---------

Co-authored-by: Miles Johnson <mileswjohnson@gmail.com>
Co-authored-by: Miles Johnson <milesj@users.noreply.github.com>
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