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

add fetch repo data to py-rattler #334

Merged
merged 24 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2197fca
feat: add py_fetch_repo_data
tarunps Sep 11, 2023
28a3e60
refactor: fetch_repo_data takes pathbuf instead of path reference
tarunps Sep 12, 2023
2f98fbc
fix: add cache_path param in py_fetch_repo_data
tarunps Sep 12, 2023
1b7c6ce
fix: py_fetch_repo_data returns RepoData
tarunps Sep 12, 2023
b9bd8f9
fix: py_fetch_repo_data returns a list of PyRepoData
tarunps Sep 12, 2023
03f6ba2
fix: expose repo_data types
tarunps Sep 12, 2023
ff3bd0d
feat: add fetch_repo_data and types
tarunps Sep 12, 2023
4e9cdc9
fix: into_repo_data returns List[RepoDataRecord]
tarunps Sep 12, 2023
a5efaa2
fix: change cache_path to pathbuf
tarunps Sep 13, 2023
20c4d2b
test: fix fetch_repo_data tests
tarunps Sep 15, 2023
57374fa
doc: fix example
tarunps Sep 15, 2023
93e210b
test: add fetch repo data test
tarunps Sep 25, 2023
4a4920d
Merge branch 'main' into feat/py-rattler-add-fetch-repo-data
tarunps Sep 25, 2023
7a61ee1
doc: fix docs
tarunps Sep 25, 2023
18eae4e
fix: make fetch_repo_data test async
tarunps Sep 25, 2023
036bd82
fix: use a different port
baszalmstra Sep 25, 2023
343832d
fix: use absolute paths for reposerver
baszalmstra Sep 25, 2023
9200e58
fix: use lfs in ci
baszalmstra Sep 25, 2023
d8875a0
test: move reposerver in its own dir & add README
tarunps Sep 26, 2023
68a62b2
test: fix test
tarunps Sep 26, 2023
5d0256f
fix: formatting
tarunps Sep 26, 2023
9b07869
test: add test-server license
tarunps Sep 26, 2023
bb848cd
fix: typo
tarunps Sep 26, 2023
d4a30ac
Merge branch 'main' into feat/py-rattler-add-fetch-repo-data
baszalmstra Sep 26, 2023
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
1 change: 1 addition & 0 deletions .github/workflows/python-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
lfs: true
- run: |
curl -fsSL https://pixi.sh/install.sh | bash
echo "/home/runner/.pixi/bin" >> $GITHUB_PATH
Expand Down
2 changes: 1 addition & 1 deletion crates/rattler-bin/src/commands/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ async fn fetch_repo_data_records_with_progress(
let result = rattler_repodata_gateway::fetch::fetch_repo_data(
channel.platform_url(platform),
client,
repodata_cache,
repodata_cache.to_path_buf(),
FetchRepoDataOptions::default(),
Some(Box::new(move |DownloadProgress { total, bytes }| {
download_progress_progress_bar.set_length(total.unwrap_or(bytes));
Expand Down
28 changes: 14 additions & 14 deletions crates/rattler_repodata_gateway/src/fetch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ async fn repodata_from_file(
pub async fn fetch_repo_data(
subdir_url: Url,
client: AuthenticatedClient,
cache_path: &Path,
cache_path: PathBuf,
options: FetchRepoDataOptions,
progress: Option<ProgressFunc>,
) -> Result<CachedRepoData, FetchRepoDataError> {
Expand Down Expand Up @@ -321,7 +321,7 @@ pub async fn fetch_repo_data(
// Validate the current state of the cache
let cache_state = if cache_action != CacheAction::NoCache {
let owned_subdir_url = subdir_url.clone();
let owned_cache_path = cache_path.to_owned();
let owned_cache_path = cache_path.clone();
let owned_cache_key = cache_key.clone();
let cache_state = tokio::task::spawn_blocking(move || {
validate_cached_state(&owned_cache_path, &owned_subdir_url, &owned_cache_key)
Expand Down Expand Up @@ -530,7 +530,7 @@ pub async fn fetch_repo_data(
} else {
Encoding::Passthrough
},
cache_path,
&cache_path,
progress,
)
.await?;
Expand Down Expand Up @@ -1114,7 +1114,7 @@ mod test {
let result = fetch_repo_data(
server.url(),
AuthenticatedClient::default(),
cache_dir.path(),
cache_dir.into_path(),
Default::default(),
None,
)
Expand Down Expand Up @@ -1144,7 +1144,7 @@ mod test {
let CachedRepoData { cache_result, .. } = fetch_repo_data(
server.url(),
AuthenticatedClient::default(),
cache_dir.path(),
cache_dir.path().to_owned(),
Default::default(),
None,
)
Expand All @@ -1157,7 +1157,7 @@ mod test {
let CachedRepoData { cache_result, .. } = fetch_repo_data(
server.url(),
AuthenticatedClient::default(),
cache_dir.path(),
cache_dir.path().to_owned(),
Default::default(),
None,
)
Expand All @@ -1181,7 +1181,7 @@ mod test {
let CachedRepoData { cache_result, .. } = fetch_repo_data(
server.url(),
AuthenticatedClient::default(),
cache_dir.path(),
cache_dir.into_path(),
Default::default(),
None,
)
Expand Down Expand Up @@ -1210,7 +1210,7 @@ mod test {
let result = fetch_repo_data(
server.url(),
AuthenticatedClient::default(),
cache_dir.path(),
cache_dir.into_path(),
Default::default(),
None,
)
Expand Down Expand Up @@ -1252,7 +1252,7 @@ mod test {
let result = fetch_repo_data(
server.url(),
AuthenticatedClient::default(),
cache_dir.path(),
cache_dir.into_path(),
Default::default(),
None,
)
Expand Down Expand Up @@ -1301,7 +1301,7 @@ mod test {
let result = fetch_repo_data(
server.url(),
AuthenticatedClient::default(),
cache_dir.path(),
cache_dir.into_path(),
Default::default(),
None,
)
Expand Down Expand Up @@ -1354,7 +1354,7 @@ mod test {
let result = fetch_repo_data(
server.url(),
authenticated_client,
cache_dir.path(),
cache_dir.into_path(),
Default::default(),
None,
)
Expand Down Expand Up @@ -1387,7 +1387,7 @@ mod test {
let _result = fetch_repo_data(
server.url(),
AuthenticatedClient::default(),
cache_dir.path(),
cache_dir.into_path(),
FetchRepoDataOptions {
..Default::default()
},
Expand All @@ -1412,7 +1412,7 @@ mod test {
Url::parse(format!("file://{}", subdir_path.path().to_str().unwrap()).as_str())
.unwrap(),
AuthenticatedClient::default(),
cache_dir.path(),
cache_dir.into_path(),
FetchRepoDataOptions {
..Default::default()
},
Expand All @@ -1436,7 +1436,7 @@ mod test {
let result = fetch_repo_data(
server.url(),
AuthenticatedClient::default(),
cache_dir.path(),
cache_dir.into_path(),
FetchRepoDataOptions {
..Default::default()
},
Expand Down
4 changes: 2 additions & 2 deletions crates/rattler_repodata_gateway/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//! using the [`fetch::fetch_repo_data`] function:
//!
//! ```no_run
//! use std::{path::Path, default::Default};
//! use std::{path::PathBuf, default::Default};
//! use rattler_networking::AuthenticatedClient;
//! use url::Url;
//! use rattler_repodata_gateway::fetch;
Expand All @@ -35,7 +35,7 @@
//! async fn main() {
//! let repodata_url = Url::parse("https://conda.anaconda.org/conda-forge/osx-64/").unwrap();
//! let client = AuthenticatedClient::default();
//! let cache = Path::new("./cache");
//! let cache = PathBuf::from("./cache");
//!
//! let result = fetch::fetch_repo_data(
//! repodata_url,
Expand Down
Loading