From 98a82142ec75cfaf9fa56950c5b6bdcbadeb019b Mon Sep 17 00:00:00 2001 From: Emil Hjelm Date: Fri, 19 Dec 2025 14:17:38 +0100 Subject: [PATCH 1/7] Updated versions --- .readthedocs.yml | 2 +- .travis.yml | 10 ++++++---- dev_requirements.txt | 6 +++--- requirements.txt | 2 +- setup.py | 1 - 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 07fa686..8d2f770 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -9,6 +9,6 @@ sphinx: configuration: doc/conf.py python: - version: 3.7 + version: 3.14 install: - requirements: dev_requirements.txt diff --git a/.travis.yml b/.travis.yml index 11b18c1..5f027c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,12 @@ language: python python: - - "3.5" - - "3.6" - - "3.7" - - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - "3.13" + - "3.14" install: - pip install -r dev_requirements.txt diff --git a/dev_requirements.txt b/dev_requirements.txt index c0b1096..9208718 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -2,9 +2,9 @@ coverage pylint pylint_runner pytest -sphinx==1.8.5 -sphinx_rtd_theme==0.4.3 -sphinxcontrib-napoleon==0.7 +sphinx +sphinx_rtd_theme +sphinxcontrib-napoleon tbump wheel -r requirements.txt diff --git a/requirements.txt b/requirements.txt index 2d5d47b..f229360 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -requests~=2.5 +requests diff --git a/setup.py b/setup.py index ba27c2a..f3e8bd0 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,6 @@ author_email='emil.hjelm@climeon.com', url='https://github.com/afcmrp/python-mfiles', keywords=['M-Files', 'mfiles', 'REST', 'API'], - python_requires='!=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', install_requires=[ 'requests', ], From 5b6998cbf82cf1f0cb93323857c7dfe7f66d126c Mon Sep 17 00:00:00 2001 From: Emil Hjelm Date: Fri, 19 Dec 2025 14:28:27 +0100 Subject: [PATCH 2/7] Update venv location --- .gitignore | 2 +- .pylintrc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 343ba19..fc1ad26 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ __pycache__/ htmlcov/ dist/ mfiles.egg-info/ -.env/ +.venv/ # Generated documents doc/*/ diff --git a/.pylintrc b/.pylintrc index 567ed3a..4cd1696 100644 --- a/.pylintrc +++ b/.pylintrc @@ -2,7 +2,7 @@ # Add files or directories to the blacklist. They should be base names, not # paths. -ignore=examples,.env +ignore=examples,.venv # Use multiple processes to speed up Pylint. jobs=4 From fb47b4b5ce3dc0623df2020cd8d65c26b2f6b986 Mon Sep 17 00:00:00 2001 From: Emil Hjelm Date: Fri, 19 Dec 2025 14:32:51 +0100 Subject: [PATCH 3/7] Update CI service --- .github/workflows/test.yml | 33 +++++++++++++++++++++++++++++++++ .travis.yml | 17 ----------------- 2 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a87c1ee --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,33 @@ +name: Test + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.14 + uses: actions/setup-python@v3 + with: + python-version: "3.14" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r dev_requirements.txt + - name: Lint + run: | + pylint . --recursive=y + - name: Test + run: | + python -m coverage run -m pytest + python -m coverage report diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5f027c1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: python - -python: - - "3.9" - - "3.10" - - "3.11" - - "3.12" - - "3.13" - - "3.14" - -install: - - pip install -r dev_requirements.txt - -script: - - pylint_runner - - python -m coverage run -m pytest - - python -m coverage report From dddb4bc6c76585e26178040921e6b9202e7d1fb1 Mon Sep 17 00:00:00 2001 From: Emil Hjelm Date: Fri, 19 Dec 2025 14:35:22 +0100 Subject: [PATCH 4/7] Better handling of PUT requests --- mfiles/client.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mfiles/client.py b/mfiles/client.py index b104027..c7f73bc 100644 --- a/mfiles/client.py +++ b/mfiles/client.py @@ -140,8 +140,8 @@ def put(self, endpoint, data=None): """ if endpoint[0] == "/": endpoint = endpoint[1:] - request_url = self.server + endpoint - response = self.session.put(request_url, headers=self.headers, data=data) + request_url = self.server + endpoint + "?_method=PUT" + response = self.session.post(request_url, headers=self.headers, data=data) if response.status_code != 200: raise MFilesException(response.text) return response.json() @@ -404,14 +404,14 @@ def create_object(self, name, object_type=0, object_class=0, endpoint = "objects/%s" % object_type return self.post(endpoint, data) - def check_out(self, object_id, object_type=0): + def check_out(self, object_id, object_version="latest", object_type=0): """Check out an object from M-Files.""" data = json.dumps({"Value": "2"}) # Checked out by me - endpoint = "objects/%s/%s/latest/checkedout" % \ - (object_type, object_id) + endpoint = "objects/%s/%s/%s/checkedout" % \ + (object_type, object_id, object_version) return self.put(endpoint, data) - def check_in(self, object_id, object_version, object_type=0): + def check_in(self, object_id, object_version="latest", object_type=0): """Check in an object to M-Files.""" data = json.dumps({"Value": "0"}) # Checked in endpoint = "objects/%s/%s/%s/checkedout" % \ From 23d82b5ba133640f8fbb4c99452e55507beaa365 Mon Sep 17 00:00:00 2001 From: Emil Hjelm Date: Fri, 19 Dec 2025 14:38:21 +0100 Subject: [PATCH 5/7] Lint fixes --- .github/workflows/test.yml | 4 ++-- .pylintrc | 3 +++ dev_requirements.txt | 1 + mfiles/client.py | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a87c1ee..5670ca4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,13 +10,13 @@ permissions: contents: read jobs: - build: + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python 3.14 + - name: Set up Python uses: actions/setup-python@v3 with: python-version: "3.14" diff --git a/.pylintrc b/.pylintrc index 4cd1696..bf91946 100644 --- a/.pylintrc +++ b/.pylintrc @@ -6,3 +6,6 @@ ignore=examples,.venv # Use multiple processes to speed up Pylint. jobs=4 + +# Disabled errors +disable=consider-using-f-string diff --git a/dev_requirements.txt b/dev_requirements.txt index 9208718..adbede0 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -2,6 +2,7 @@ coverage pylint pylint_runner pytest +setuptools sphinx sphinx_rtd_theme sphinxcontrib-napoleon diff --git a/mfiles/client.py b/mfiles/client.py index c7f73bc..081e857 100644 --- a/mfiles/client.py +++ b/mfiles/client.py @@ -381,7 +381,7 @@ def create_object(self, name, object_type=0, object_class=0, Returns: dict: Dictionary with object information. """ - # pylint: disable=too-many-arguments + # pylint: disable=too-many-arguments,too-many-positional-arguments extra_info = extra_info or {} file_info = file_info or [] if isinstance(object_type, str): @@ -476,7 +476,7 @@ def download_file(self, local_path, object_type, object_id, file_id, Returns: bool: True if file is found and downloaded successfully. """ - # pylint: disable=too-many-arguments + # pylint: disable=too-many-arguments,too-many-positional-arguments request_url = "%sobjects/%s/%s/%s/files/%s/content" % \ (self.server, object_type, object_id, object_version, file_id) response = self.session.get(request_url, headers=self.headers) From d8eb62bd0ba815ceebfc2cb5f9abd97a90529bd3 Mon Sep 17 00:00:00 2001 From: Emil Hjelm Date: Fri, 19 Dec 2025 14:46:50 +0100 Subject: [PATCH 6/7] Update readthedocs config --- .readthedocs.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 8d2f770..187faf4 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,14 +1,16 @@ # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details -# Required version: 2 -# Build documentation in the docs/ directory with Sphinx -sphinx: - configuration: doc/conf.py +build: + os: "ubuntu-24.04" + tools: + python: "3.12" python: - version: 3.14 install: - - requirements: dev_requirements.txt + - requirements: docs/requirements.txt + +sphinx: + configuration: doc/conf.py From 6dfedb4bf951d813f35bac34b69f63a68ff98389 Mon Sep 17 00:00:00 2001 From: Emil Hjelm Date: Fri, 19 Dec 2025 14:49:50 +0100 Subject: [PATCH 7/7] Bump to 0.5.4 --- setup.py | 2 +- tbump.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index f3e8bd0..95eaa2c 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( name='mfiles', packages=find_packages(), - version='0.5.3', + version='0.5.4', license='MIT', description='M-Files API wrapper', long_description=PYPI_DESCRIPTION, diff --git a/tbump.toml b/tbump.toml index eab1840..a7346a3 100644 --- a/tbump.toml +++ b/tbump.toml @@ -1,5 +1,5 @@ [version] -current = "0.5.3" +current = "0.5.4" # Example of a semver regexp. # Make sure this matches current_version before