Releasing a non-backward compatible library in PyPI?

I have a PyPI library called foobar, and it is currently in version 1.2.0(using semantic version control).

The next version does not support API compatibility with versions 1.x, so I will release it as 2.0.0.

What is the best practice for publishing this new version in PyPI so that clients using versions 1.xdo not accidentally upgrade to 2.0.0and break their code? (I assume that there are people who have not used version dependency, for example >=1.0.0, <2.0.0in their code).

Would it be better to create a completely new package called foobar2PyPI and push the new version there? How do other projects handle this?

+4
source share
1 answer

I argue: API changes are usually divided into two categories.

  • The new API B replaces A, but A can be fully implemented using the new API B. Thus, it is possible to support the old API at the same time as the new API.

    It can be as simple as a new API that moves to streamline or streamline your module, or more complex, like converting arguments to kwargs or something else.

  • The new API replaces the old API, but cannot implement it for any technical reason.

IMO. , , ) (.. , , ).

1. , .

API , , . , API - .

API . - .

2. , API.

2 1, , , 1.2.1, , , , , requirements.txt.

, 2.0, .

, 1.2.0 2.0 .

3. .

, , , , , , . , Python , Python 2 Python 3:-). unittest2 .

.

, , , , , , - , , - .

, (, , ), .

, : , . , BeautifulSoup.

+1

Source: https://habr.com/ru/post/1670026/


All Articles