-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update py-rattler readme (#715)
- Loading branch information
1 parent
1ab3639
commit 2475096
Showing
7 changed files
with
67 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import asyncio | ||
import tempfile | ||
|
||
from rattler import solve, install, VirtualPackage | ||
|
||
|
||
async def main() -> None: | ||
# Start by solving the environment. | ||
# | ||
# Solving is the process of going from specifications of package and their | ||
# version requirements to a list of concrete packages. | ||
print("started solving the environment") | ||
solved_records = await solve( | ||
# Channels to use for solving | ||
channels=["conda-forge"], | ||
# The specs to solve for | ||
specs=["python ~=3.12.0", "pip", "requests 2.31.0"], | ||
# Virtual packages define the specifications of the environment | ||
virtual_packages=VirtualPackage.current(), | ||
) | ||
print("solved required dependencies") | ||
|
||
# Install the packages into a new environment (or updates it if it already | ||
# existed). | ||
env_path = tempfile.mkdtemp() | ||
await install( | ||
records=solved_records, | ||
target_prefix=env_path, | ||
) | ||
|
||
print(f"created environment: {env_path}") | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters