Skip to content
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
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
poetry-version: ["1.1.14"]
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
poetry-version: ["1.7.1"]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand All @@ -28,9 +28,9 @@ jobs:
- name: Install dev dependencies
run: poetry install
- name: Run linting
run: poetry run black githublfs.py --check
run: poetry run black githublfs --check
- name: Run type checking
run: poetry run mypy githublfs.py --install-types --non-interactive
run: poetry run mypy githublfs --install-types --non-interactive --ignore-missing-imports
- name: Run tests
run: poetry run pytest
push-to-pypi:
Expand All @@ -42,11 +42,11 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8.10
python-version: 3.12.0
- name: Run image
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.1.14
poetry-version: 1.7.1
- name: Install
run: poetry install
- name: Build
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
File renamed without changes.
876 changes: 406 additions & 470 deletions poetry.lock

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
[tool.poetry]
name = "githublfs"
version = "0.1.3"
version = "0.2.0"
description = "Simple library to commit lfs files to Github repos"
license = "MIT"
authors = ["Anès Foufa <anes.foufa@upply.com>"]
readme = "readme.rst"
classifiers = [
"Topic :: Software Development :: Version Control",
"Topic :: Software Development :: Version Control :: Git",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
keywords = [
"Github",
Expand All @@ -20,17 +22,18 @@ keywords = [
homepage = "https://github.com/AnesFoufa/githublfs"

[tool.poetry.dependencies]
python = "^3.7"
python = "^3.8"
PyGithub = "^1.55"
requests = "^2.28.1"

[tool.poetry.dev-dependencies]
mypy = "^0.971"
mypy = "^1.10"
black = "^22.6.0"
twine = "^4.0.1"
requests-mock = "^1.9.3"
pytest = "^7.1.2"


[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
10 changes: 7 additions & 3 deletions readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Usage
content=b"binary file content",
message="my commit message")

To authenticate, an access token with repo scope is neede. See: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
To authenticate, an access token with repo scope is needed. See: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token

Dependencies
------------
* python = "^3.7"
* Python >= 3.8
* PyGithub = "^1.55"
* requests = "^2.28.1"

Expand All @@ -33,4 +33,8 @@ This library uses LFS' Basic Transfer API. See https://github.com/git-lfs/git-lf

Production warning
------------------
This library is still experimental. If you use it in production, please pin the exact version in your requirements, including the minor number.
This library is still experimental. If you use it in production, please pin the exact version in your requirements, including the minor number.

License
-------
This project is distributed under the MIT license. See the `LICENSE` file for details.
8 changes: 4 additions & 4 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def test_upload_file_to_lfs_server_should_have_correct_request(
assert m.called_once
last_request = m.last_request
request_headers = last_request.headers
for (key, value) in upload_url_headers.headers.items():
for key, value in upload_url_headers.headers.items():
assert request_headers[key] == value
assert request_headers["Content-Type"] == "application/octet-stream"
assert last_request.body == content
Expand Down Expand Up @@ -393,7 +393,7 @@ def test_verify_file_uploaded_should_request_with_correct_headers_and_body(
assert m.called_once
last_request = m.last_request
request_headers = last_request.headers
for (key, value) in verify_url_headers.headers.items():
for key, value in verify_url_headers.headers.items():
assert request_headers[key] == value
assert request_headers["Content-Type"] == "application/vnd.git-lfs+json"
expected_request_body = f"oid={file_data.digest}&size={file_data.size}"
Expand All @@ -415,7 +415,7 @@ def test_commit_file_should_create_file_if_not_exists(
gh_repo=gh_repo, branch=branch, content=content, message=message, path=path
)

assert fake_github_class.called_with(gh_repo.token)
fake_github_class.assert_called_with(gh_repo.token)
fake_github.assert_called_with(gh_repo.name)
fake_repository.create_file.assert_called_once_with(
branch=branch, content=content, message=message, path=path
Expand All @@ -441,7 +441,7 @@ def test_commit_file_should_update_files_if_exist(
gh_repo=gh_repo, branch=branch, content=content, message=message, path=path
)

assert fake_github_class.called_with(gh_repo.token)
fake_github_class.assert_called_with(gh_repo.token)
fake_github.assert_called_with(gh_repo.name)
for gh_content in gh_contents:
fake_repository.update_file.assert_any_call(
Expand Down
Loading