Skip to content

Commit

Permalink
Ensure to run on Python 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
led02 committed Aug 2, 2024
1 parent f488c0f commit d64fc73
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: "3.12"
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/zenodo-sandbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '3.12'
python-version: '3.10'
- run: pip install .
- run: git archive --format zip HEAD src > hermes-plugin-python.zip
- run: hermes harvest
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ version = "0.1.8"
readme = "README.md"
description = "HERMES plugin for .toml files"
keywords = [ "publishing", "metadata", "automation",]
requires-python = ">= 3.12.4"
requires-python = ">= 3.8"
classifiers = [ "Development Status :: 2 - Pre-Alpha", "Environment :: Plugins", "Programming Language :: Python :: 3", "Operating System :: OS Independent",]
dependencies = [ "hermes>=0.8.0",]
[[project.authors]]
Expand Down
16 changes: 11 additions & 5 deletions src/hermes_toml/harvest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

"""A hermes harvest plugin that harvests the .toml file of the project"""

from contextlib import chdir
from os import chdir, getcwd
from email.utils import getaddresses

import toml
Expand All @@ -28,7 +28,7 @@ class TomlHarvestPlugin(HermesHarvestPlugin):
"project": [
("name", "name"), ("version", "version"), ("description", "description"),
("runtimePlatform", "requires-python"), ("author", "authors"),
("maintainer", "maintainers"), ("keywords", "keywords")
("maintainer", "maintainers"), ("keywords", "keywords"), ("license", "license")
],
"poetry": [
("name", "name"), ("version", "version"), ("description", "description"),
Expand All @@ -42,9 +42,13 @@ def __call__(self, command: HermesHarvestCommand):
"""start of the process of harvesting the .toml file"""

#set the working directory temporary to the correct location
with chdir(command.args.path):
#harvesting the data from the .toml file specified in the Settings class
data = self.read_from_toml(command.settings.toml.filename)
old_dir = getcwd()
chdir(command.args.path)

#harvesting the data from the .toml file specified in the Settings class
data = self.read_from_toml(command.settings.toml.filename)

chdir(old_dir)

#returning the harvested data and some metadata
return data, {"filename": command.settings.toml.filename}
Expand Down Expand Up @@ -107,6 +111,8 @@ def read_from_one_table(cls, table, mapping):
if not persons is None:
ret_data[field1] = persons

elif field1 == "license":
ret_data[field1] = table[field2].get("text", None)
else:
#add the data of a field that needs no processing
ret_data[field1] = table[field2]
Expand Down

0 comments on commit d64fc73

Please sign in to comment.