GithubHelp home page GithubHelp logo

shutup's People

Contributors

hyandell avatar polvoazul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

shutup's Issues

Cannot remove `DepecrationWarning`

Hi there,

I made my own Python package which is composed of two scripts and a standard Python package with several folders.
Here's the content of the setup.py:

from setuptools import setup

with open(f"README.md") as f:
    long_description = f.read()

setup(name="stag",
      version="0.0.0",
      description="A CLI that simplifies the usage of MCMC methods.",
      scripts=["bin/stag", "bin/stag-fs"],
      packages=["stag"],
      long_description=long_description,
      long_description_content_type="text/markdown",
      install_requires=["click"],
      url="https://github.com/jpmvferreira/stag",
      author="José Ferreira",
      author_email="[email protected]",
      license="MIT",
      zip_safe=False
)

Every time I run one of the binaries, I always get the following message:

/home/undercover/.micromamba/envs/stag/bin/stag:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  __import__('pkg_resources').require('stag==0.0.0')

I can't for the sake of anything turn it off, which is really annoying, especially because I'm not using anything that is non standard here.
My CLI utility depends on a single package, click, and then uses Python built-in sys and os packages, nothing else.

Trying to suppress warnings doesn't cut it as well.
What to do?
Do you happen to know what is causing this deprecation warning anyways, and how it can be solved (either by shutting it up or by actually fixing it)?

Deprecation warnings from torchvision still appear

Python 3.9 installed in a virtual environment.
Torchvision 0.14.1

Warnings:

/home/user/.env/py39pytorch/lib/python3.9/site-packages/torchvision-0.14.1-py3.9-linux-x86_64.egg/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.
  warnings.warn(msg)

/home/user/.env/py39pytorch/lib/python3.9/site-packages/torchvision-0.14.1-py3.9-linux-x86_64.egg/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing `weights=None`.
  warnings.warn(msg)

Head of file that emits these warnings

#!/usr/bin/env python3

import sys
import argparse
from pathlib import Path

import shutup ; shutup.please()

import numpy as np
import torch.cuda
from joblib import Parallel, delayed
from tqdm_joblib import tqdm_joblib

from scipy.spatial.distance import jensenshannon

# other imports of local modules
# other code

moving call to shutup.please() to the end of imports does not help, the following code still produces warnings:

#!/usr/bin/env python3

import sys
import argparse
from pathlib import Path

import numpy as np
import torch.cuda
from joblib import Parallel, delayed
from tqdm_joblib import tqdm_joblib

from scipy.spatial.distance import jensenshannon

# other imports of local modules

import shutup ; shutup.please()

# other code

Licensing?

Hi Fred,

I wasn't able to see any licensing for this component. Could you let me know the license it's made available under?

NumpyWarning

I've put ‘import shutup’ 'shutup.please' in the first line but it's still warning.

DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
F_table[t, item] = optimizer.gbest_F

Undoing shutup.please()

Sometimes the annoying warnings come up in specific moments of the program's execution. After those moments maybe some warnings would actually be helpful.

It would be really useful to have a function in this library that would be able to undo all the shut-uping.

Sort of 'Python, I've changed, please come back to me' type thing ;)

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.