atlassian-api / atlassian-python-api

Atlassian Python REST API wrapper
https://atlassian-python-api.readthedocs.io
Apache License 2.0
1.29k stars 642 forks source link

Question: is python 2.7 still supported? #1373

Open HoussemNasri opened 2 months ago

HoussemNasri commented 2 months ago

Python 2.7 is listed in the trove classifiers, but using the library in a Python 2 project yields errors due to the usage of f-strings.

https://github.com/atlassian-api/atlassian-python-api/blob/8f7e4e368fcff54d8566746955aacec9cbad2b24/setup.py#L49

This is the error:

from atlassian import Bitbucket
  File "C:\Python27\lib\site-packages\atlassian\__init__.py", line 5, in <module>
    from .confluence import Confluence
  File "C:\Python27\lib\site-packages\atlassian\confluence.py", line 1343
    r = self._session.get(f"{download_link}")

I ran python -m compileall . using python2.7 and got the following result. It suggests that there has been 3 occasions where backward compatibility was broken. Do you think we can change these 3 cases to maintain python2.7 compatibility in upstream or you want to keep using python 3?

Listing . ...
Compiling .\__init__.py ...
Compiling .\bamboo.py ...
Listing .\bitbucket ...
Compiling .\bitbucket\__init__.py ...
Compiling .\bitbucket\base.py ...
Listing .\bitbucket\cloud ...
Compiling .\bitbucket\cloud\__init__.py ...
Compiling .\bitbucket\cloud\base.py ...
Listing .\bitbucket\cloud\common ...
Compiling .\bitbucket\cloud\common\__init__.py ...
Compiling .\bitbucket\cloud\common\builds.py ...
Compiling .\bitbucket\cloud\common\comments.py ...
Compiling .\bitbucket\cloud\common\users.py ...
Listing .\bitbucket\cloud\repositories ...
Compiling .\bitbucket\cloud\repositories\__init__.py ...
  File ".\bitbucket\cloud\repositories\__init__.py", line 266
    **self._new_session_args,
                            ^
SyntaxError: invalid syntax

Compiling .\bitbucket\cloud\repositories\branchRestrictions.py ...
Compiling .\bitbucket\cloud\repositories\commits.py ...
Compiling .\bitbucket\cloud\repositories\defaultReviewers.py ...
Compiling .\bitbucket\cloud\repositories\deploymentEnvironments.py ...
Compiling .\bitbucket\cloud\repositories\diffstat.py ...
Compiling .\bitbucket\cloud\repositories\groupPermissions.py ...
Compiling .\bitbucket\cloud\repositories\hooks.py ...
Compiling .\bitbucket\cloud\repositories\issues.py ...
Compiling .\bitbucket\cloud\repositories\pipelines.py ...
Compiling .\bitbucket\cloud\repositories\pullRequests.py ...
Compiling .\bitbucket\cloud\repositories\refs.py ...
Compiling .\bitbucket\cloud\repositories\repositoryVariables.py ...
Listing .\bitbucket\cloud\workspaces ...
Compiling .\bitbucket\cloud\workspaces\__init__.py ...
Compiling .\bitbucket\cloud\workspaces\members.py ...
Compiling .\bitbucket\cloud\workspaces\permissions.py ...
Compiling .\bitbucket\cloud\workspaces\projects.py ...
Listing .\bitbucket\server ...
Compiling .\bitbucket\server\__init__.py ...
Compiling .\bitbucket\server\base.py ...
Listing .\bitbucket\server\common ...
Compiling .\bitbucket\server\common\__init__.py ...
Compiling .\bitbucket\server\common\permissions.py ...
Compiling .\bitbucket\server\globalPermissions.py ...
Listing .\bitbucket\server\projects ...
Compiling .\bitbucket\server\projects\__init__.py ...
Listing .\bitbucket\server\projects\repos ...
Compiling .\bitbucket\server\projects\repos\__init__.py ...
Compiling .\cloud_admin.py ...
Compiling .\confluence.py ...
  File ".\confluence.py", line 1343
    r = self._session.get(f"{download_link}")
                                           ^
SyntaxError: invalid syntax

Compiling .\crowd.py ...
Compiling .\errors.py ...
Compiling .\insight.py ...
Compiling .\jira.py ...
  File ".\jira.py", line 258
    url = self.url + f"/secure/issueAttachments/{issue_id}.zip"
                                                              ^
SyntaxError: invalid syntax

Compiling .\marketplace.py ...
Compiling .\portfolio.py ...
Compiling .\request_utils.py ...
Compiling .\rest_client.py ...
Compiling .\service_desk.py ...
Compiling .\statuspage.py ...
Compiling .\utils.py ...
Compiling .\xray.py ...
gkowalc commented 2 months ago

hmm.. in my opinion setup.py should be updated to remove python2.7 - it hit EOL long time ago so there is no reason to be worried about backward compatibility with already obsolete version.

MarcelWilson commented 3 weeks ago

hmm.. in my opinion setup.py should be updated to remove python2.7 - it hit EOL long time ago so there is no reason to be worried about backward compatibility with already obsolete version.

It would certainly make supporting the library a bit easier.

gonchik commented 1 week ago

So Let's drop python 2, as I see stats goes down