COVID19Py icon indicating copy to clipboard operation
COVID19Py copied to clipboard

MAINT: Apply black, isort, pre-commit

Open MartinThoma opened this issue 4 years ago • 4 comments

MAINT: Move meta-data to setup.cfg

MartinThoma avatar Mar 24 '20 09:03 MartinThoma

I highly recommend to install pre-commit: https://pre-commit.com/

pip install pre-commit

Once you have it on your system, you can go in this repository (this branch) and execute "pre-commit install". The effect is, that every time you execute "git commit" it will run all the checks I defined in the pre-commit file. This allows you to keep a high quality.

MartinThoma avatar Mar 24 '20 09:03 MartinThoma

Also, I would recommend to drop Python 2 support. Python 2 is outdated. Two nice features you can use when you drop Python < 3.6 support:

  • f-strings
  • type annotations (not only as comments, but a nice integration) and checks with mypy

MartinThoma avatar Mar 24 '20 09:03 MartinThoma

Hello @MartinThoma!

Thanks a lot for the PR. I'll check it out asap!

Now, as about Python 2.x support, since requests is the only dependency of the library for now and it's not using any Python 3 exclusive features, I thought it could support every version supported by requests. This way, even someone that is still using Python 2, they'd still be able to use the package for whatever needs they might have. Considering the scale of the crisis this package has to do with, I believe it's not as much about enforcing guidelines to the users but mostly wide support for anyone that might actually need it. 🙂

Kamaropoulos avatar Mar 27 '20 09:03 Kamaropoulos

Your decision :-) - the main point is that it puts more work on your side.

This PR should not break Python 2 compatibility. Although I don't support Python 2 in my projects anymore, I respect the decision of other developers to keep compatibility. The last weeks I was supporting a few biochemistry projects to make them work in Python 3 additionally to Python 2. My hope is that we, as a community, can let Python 2 die. It's been around since 2008; Python 3.6 since 2016. All important projects I know of support Python 3.6 (various interpreters/platforms, various packages). If we can get rid of Python 2, we free up a lot of developer capacity.

By the way, I'm not arguing to deliberately break stuff. I'm arguing for not spending more time on keeping compatibility. In my case, I dropped Python 2.7 from my CI pipelines.

Speaking of CI pipelines: I don't see any in this project. Are you interested in setting one up with https://travis-ci.org/? I can make another PR after this one. It would automatically run the tests and check if it still works for all supported Python versions. You would see another check for new PRs which tells you if the PR breaks anything.

MartinThoma avatar Mar 27 '20 09:03 MartinThoma