How to use APScheduler without installing it? - apscheduler

I know the normal way to use APScheduler is "python setup.py install". But I want to embed it into my program directly, so the user don't need install it when using my program.
class BaseScheduler(six.with_metaclass(ABCMeta)):
_trigger_plugins = dict((ep.name, ep) for ep in iter_entry_points('apscheduler.triggers'))
# print(_trigger_plugins, 'ddd')
_trigger_classes = {}
_executor_plugins = dict((ep.name, ep) for ep in iter_entry_points('apscheduler.executors'))
_executor_classes = {}
_jobstore_plugins = dict((ep.name, ep) for ep in iter_entry_points('apscheduler.jobstores'))
_jobstore_classes = {}
_stopped = True
thks.

You can instantiate the triggers directly, without going through their aliases. That eliminates the need to install APScheduler or setuptools. Does this answer your question?

I find a way to work around this problem.
use 'pip install apscheduler' to install locally
goto the installed directory and cp that directory to your lib directory
use 'pip uninstall apscheduler' to remove it.
make you code to import the apscheduler from your lib directory.
done.

Related

How to run tflint rules all at one for a specific provider?

I installed the tflint plugin but when I run tflint on the root module I get nothing. When I specify a rule with --enable-rule then I get some warnings. How can I run the ruleset of azure or aws all at once?
when it comes to azure you can install the plugin by adding a config to .tflint.hcl and running tflint --init:
plugin "azurerm" {
enabled = true
version = "0.14.0"
source = "github.com/terraform-linters/tflint-ruleset-azurerm"
}
If you want to add a new rule to this ruleset, you can use the generator
$ go run ./rules/generator
You can find the list of rules available for the tflint-ruleset-azurerm Here

How to debug neovim lsp custom command

I am attempting to get the volar vue language server to work in place of vetur for neovim's native lsp.
Using both lspconfig and lspinstall I was able to create a working custom install for sumneko_lua (unrelated but had to manually build due to some issues with the built-in :LspInstall lua). Below is that code duplicated and modified for an attempt at using this new vue server:
local vue_config = require'lspinstall/util'.extract_config('vuels')
vue_config.default_config.cmd = {'node', './node_modules/vscode-vue-languageservice/out/index.js', '--stdio'}
require'lspinstall/servers'.newvue = vim.tbl_extend('error', vue_config, {
install_script = [[
! test -f package.json && npm init -y --scope=lspinstall || true
npm install vscode-vue-languageservice#latest
]],
uninstall_script = nil
})
Running :LspInstall newvue installs properly, however :LspInfo shows this language server is attached to the buffer (of a .vue file) but not active. I believe the issue is with this path: ./node_modules/vscode-vue-languageservice/out/index.js. It exists, but may not be the correct entry point? The default vue ls simply has vls as the command because it provides a binary. Am I missing something in this package? I have yet to come across another language server without a single binary to pick out.
Thanks!
Can you try an absolute path to the out.js file? In my pretty elaborate config for a custom Volar install I'm using something just /home/myuser/dev/volar/packages/server/out/index.js (where the volar folder is just the whole volar cloned github repo). My full config is here
I don't think you can use relative paths like you did. I know you're assuming that the "./node_modules" means "workspace directory" but it's hard to tell in which directory nvim-lspconfig opens up those executables.
I have yet to come across another language server without a single binary to pick out.
Volar also provides a binary, it's volar-server (after running npm i -g #volar/server), it's just with a custom install (ie. alongside the real volar) you can't use it, because I assume you want to use your local install with custom code.
As for more indepth debugging/logging, you can check ~/.cache/nvim/lsp.log to see why the language server dies in detail.

Installing kdesu on NixOS

When setting advanced properties on a program/link to start as another user it is throwing the error:
Sorry - Plasma
KDEInit could not launch 'kdesu':
Could not open library 'libkdeinit5_kdesu'.
Cannot load library /run/current-system/sw/lib/libkdeinit5_kdesu: (/run/current-system/sw/lib/libkdeinit5_kdesu.so: cannot open shared object file: No such file or directory)
I tried to install kdesu using:
[root#nixos:~]# nix-env -qaP kdesu
nixos.kdeFrameworks.kdesu kdesu-5.36.0
[root#nixos:~]# nix-env -iA nixos.kdeFrameworks.kdesu
replacing old ‘kdesu-5.36.0’
installing ‘kdesu-5.36.0’
building path(s) ‘/nix/store/2bn27h5drw0800gk5z2rmwfx78gqbbdc-user-environment’
created 2209 symlinks in user environment
[root#nixos:~]# kdesu
bash: kdesu: command not found
[root#nixos:~]# which kdesu
which: no kdesu in (/root/bin:/run/wrappers/bin:/etc/per-user-pkgs/root/bin:/root/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin)
I also tried installing nix-env -iA nixos.kde-cli-tools but that does not work either.
Any suggestions on how to get kdesu installed on NixOS?
As a general rule, unlike many distros on NixOS installing a library directly doesn't work as intended; the application that needs the library won't be able to find it. Instead, the package must declare all it's dependencies.
Packages which have optional dependencies tend to have a way to add them via configuration. You may want to try something like this in /etc/nixos/configuration.nix
services.xserver.desktopManager.plasma5.extraPackages = with kdeFrameworks;
[ kdesu
];
I'm glad to see that you filed an issue on Nixpkgs, because this is not a configuration issue but a packaging bug.
It looks like kdesu lives in some libexec dir that doesn't hasn't been added to your PATH. It belongs to the kde-cli-tools package. You can run it with
$(nix-build '<nixpkgs>' -A kde-cli-tools --no-out-link)/lib/libexec/kf5/kdesu
You can use the above as an alias to launch kdesu until the fix to the packaging bug arrives.

How to remove Perl6 package installed by Panda

I was just wondering how one might uninstall a Perl6 package installed by Panda, as it seems to be missing the 'remove' or 'uninstall' command.
Thank you!
As of today, you cannot remove a package with panda; the alternate package manager zef does support this, however.
https://github.com/ugexe/zef
I forget where I found this code for removing something installed via Panda, but it works amazingly.
#!/usr/bin/env perl6
use v6.c;
sub MAIN($short-name, :$ver = True, :$auth = True, :$api = True) {
my $comp-unit = $*REPO.resolve(CompUnit::DependencySpecification.new(:$short-name, :$ver, :$auth, :$api));
$comp-unit.repo.uninstall($comp-unit.distribution);
}

How to change a dependency version in npm

I'm actually trying to use gulp-handlebars but I need to change handlebars version in the gulp-handlebars package. I can't find a way to do that with a command line, and I'm new to all of this stuff, so I'm asking for clear help, what files do I have to change ?
I assume that copy/paste of my good version of Handlebars in the gulp-handlebars folder wouldn't be enough (and I actually tried that).
Thanks.
It looks like gulp-handlebars is incredibly simple. It should be fairly simple to use handlebars and vinyl-map without relying on a plugin, something like:
In the terminal:
$ npm remove gulp-handlebars
$ npm install --save-dev handlebars#version-you-want vinyl-map gulp-rename
In your gulpfile.js:
var handlebars = require('handlebars'),
rename = require('gulp-rename'),
map = require('vinyl-map');
// ... in your task ...
return gulp.src(...)
.pipe(map(function(contents) {
return handlebars.precompile(contents.toString() /*, options */);
})
.pipe(rename({ extname: '.js' }))
.pipe(gulp.dest(...));
I haven't test this, but it should get you going in the right direction.