Skip to content

Commit

Permalink
Release 2.4.0 (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
dholth authored Oct 9, 2024
1 parent e8365d1 commit 3a25ae4
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 148 deletions.
10 changes: 5 additions & 5 deletions .authors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
github: dbast
- name: Conda Bot
email: [email protected]
num_commits: 32
num_commits: 39
first_commit: 2022-01-17 20:22:29
github: conda-bot
aliases:
Expand All @@ -86,7 +86,7 @@
first_commit: 2022-02-17 10:23:53
- name: Daniel Holth
email: [email protected]
num_commits: 26
num_commits: 31
first_commit: 2021-08-20 21:11:50
github: dholth
- name: Vadim Zayakin
Expand All @@ -102,7 +102,7 @@
first_commit: 2022-02-09 01:00:38
- name: Jannis Leidel
email: [email protected]
num_commits: 9
num_commits: 10
first_commit: 2021-09-17 21:51:27
github: jezdez
- name: Tobias "Tobi" Koch
Expand All @@ -122,7 +122,7 @@
- name: pre-commit-ci[bot]
email: 66853113+pre-commit-ci[bot]@users.noreply.github.com
github: pre-commit-ci[bot]
num_commits: 14
num_commits: 17
first_commit: 2023-01-20 04:55:56
- name: Justin Wood (Callek)
email: [email protected]
Expand All @@ -131,6 +131,6 @@
github: callek
- name: jaimergp
email: [email protected]
num_commits: 2
num_commits: 4
first_commit: 2024-04-02 13:11:21
github: jaimergp
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
[//]: # (current developments)

## 2.4.0 (2024-10-08)

### Enhancements

* Expose API and CLI for which components will be listed as part of `cph list`. (#253)
* Allow `cph list` on remote `.conda` artifact URLs. (#252 via #254)

### Bug fixes

* Use force_zip64=True when directly creating .conda files. Allows >2GB
(compressed) size. (#248)
* Replace `.conda` or `.tar.bz2` extensions from end of string only instead of
`str.replace(...)` (#251)

### Other

* Improve type annotations on an internal function (#257)

### Contributors

* @conda-bot
* @dholth
* @jezdez
* @jaimergp
* @pre-commit-ci[bot]



## 2.3.0 (2024-06-05)

### Enhancements
Expand Down
1 change: 0 additions & 1 deletion conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ test:
- pytest
- pytest-cov
- pytest-mock
- pytest-xprocess
imports:
- conda_package_handling
- conda_package_handling.api
Expand Down
20 changes: 0 additions & 20 deletions news/248-use-zip64

This file was deleted.

20 changes: 0 additions & 20 deletions news/251-extension-str-replace

This file was deleted.

19 changes: 0 additions & 19 deletions news/253-components-list

This file was deleted.

19 changes: 0 additions & 19 deletions news/254-list-remote

This file was deleted.

19 changes: 0 additions & 19 deletions news/improve-typing

This file was deleted.

8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
"myst-parser",
"mdit-py-plugins>=0.3.0",
],
"test": ["mock", "pytest", "pytest-cov", "pytest-mock", "pytest-xprocess", "bottle"],
"test": [
"mock",
"pytest",
"pytest-cov",
"pytest-mock",
"bottle",
],
},
)
2 changes: 1 addition & 1 deletion src/conda_package_handling/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.3.0"
__version__ = "2.4.0"
9 changes: 6 additions & 3 deletions src/conda_package_handling/conda_fmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,12 @@ def tell(self):
pkg_metadata = {"conda_pkg_format_version": CONDA_PACKAGE_FORMAT_VERSION}
conda_file.writestr("metadata.json", json.dumps(pkg_metadata))

components_files = (f"pkg-{file_id}.tar.zst", pkg_files), (
f"info-{file_id}.tar.zst",
info_files,
components_files = (
(f"pkg-{file_id}.tar.zst", pkg_files),
(
f"info-{file_id}.tar.zst",
info_files,
),
)

# put the info last, for parity with updated transmute.
Expand Down
90 changes: 51 additions & 39 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
from __future__ import annotations

import os
import shutil
import sys
import threading
import typing
import wsgiref.simple_server
from pathlib import Path
from textwrap import dedent
from typing import Any

import bottle
import pytest
from xprocess import ProcessStarter

if typing.TYPE_CHECKING:
import wsgiref.types # added in 3.11


@pytest.fixture(scope="function")
Expand Down Expand Up @@ -36,40 +43,45 @@ def return_to_saved_path():
return str(tmpdir)


datadir = Path(__file__).parent / "data"


@bottle.route("/<filename>", "GET")
def serve_file(filename):
mimetype = "auto"
# from https://repo.anaconda.com/ behavior:
if filename.endswith(".tar.bz2"):
mimetype = "application/x-tar"
elif filename.endswith(".conda"):
mimetype = "binary/octet-stream"
return bottle.static_file(filename, root=datadir.as_posix(), mimetype=mimetype)


class ServerThread(threading.Thread):
server: Any
app: Any


def get_server_thread():
"""
Return test server thread with additional .server, .app properties.
Call .start() to serve in the background.
"""
app: wsgiref.types.WSGIApplication = bottle.app()
server = wsgiref.simple_server.make_server("127.0.0.1", 0, app)
t = ServerThread(daemon=True, target=server.serve_forever)
t.app = app
t.server = server # server.application == app
return t


@pytest.fixture(scope="session")
def localserver(xprocess):
port = 8000
datadir = Path(__file__).parent / "data"

class Starter(ProcessStarter):
pattern = "Hit Ctrl-C to quit."
terminate_on_interrupt = True
timeout = 10
args = [
sys.executable,
"-u", # unbuffered
"-c",
# Adapted from conda-package-streaming/tests/server.py
dedent(
f"""
from bottle import route, run, static_file
@route("/<filename>", "GET")
def serve_file(filename):
mimetype = "auto"
# from https://repo.anaconda.com/ behavior:
if filename.endswith(".tar.bz2"):
mimetype = "application/x-tar"
elif filename.endswith(".conda"):
mimetype = "binary/octet-stream"
return static_file(filename, root="{datadir.as_posix()}", mimetype=mimetype)
run(port={port})
"""
),
]

pid, logfile = xprocess.ensure("bottle.server", Starter)
print("Logfile at", str(logfile))
yield f"http://localhost:{port}"
xprocess.getinfo("bottle.server").terminate()
def localserver():
thread = get_server_thread()
thread.start()
yield f"http://{thread.server.server_address[0]}:{thread.server.server_address[1]}"


if __name__ == "__main__":
bottle.run(port=8080)
6 changes: 5 additions & 1 deletion tests/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,9 @@ def test_extract_create(tmpdir):

with pytest.raises(ValueError):
CondaFormat_v2.create(
"", [], "", compressor=True, compression_tuple=("1", "2", "3") # type: ignore
"",
[],
"",
compressor=True,
compression_tuple=("1", "2", "3"), # type: ignore
)

0 comments on commit 3a25ae4

Please sign in to comment.