Is it possible to add per-file disable rules to pylint rcfile? - pylint

I want to disable some pylint errors from a specific Python file using my pylint rcfile. For complicated reasons, I cannot use disabling comments in the Python file itself. I have to set the rules in the pylint rcfile. However, I can't find documentation about whether "disable" can be made to work for only specific files. Please advise.

Related

Building documentation in RTD using a makefile

I created a package for sagemath and used Sphinx to create its documentation. Now I'm trying to create the necessary configuration files to build the documentation in readthedocs.
The problem is that I've come across is that in order for the documentation to build, I have to run sphinx inside a sagemath shell (that is, sage -sh -c "make html").
Is there any way to achieve so with the configuration file for readthedocs? Or to use a makefile to build the docs? Can't seem to find the information on their documetation.
At the moment, Read the Docs has a fixed build process that involves calling python -m sphinx -b html (with some more parameters) from the virtual environment where the requirements are installed. This is described in the documentation.
Therefore, running custom commands is not possible.
However, since sage is available from conda and Read the Docs supports conda environments, you might be able to build the docs without invoking a Sage shell.
Read the Docs has released a beta feature that allows users to override the build process completely and execute custom commands. You can achieve what you want by using build.commands config key in the configuration file (see https://docs.readthedocs.io/en/stable/config-file/v2.html)
Full documentation of this beta feature at https://docs.readthedocs.io/en/stable/build-customization.html#override-the-build-process

Activate/deactivate conda virtualenvs on entering/leaving directories

pyenv-virtualenv offers a nice way of activating the environment on the very instant of entering or leaving the directory which contains a .python-version text file which specifies the environment to activate. It works for the directory it is in and all directories contained in it.
The environment is deactivated once we change the directory to something above it. This allows to easily switch between projects or analyses using different python versions (just by changing the directories).
Is there a way of achieving the same behaviour with (ana)conda?
Edit: added bash tag, because - as far as I understand - pyenv achieves this by hooking a custom script into .bashrc (which allows it to monitor the directory changes). If there is no build-in way in conda, how to create a script which would make it possible?
As mentioned in my comment, this is currently not supported. There is however an open issue on conda's GitHub asking for this feature.
In the meantime you could use autoenv, a small tool that'll automatically run the code in a .env file when entering a directory and that in a .env.leave when leaving the directory (supports bash/zsh and a couple others).
A simple example taken from their readme which illustrates the feature quite nicely:
$ echo "echo 'whoa'" > project/.env
$ cd project
whoa
To load a conda environment your .env would simply look like this:
conda activate <my_env>
Note 1: Check out the Configuration section of their GitHub readme before you start using it.
Note 2: The author of autoenv actually suggests trying direnv instead. However I've never used it, so I can't comment on it.
From autoenv's readme:
you should probably use direnv instead. Simply put, it is higher quality software. But, autoenv is still great, too. Maybe try both? :)

How to disable tracking of a dependency in configure script

I am trying to build a library with a different build system, but files in the library require a config.h header file that is generated after running the configure scripts generated by autoconf.
This is the sequence of steps I am following to try and generate the config.h file that is needed
autoreconf -ivf
./configure --disable-dependency-tracking
The build system guarantees that the library gflags will be linked and the headers will be available at preprocessing time. But the configure script exits with the following error
configure: error: Please install google-gflags library
Is there some way I can get the list of required libraries (such as gflags) and then pass arguments to the configure script that tells it to assume that this library exists on the system? I went through the help output for both autoreconf and ./configure and wasn't able to figure this out.
Sorry for the long explanation and problem. I am very new to autoconf, etc.
The answer to your question is: no, it is not possible to get a list of dependencies from autotools.
Why?
Well, autotools doesn't track dependencies at all.
Instead, it checks whether specific features are present on the system (e.g. a given header-file; or a given library file).
Now a specific header file can come from a variety of sources, e.g. depending on your distribution the foo.h header can be installed via
libfoo-dev (Debian and derivatives)
foo-devel (Fedora)
foo (upstream)
...
In your specific case, the maintainers of your project output a nice error message telling you to install a given package by name.
The maintainers of your project also chose to abort with a fatal error if a given dependency is not available.
The reason might well be, that the project simply won't work without that dependency, and that is impossible to compile the program without it.
Example
Your project might be written in C++ and thus require a C++-compiler.
Obviously there is little use in passing some flags to ./configure so it assumes that there is a C++-compiler available if in reality there is none.
There is hope
However, not all is bad.
Your configure script might will have the ability to disable certain features (that appear to be hard requirements by default).
Just check ./configure --help and look for flags like
--enable-FOO
--disable-FOO
--with-BAR
--without-BAR
automation?
One thing to know about autotools, is that configure really is a program (the source-code being configure.ac) written in some arcane programming language (involving bash and m4),
This means that it can practically have any behavior, and there is no single standard way to achieve "dependecy tracking".
What you're trying to do will not work as umläute already said. On the other hand, depending on the package you're trying to build, you may be able to tell ./configure that a given library is there even if it isn't.
For instance if the script uses pkg-config to check for the presence of a library, you can use FOO_CFLAGS and FOO_LIBS to override the presence checking and telling it "yes those packages are there, you just don't know how to find them", but these are very package-specific so you may have to provide more information if that's what you're looking for.

Making a configuration file in linux

I am making a configure.ac file for a tool i made and i need to check whether pdflatex is installed in the users system. How do i do it ? For checking for other libraries i simply included the test programs using AC_COMPILE_IFELSE, but i dont know if pdflatex can be invoked from the program.
Also is it regular practise to install all the required packages automatically using some script or i can just specify in the readme file which packages are required and then its upto user to install those packages.
You can use AC_CHECK_PROG([have_pdflatex], [pdflatex], [yes], [no]) to simply check if it exists and set have_pdflatex to yes if so. It's more likely that you'll want to use AC_PATH_PROG([PDFLATEX], [pdflatex]) to find the actual path of the program if it exists and store it in PDFLATEX.
I think it's best to let the user install the prerequisites themself. You don't know how they install their software (apt? yum? pacman? emerge? source?) and it wouldn't be worth the effort to try to cover all cases. It's sufficient to just mention them in the README and to test for them with Autoconf macros.

Installing RSense for VIM

I am trying to install RSense for vim in fedora. I read this manual. I downloaded the tar ball of rsense and extracted it. Then I copied it to the root/opt directory as given on that page. Then I made a directory vim/plugin in the opt directory and copied the rsense.vim in the plugin directory. But when I write :RSenseVersion in the vim editor,I get a message that the command is not recognized.What have I missed ?
Till now I have not installed vim-ruby plugin as staged on the documentation page. What is this plugin meant for ? Can't RSense alone solve my purpose of writing a neat ruby code with auto-completion,code hinting ?
No, you didn't read the manual.
Once all the dependancies are dealt with you must put the plugin in ~/.vim/plugin.
As for the differences between vim-ruby and RSense, I don't do Ruby so I don't know for sure. Looking quickly at their doc, it looks like they are very different in scope and have slightly overlapping features. I'd install both: vim-ruby for all the low-level Vim tuning and RSense for its supposed code intelligence.
But I have a feeling none of them will help you write "neat" ruby code. Only your programing/ruby skills will.

Resources