stats_can icon indicating copy to clipboard operation
stats_can copied to clipboard

Migrate from os.path to Pathlib

Open ianepreston opened this issue 4 years ago • 8 comments

Using os.path to handle files makes the implementation trickier, especially for cross platform support. Pathlib is great. Time to switch to pathlib

ianepreston avatar Aug 03 '20 15:08 ianepreston

Ian,

After watching the today's Data-for-Good/PyData meetup. I agree that this would be a good issue to explore the code. I've worked through the code updating to replase os.path with pathlib. I'm on Python 3.9 and your tests don't run with nox. So, I'm wondering how to run tests before I create a PR.

Thanks for the presentation and great work.

Azim

azimj avatar Jan 29 '21 05:01 azimj

Hi Azim,

Thanks for your interest! There are a couple options for how to proceed. If you create a pull request with your changes then GitHub actions will run the tests remotely. If you want to test locally without nox you should just be able to call pytest directly from whatever environment you're in. Alternatively you could either set up other python versions, or wait for me to add python 3.9 support (that's pretty high on my to do list). What are you using to manage python versions on your machine and what operating system are you running?

Thanks

ianepreston avatar Jan 29 '21 14:01 ianepreston

Thank you for the quick response. I am on Win-10 and have created a venv environment. My current toolchain/environment is VS-Code with Microsoft's Python extensions. I have my main Python install on my path. I will try the PyTest suggestion later today.

I don't have any Python version management work-flows and I've gone away from using third party distros (eg enthought, anaconda). Some packages such as iPython I've installed in my global Python but other packages I'm trying to keep to installing in virtual environments for a given project.

I will let you know how it goes. Expect a PR from me in the near future.

azimj avatar Jan 29 '21 16:01 azimj

Well, I think I need some more time to get tests to run on my computer before I can create a PR and be sure that I haven't broken your tests. Anyway, I will update you on progress.

azimj avatar Jan 30 '21 04:01 azimj

I've just merged in a fix that allows the package to support python 3.9. Hopefully this will make your testing easier!

ianepreston avatar Jan 30 '21 05:01 ianepreston

I will try it. I think I'm having some issue with the tables package. I had to download binaries from Christoph Gohlke but I still have error's related to this package. I will merge your latest commit and try to run tests this weekend. Thanks

azimj avatar Jan 30 '21 05:01 azimj

Hello Ian,

Pull Request #64 address this issue. Let me know what you think.

Thanks

Azim

azimj avatar Feb 13 '21 04:02 azimj

You're welcome. happy to have contributed.

azimj avatar Feb 14 '21 03:02 azimj