Coder Social home page Coder Social logo

Comments (8)

bgw avatar bgw commented on August 22, 2024 1

I've seen a lot of projects use their changelog (and by extension, the github releases page) for declaring deprecations.

from libcst.

DragonMinded avatar DragonMinded commented on August 22, 2024

Any sort of explicit warning we can give to developers well in advance of removal is good. I am not sure I have any opinions on warnings.warn(..., DeprecationWarning) versus @deprecated. They both seem to have their advantages and assumptions.

I think you are right that we need some semi-formal deprecation documentation. I was proposing to @bgw that we have a document at the root called DEPRECATION which lists our policy and things slated for deprecation as well as recommended alternatives. Some day in the future, we can also list a command to run which uses LibCST codemod capabilities to auto-upgrade code, but that's not currently possible. I like the idea of having a deprecation section in the readthedocs, because its a perfect place to list each individual deprecation as well as example code and links to the docs for what to use instead. I would assume we can do this in addition to a DEPRECATION file or similar. Maybe we want to just update the README with a Deprecation section close to the Future section?

from libcst.

DragonMinded avatar DragonMinded commented on August 22, 2024

Ooh, yeah that's not a bad place to put things as well. Especially once we actually drop support for old features.

from libcst.

carljm avatar carljm commented on August 22, 2024

To the extent there's a "standard approach," it's to document things in changelog / release notes (as well as the reference documentation for the affected items), and then if possible also warnings.warn(DeprecationWarning) at runtime.

The deprecation library providing the @deprecated decorator I hadn't seen before, seems like just a wrapping around warnings with some bells and whistles.

from libcst.

jimmylai avatar jimmylai commented on August 22, 2024

Circle back on this, we already have to many things deprecated but the deprecation process wasn't standardized. It looks messy to me.
Can we start using the deprecation library to add deprecated_in, removed _in and fail_if_not_removed in the code? The library wrapped Python warnings helper and automatically update the docstring (so the deprecation versions show up in Sphinx doc). It also automatically fails tests when we upgrade to target version but forget to remove the deprecated functions.

from libcst.

DragonMinded avatar DragonMinded commented on August 22, 2024

What are we solving here? We have a deprecation strategy: Things get deprecated on a minor release bump (such as 0.2.x -> 0.3.0) which has not happened yet. Adding a library won't help that, and we already have a record of deprecations in the changelog. Many of the things deprecated can't be decorated, and can only be documented with docstrings. Its unclear what adding another layer does for us in this case.

from libcst.

jimmylai avatar jimmylai commented on August 22, 2024

Using the library is to make the deprecation documentation easier.
Current the deprecated things weren't explicitly say they'll be removed in the version of 0.3.0.
The deprecation library can help us add an explicitly removal version in documents for user and raised exception when we already upgrade to new version but didn't remove them.
We can also do that manually but that's more repetitive.

from libcst.

jimmylai avatar jimmylai commented on August 22, 2024

The way we handle it currently is adding deprecated in comment and documentation.
Then clean them up in the next major version release.
It's simple and works ok since we don't have many to deprecate.

from libcst.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.