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

Switch packaging from setup.py to pyproject.toml #4129

Open
harshil21 opened this issue Feb 23, 2024 · 1 comment
Open

Switch packaging from setup.py to pyproject.toml #4129

harshil21 opened this issue Feb 23, 2024 · 1 comment

Comments

@harshil21
Copy link
Member

harshil21 commented Feb 23, 2024

What kind of feature are you missing? Where do you notice a shortcoming of PTB?

PTB currently builds the wheels for uploading to PyPI by running the command python setup.py sdist bdist_wheel (from the wiki). However, the use of that command is deprecated.

The reason we are still using setup.py is because we wanted to dynamically build the wheels for both PTB and PTB-raw, and not have two separate repositories or files for that purpose. However, upon some observation, PTB has now made all its dependencies except httpx optional. This negates the need for having PTB-raw in the first place.

Additionally, the number of downloads for PTB-raw is tiny (12k/mo vs 1M/mo).

Describe the solution you'd like

Follow the packaging guide to migrate, and make sure that our build system follows the recommended guidelines. And then remove the PTB-raw package.

Describe alternatives you've considered

We could still keep setup.py, but we have to stop using that setup.py command to build wheels.

Additional context

No response

@Bibo-Joshi
Copy link
Member

Some comments from my side:

Packages sizes for v21.1.1 are

ptb ptb-raw factor
tar.gz 417kb 283kb 1.47
whl 618kb 435kb 1.42

So ptb is <1.5 times as large as ptb-raw while still behing well below 0.5MB in source / 1MB in whl. IMO footprint size concernes should not be too big.

I'm in favor of deprecating ptb-raw. Even with installing ptb, you can still use the telegram module independently from the telegram.ext module. Aditionally, this removes some maintenance overhead.
Since our stability policy doesn't strictly say anything about deprecating the whole package and b/c there is a drop-in replacement available via ptb, I don't think we need to stick to the two-major-versions cycle. Instead my first idea would be

  • We announce deprecation of ptb-raw in the channel
  • with the next possible release, we issue a warning in telegram/__init__.py in case telegram.ext is not found. This warning points users to the channel post and tells them to use ptb instead.
  • the following release does no longer update ptb-raw

With abandoning ptb-raw, we can then easily move to a pyproject.toml build setup, which is more modern and may offer some additional flexibility.
I recommend to use hatch(ling) as build requirement. It's a 1st party library, fully PEP-compliant and I've already a tiny bit of experience with it.
As a first step we can simply manually fill pyproject.toml file and then decide later if we want to use (parts of) hatch for further packaging steps (e.g. updating the version numbers)

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

No branches or pull requests

2 participants