Skip to content

Commit

Permalink
Add 3.12 to version matrix for CI (#131)
Browse files Browse the repository at this point in the history
* run ci on 3.12 too

* Add setuptools as a dependency

* Add networkx as a dependency

* Add MDAnalysisTests as a test dependency

* check error with ProjectionPlot.interpolate test

* simplify test for projection plot interpolate

* Add 3.12 to list of supported versions

* remove black as we're using ruff

* pin numpy to < 2

* make linters happy

* Use codecov token for uploading coverage report
  • Loading branch information
p-j-smith authored Dec 5, 2024
1 parent 3d9342e commit d7d8f0d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 44 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ jobs:
release:
name: Publish to PyPI if upload to Test PyPI was successful
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [release-test]
steps:
- uses: actions/download-artifact@v3
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
python-version: ["3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]

steps:

Expand All @@ -38,8 +38,9 @@ jobs:

# Using Codecov's action, upload the coverage report for the triggering commit/PR
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
with:
files: coverage.xml
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,3 @@ repos:
- id: requirements-txt-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
29 changes: 5 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,23 @@ classifiers = [
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
"Programming Language :: Rust",
'Topic :: Scientific/Engineering'
]
dependencies = [
"attrs",
"numpy",
"numpy<2",
"scipy",
"networkx",
"pandas",
"matplotlib",
"mdanalysis",
"freud-analysis",
"tidynamics",
"seaborn",
"tqdm",
"setuptools", # for pkg_resources module in Python 3.12
]
urls.bugtracker = "https://github.com/p-j-smith/lipyphilic/issues"
urls.documentation = "https://lipyphilic.readthedocs.io/en/stable"
Expand All @@ -52,6 +55,7 @@ tests = [
"pytest-cov",
"coverage",
"tox",
"MDAnalysisTests",
]
docs = [
"sphinx",
Expand Down Expand Up @@ -192,29 +196,6 @@ pep8-naming.classmethod-decorators = [
"A001", # Variable 'copyright' shadows a Python builtin
]

[tool.black]
exclude = '''
(
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| \.pytest_cache
| \.ruff_cache
| \.gitignore
| _build
| build
| dist
| examples
)/
)
'''
line-length = 110
target-version = ["py310", "py311"]

[tool.ruff.isort]
force-single-line = false
combine-as-imports = true
Expand Down
29 changes: 16 additions & 13 deletions tests/lipyphilic/plotting/test_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,28 @@ def test_project_values(self, projection):
def test_interpolate(self, projection):
projection.statistic = np.array(
[
[np.NaN, 0, np.NaN],
[1, np.NaN, 1],
[np.NaN, 0, np.NaN],
[1, 1, 1, 1, 1],
[1, np.NaN, 0, np.NaN, 1],
[1, np.NaN, np.NaN, np.NaN, 1],
[1, np.NaN, 0, np.NaN, 1],
[1, 1, 1, 1, 1],
],
)

projection.interpolate(method="linear")

reference = {
"statistic": np.array(
[
[1, 0.0, 0.5],
[1, 1, 1],
[1, 0.0, 0.5],
],
),
}
expected = np.array(
[
[1.0, 1.0, 1.0, 1.0, 1.0],
[1.0, 0.5, 0.0, 0.5, 1.0],
[1.0, 0.5, 0.0, 0.5, 1.0],
[1.0, 0.5, 0.0, 0.5, 1.0],
[1.0, 1.0, 1.0, 1.0, 1.0],
],
)

assert_array_almost_equal(projection.statistic, expected)

assert_array_almost_equal(projection.statistic, reference["statistic"])

def test_interpolate_no_tile(self, projection):
projection.statistic = np.array(
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[tox]
envlist = py{310,311}-{linux,macos,windows}
envlist = py{310,311,312}-{linux,macos,windows}
isolated_build = true

[gh-actions]
python =
3.10: py310
3.11: py311
3.12: py312
fail_on_no_env = true

[testenv]
Expand Down

0 comments on commit d7d8f0d

Please sign in to comment.