Skip to content

Commit

Permalink
Add Python 3.11 to tests and support Pandas 2 (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored Aug 28, 2023
1 parent 653b710 commit a502bdb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11']
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions holonote/annotate/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def delete_annotation(self, index):

def update_annotation_fields(self, index, **fields):
for column, value in fields.items():
self._field_df.loc[index][column] = value
self._field_df.loc[index, column] = value

self._edits.append({'operation':'update', 'id':index,
'fields' : [c for c in fields.keys()],
Expand Down Expand Up @@ -303,7 +303,7 @@ def define_points(self, dims, posx, posy=None):
raise KeyError(f'Keys {mismatches} do not match any fields entries')

dim2 = None if len(dims)==1 else dims[1]
value = zip(posx, pd.Series([None for el in range(len(posx))])) if len(dims)==1 else zip(posx, posy)
value = zip(posx, [None] * len(posx)) if len(dims)==1 else zip(posx, posy)
additions = pd.DataFrame({"region_type":'Point',
"dim1":dims[0],
"dim2":dim2,
Expand Down
12 changes: 7 additions & 5 deletions holonote/tests/test_connectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_add_row(self, database, request):
end = pd.Timestamp('2022-06-03')
description = 'A description'
insertion = {"uuid": id1, 'description':description, 'start':start, 'end':end}
df = pd.DataFrame({"uuid":pd.Series([id1], dtype=object),
df = pd.DataFrame({"uuid":[database.primary_key.cast(id1)],
'description':[description], 'start':[start], 'end':[end]}).set_index("uuid")
database.add_row(**insertion)
pd.testing.assert_frame_equal(database.load_dataframe(), df)
Expand All @@ -102,10 +102,12 @@ def test_add_three_rows_delete_one(self, database):
'start':pd.Timestamp('2026-06-01'),
'end':pd.Timestamp('2026-06-03')}

df_data = {'uuid': pd.Series([insertion1['uuid'], insertion3['uuid']], dtype=object),
'description':[insertion1['description'], insertion3['description']],
'start':[insertion1['start'], insertion3['start']],
'end':[insertion1['end'], insertion3['end']]}
df_data = {
'uuid': map(database.primary_key.cast, [insertion1['uuid'], insertion3['uuid']]),
'description':[insertion1['description'], insertion3['description']],
'start':[insertion1['start'], insertion3['start']],
'end':[insertion1['end'], insertion3['end']]
}
df = pd.DataFrame(df_data).set_index('uuid')
database.add_row(**insertion1)
database.add_row(**insertion2)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Operating System :: OS Independent",
]
dependencies = ["holoviews", "pandas<2"]
dependencies = ["holoviews", "pandas"]

[tool.hatch.version]
source = "vcs"

[tool.hatch.envs.test]
dependencies = ["pytest"]
scripts.run = "python -m pytest holonote/tests"
matrix = [{ python = ["3.8", "3.9", "3.10"] }]
matrix = [{ python = ["3.8", "3.9", "3.10", "3.11"] }]

[tool.hatch.envs.fmt]
dependencies = ["pre-commit"]
Expand Down

0 comments on commit a502bdb

Please sign in to comment.