X Tutup
Skip to content

feat: Allow uploading packages from files and bytes#2633

Merged
nejch merged 2 commits intopython-gitlab:mainfrom
ernestask:wip/ernestask/package-upload-bytes
Oct 12, 2023
Merged

feat: Allow uploading packages from files and bytes#2633
nejch merged 2 commits intopython-gitlab:mainfrom
ernestask:wip/ernestask/package-upload-bytes

Conversation

@ernestask
Copy link
Contributor

Changes

This commit adds a keyword argument to GenericPackageManager.upload() to allow uploading bytes and file-like objects to the generic package registry. That necessitates changing file path to be a keyword argument as well, which then cascades into a whole slew of checks to not allow passing both and to not allow uploading file-like objects as JSON data.

Closes #1815

Documentation and testing

Please consider whether this PR needs documentation and tests. This is not required, but highly appreciated:

@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Merging #2633 (34cd932) into main (6ce2149) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2633      +/-   ##
==========================================
+ Coverage   96.35%   96.39%   +0.03%     
==========================================
  Files          87       87              
  Lines        5656     5662       +6     
==========================================
+ Hits         5450     5458       +8     
+ Misses        206      204       -2     
Flag Coverage Δ
api_func_v4 82.70% <71.42%> (-0.02%) ⬇️
cli_func_v4 83.16% <71.42%> (-0.02%) ⬇️
unit 88.04% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
gitlab/_backends/requests_backend.py 98.36% <100.00%> (ø)
gitlab/client.py 98.76% <100.00%> (ø)
gitlab/v4/objects/packages.py 100.00% <100.00%> (+3.50%) ⬆️

ernestask and others added 2 commits October 12, 2023 17:02
This commit adds a keyword argument to GenericPackageManager.upload() to
allow uploading bytes and file-like objects to the generic package
registry. That necessitates changing file path to be a keyword argument
as well, which then cascades into a whole slew of checks to not allow
passing both and to not allow uploading file-like objects as JSON data.

Closes #1815
@nejch
Copy link
Member

nejch commented Oct 12, 2023

Thanks @ernestask and sorry to keep you waiting, I pushed a small commit to fix test names so it's not blocking you any longer. We could probably document this a bit as well, but not urgent.

@nejch nejch enabled auto-merge (rebase) October 12, 2023 15:07
@ernestask
Copy link
Contributor Author

Memory fails me now, but I did want to write some docs. Something stopped me, though… Probably just wasn’t sure where and what to put.

@nejch nejch merged commit f1654b8 into python-gitlab:main Oct 12, 2023
@ernestask ernestask deleted the wip/ernestask/package-upload-bytes branch October 12, 2023 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow upload generic package from bytes

2 participants

X Tutup