Skip to content

Add pathlib Support#836

Merged
akaszynski merged 6 commits intomasterfrom
feat/pathlib
Jul 15, 2020
Merged

Add pathlib Support#836
akaszynski merged 6 commits intomasterfrom
feat/pathlib

Conversation

@akaszynski
Copy link
Copy Markdown
Member

Pathlib Support

This PR adds pathlib support and resolves #833, allowing:

import pyvista as pv
from pathlib import Path
vtuFilePath = Path(r'./test.vtu')
pv.UnstructuredGrid(vtuFilePath)

This PR took longer than expected due to problems with Python3.5 and pathlib support for ~ and the many locations that we need to check for pathlib vs str in our code.

@akaszynski akaszynski requested a review from banesullivan July 14, 2020 19:55
Copy link
Copy Markdown
Member

@banesullivan banesullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for handling this @akaszynski!

Down the road, I'd still like to centralize all of the IO code into the fileio module to avoid having filename = os.path.abspath(os.path.expanduser(str(filename))) etc. all over the place. But this will be a task for me when I maybe one day find the time.

@banesullivan banesullivan added the enhancement Changes that enhance the library label Jul 15, 2020
@akaszynski
Copy link
Copy Markdown
Member Author

Agreed. Having a central function that deals with paths in the module would be ideal.

@akaszynski akaszynski merged commit ebf4868 into master Jul 15, 2020
@akaszynski akaszynski mentioned this pull request Sep 8, 2020
adeak added a commit to adeak/pyvista that referenced this pull request Nov 9, 2020
* upstream/master: (37 commits)
  🔧 Fix unused variables (pyvista#847)
  Add better Unstructured Grid Documentation (pyvista#845)
  Fix typo in plotting.py (pyvista#846)
  Feat: Implement compute_derivative (pyvista#837)
  New probe filter and massively improve interpolate filter (pyvista#842)
  Clarify clip filter docstring (pyvista#840)
  Update create-structured-surface.py (pyvista#844)
  Update topo-map.py (pyvista#841)
  Add release suffix to version string (pyvista#817)
  Add pathlib Support (pyvista#836)
  Add tolerance argument to sample_over_line (pyvista#828)
  vector slice from pyvista/pyvista-support#134 (pyvista#808)
  Fix is_all_triangles (pyvista#832)
  Misc. documentation fixes (pyvista#829)
  Follow up pyvista#793: fix get_data_range (pyvista#818)
  Fix GPU info in scooby report (pyvista#825)
  Patch for auto_close warning (pyvista#798)
  Add texture demo with scalar data (pyvista#821)
  MAINT: Log init start/stop (pyvista#819)
  Add PolyData strip filter (pyvista#807)
  ...
@akaszynski akaszynski deleted the feat/pathlib branch November 10, 2020 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Changes that enhance the library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Support pathlib objects

2 participants