Skip to content

feat: Allow uploading packages from files and bytes #2633

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

Merged

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:

@ernestask ernestask force-pushed the wip/ernestask/package-upload-bytes branch 2 times, most recently from 4f8a948 to a2beef3 Compare August 3, 2023 08:57
@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 ernestask force-pushed the wip/ernestask/package-upload-bytes branch 3 times, most recently from 62df3cc to 21855e7 Compare August 3, 2023 12:44
@JohnVillalovos JohnVillalovos force-pushed the wip/ernestask/package-upload-bytes branch from 21855e7 to 7edb1f4 Compare August 19, 2023 06:32
@ernestask ernestask force-pushed the wip/ernestask/package-upload-bytes branch from 7edb1f4 to e8fa2f8 Compare August 21, 2023 06:24
@ernestask ernestask force-pushed the wip/ernestask/package-upload-bytes branch from e8fa2f8 to 34cd932 Compare August 30, 2023 07:03
@ernestask ernestask force-pushed the wip/ernestask/package-upload-bytes branch from 34cd932 to c84874e Compare September 11, 2023 10:21
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 nejch force-pushed the wip/ernestask/package-upload-bytes branch from 6951326 to 60553be Compare October 12, 2023 15:02
@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