Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address deprecations, update coding conventions, use git-based versioning #19

Closed
wants to merge 15 commits into from

Conversation

Zeitsperre
Copy link
Contributor

@Zeitsperre Zeitsperre commented May 15, 2024

Changes

  • Updates the code base to use Python3.8+ coding conventions
  • Added some more specific exception handling
  • Added a very simple pre-commit configuration with coding convention checking and linting
  • Removed the poetry.lock file
  • Configured the GitHub Workflow to test against more Python versions
  • Added .idea to .gitignore (for JetBrains IDEs)
  • Publishing no longer uses twine, opting for native poetry commands
  • Versioning uses git tags with the poetry-version-plugin
  • Addressed DeprecationWarning message being emitted in newer versions of Python
  • Cleaned up a few imports

Additional context

These are deprecation notices that were being raised in downstream projects:

  • Python3.11+:
../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/GPG.py:80
../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/GPG.py:80
../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/GPG.py:80
../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/GPG.py:80
  /home/runner/micromamba/envs/raven/lib/python3.12/site-packages/metalink/GPG.py:80: DeprecationWarning: 'locale.getdefaultlocale' is deprecated and slated for removal in Python 3.15. Use setlocale(), getencoding() and getlocale() instead.
    localelang = locale.getdefaultlocale()[0]

../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/proxy.py:110
../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/proxy.py:110
../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/proxy.py:110
../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/proxy.py:110
  /home/runner/micromamba/envs/raven/lib/python3.12/site-packages/metalink/proxy.py:110: DeprecationWarning: 'locale.getdefaultlocale' is deprecated and slated for removal in Python 3.15. Use setlocale(), getencoding() and getlocale() instead.
    localelang = locale.getdefaultlocale()[0]

../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/download.py:157
../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/download.py:157
../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/download.py:157
../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/download.py:157
  /home/runner/micromamba/envs/raven/lib/python3.12/site-packages/metalink/download.py:157: DeprecationWarning: 'locale.getdefaultlocale' is deprecated and slated for removal in Python 3.15. Use setlocale(), getencoding() and getlocale() instead.
    lang = locale.getdefaultlocale()[0]

../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/download.py:204
../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/download.py:204
../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/download.py:204
../../../micromamba/envs/raven/lib/python3.12/site-packages/metalink/download.py:204
  /home/runner/micromamba/envs/raven/lib/python3.12/site-packages/metalink/download.py:204: DeprecationWarning: 'locale.getdefaultlocale' is deprecated and slated for removal in Python 3.15. Use setlocale(), getencoding() and getlocale() instead.
    localelang = locale.getdefaultlocale()[0]
  • Specific to Python3.10 and Python3.11:
 ../../../micromamba/envs/raven/lib/python3.11/site-packages/metalink/download.py:132
../../../micromamba/envs/raven/lib/python3.11/site-packages/metalink/download.py:132
../../../micromamba/envs/raven/lib/python3.11/site-packages/metalink/download.py:132
../../../micromamba/envs/raven/lib/python3.11/site-packages/metalink/download.py:132
  /home/runner/micromamba/envs/raven/lib/python3.11/site-packages/metalink/download.py:132: DeprecationWarning: ssl.PROTOCOL_TLS is deprecated
    SSL_ANYTHING = ssl.SSLContext(ssl.PROTOCOL_SSLv23)

../../../micromamba/envs/raven/lib/python3.11/site-packages/metalink/download.py:134
../../../micromamba/envs/raven/lib/python3.11/site-packages/metalink/download.py:134
../../../micromamba/envs/raven/lib/python3.11/site-packages/metalink/download.py:134
../../../micromamba/envs/raven/lib/python3.11/site-packages/metalink/download.py:134
  /home/runner/micromamba/envs/raven/lib/python3.11/site-packages/metalink/download.py:134: DeprecationWarning: ssl.PROTOCOL_TLSv1_2 is deprecated
    SSL_HIGH = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)

These have been addressed

@Zeitsperre Zeitsperre changed the title Address deprecations, update Address deprecations, update coding conventions May 15, 2024
@Zeitsperre Zeitsperre changed the title Address deprecations, update coding conventions Address deprecations, update coding conventions, use git-based versioning May 15, 2024
@@ -1,19 +1,32 @@
name: main
name: pymetalink Testing Suite
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename breaks pull request validation rules, please revert

env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
POETRY_HTTP_BASIC_FOO_USERNAME: ${{ secrets.PYPI_USERNAME }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Foo?

@@ -1,21 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Neil McNab, Hampus Wessman
Copyright (c) 2007-2024 Neil McNab, Hampus Wessman, and other contributors
Copy link
Contributor

Choose a reason for hiding this comment

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

We need a set of designated copyright holders to make usage decisions, if we open this up we make it impossible to make decisions on licensing without reviewing with all previous contributers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, understood. Would it make sense to add those who have contributed to date, or do we want to leave it to Neil and Bram?

I've also seen people listed for different years, so we could technically add yourself from when you adopted the project?

Copy link
Contributor

Choose a reason for hiding this comment

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

Adding people makes sense, we cna just have a contributors list and mention those poeple in the copyright statement, that would be fine. Legally it's probably very hard to work with "go look at git to see who contributed to figure out who to contact for copyright issues" 😉


install: build
dh_testdir
dh_testroot
dh_clean -k
dh_clean -k
Copy link
Contributor

Choose a reason for hiding this comment

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

We should split formatting changes into a new pr then rebase, all these tiny changes make it hard to review

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can see about splitting the formatting changes off. Shouldn't be too difficult.

requires = ["poetry-core>=1.2.0"]
build-backend = "poetry.core.masonry.api"

[tool.black]
Copy link
Contributor

Choose a reason for hiding this comment

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

I have been using ruff format a lot lately, it’s a lot fasten so I would prefer that, but a formatter is a good idea and we should push that in a separate pr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've been using ruff in a few places as well. I'll verify what the configuration requires so that we solely use that tool instead of black.

@bneijt
Copy link
Contributor

bneijt commented Jun 4, 2024

Dear contributor, sorry for the late reply and thank you for taking the time to open up a PR!

some changes I agree with, some I would love to split off into a separate pr. I don’t have a laptop this week, but will try to do a proper review next week. Could you consider moving the formatting to a new pr?

@Zeitsperre
Copy link
Contributor Author

Closed in favour of #20 and #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants