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

feat: expose upload commands for Python bindings #1371

Merged
merged 3 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 29 additions & 27 deletions py-rattler-build/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions py-rattler-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ tokio = { version = "1.43.0", features = [
] }
rattler_conda_types = "0.29.10"
clap = "4.5.27"
url = "2.5.4"

# pyo3-async-runtimes = { version = "0.23.0", features = ["tokio-runtime"] }

Expand Down
99 changes: 90 additions & 9 deletions py-rattler-build/rattler_build/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
from .rattler_build import get_rattler_build_version_py, build_recipes_py, test_py
from .rattler_build import (
get_rattler_build_version_py,
build_recipes_py,
test_package_py,
upload_package_to_quetz_py,
upload_package_to_artifactory_py,
upload_package_to_prefix_py,
upload_package_to_anaconda_py,
upload_packages_to_conda_forge_py,
)


from pathlib import Path
from typing import List, Union

__all__ = ["rattler_build_version", "build_recipe"]
__all__ = [
"rattler_build_version",
"build_recipe",
"test_package",
"upload_package_to_quetz",
"upload_package_to_artifactory",
"upload_package_to_prefix",
"upload_package_to_anaconda",
"upload_packages_to_conda_forge",
]


def rattler_build_version() -> str:
Expand Down Expand Up @@ -32,9 +52,6 @@ def build_recipes(
skip_existing: Union[str, None] = None,
noarch_build_platform: Union[str, None] = None,
) -> None:
recipes = [str(recipe) for recipe in recipes]
output_dir = output_dir if output_dir is None else str(output_dir)
auth_file = auth_file if auth_file is None else str(auth_file)
build_recipes_py(
recipes,
up_to,
Expand All @@ -60,13 +77,77 @@ def build_recipes(
)


def test(
def test_package(
package_file: Union[str, Path],
channel: Union[List[str], None] = None,
compression_threads: Union[int, None] = None,
auth_file: Union[str, Path, None] = None,
channel_priority: Union[str, None] = None,
) -> None:
package_file = str(package_file)
auth_file = auth_file if auth_file is None else str(auth_file)
test_py(package_file, channel, compression_threads, auth_file, channel_priority)
test_package_py(package_file, channel, compression_threads, auth_file, channel_priority)


def upload_package_to_quetz(
package_files: List[str],
url: str,
channels: str,
api_key: Union[str, None] = None,
auth_file: Union[str, Path, None] = None,
) -> None:
upload_package_to_quetz_py(package_files, url, channels, api_key, auth_file)


def upload_package_to_artifactory(
package_files: List[str],
url: str,
channels: str,
token: Union[str, None] = None,
auth_file: Union[str, Path, None] = None,
) -> None:
upload_package_to_artifactory_py(package_files, url, channels, token, auth_file)


def upload_package_to_prefix(
package_files: List[str],
url: str,
channels: str,
api_key: Union[str, None] = None,
auth_file: Union[str, Path, None] = None,
) -> None:
upload_package_to_prefix_py(package_files, url, channels, api_key, auth_file)


def upload_package_to_anaconda(
package_files: List[str],
owner: str,
channel: Union[List[str], None] = None,
api_key: Union[str, None] = None,
url: Union[str, None] = None,
force: bool = False,
auth_file: Union[str, Path, None] = None,
) -> None:
upload_package_to_anaconda_py(package_files, owner, channel, api_key, url, force, auth_file)


def upload_packages_to_conda_forge(
package_files: List[Union[str, Path]],
staging_token: str,
feedstock: str,
feedstock_token: str,
staging_channel: Union[str, None] = None,
anaconda_url: Union[str, None] = None,
validation_endpoint: Union[str, None] = None,
provider: Union[str, None] = None,
dry_run: bool = False,
) -> None:
upload_packages_to_conda_forge_py(
package_files,
staging_token,
feedstock,
feedstock_token,
staging_channel,
anaconda_url,
validation_endpoint,
provider,
dry_run,
)
Loading
Loading