Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem z ładowaniem innych pakietów (sodium, mockery) #16

Open
AnnaGierlak opened this issue Jun 10, 2018 · 7 comments
Open

Problem z ładowaniem innych pakietów (sodium, mockery) #16

AnnaGierlak opened this issue Jun 10, 2018 · 7 comments

Comments

@AnnaGierlak
Copy link
Collaborator

Po pobraniu repo i wywołaniu funkcji check() pojawiają się błędy w sytuacji, gdy nie ma się zainstalowanych pakietów sodium i mockery. Dobrze byłoby, gdybyśmy umożliwili automatyczne instalowanie potrzebnych pakietów zamiast zmuszać użytkownika do ręcznej instalacji.

@komosinskid
Copy link
Collaborator

A jak się to technicznie robi?

@ghost
Copy link

ghost commented Jun 10, 2018

Powinny być w imports, są w suggests, trzeba też dodać explicite odwołanie się do tych pakietów.

Imports: packages listed here must be present for your package to work. In fact, any time your package is installed, those packages will, if not already present, be installed on your computer (devtools::load_all() also checks that the packages are installed).

Adding a package dependency here ensures that it’ll be installed. However, it does not mean that it will be attached along with your package (i.e., library(x)). The best practice is to explicitly refer to external functions using the syntax package::function(). This makes it very easy to identify which functions live outside of your package. This is especially useful when you read your code in the future.

If you use a lot of functions from other packages this is rather verbose. There’s also a minor performance penalty associated with :: (on the order of 5µs, so it will only matter if you call the function millions of times). You’ll learn about alternative ways to call functions in other packages in namespace imports.

Suggests: your package can use these packages, but doesn’t require them. You might use suggested packages for example datasets, to run tests, build vignettes, or maybe there’s only one function that needs the package.

Packages listed in Suggests are not automatically installed along with your package. This means that you need to check if the package is available before using it (use requireNamespace(x, quietly = TRUE)). There are two basic scenarios:

@kromash
Copy link
Contributor

kromash commented Jun 10, 2018

Moim zdaniem te pakiety powinny zostać w suggests. Pakiet mockery tak jak pakiet testthat jest potrzebny wylacznie do testowania pakietow i nie jest konieczny do używania go.
Trochę inaczej jest z pakietem sodium. Pakiet ten jest potrzebny do szyfrowania w funkcji hugo_share_secret, ale wymaga dodatkowych bibliotek zainstalowanych na komputerze użytkownika. Przenosząc ten pakiet do imports zmusimy użytkownika do instalacji dodatkowych bibliotek mimo, że nie będą one konieczne do funkcjonowania reszty funkcji pakietu.

@ghost
Copy link

ghost commented Jun 10, 2018

Zgadzam się. Z pakietem git2r jest zasadniczo tak samo - wymaga on dodatkowo zainstalowanego na komputerze gita, ale jego posiadanie nie jst potrzeben do pozostałch funkcjonalności.

@kozaka93
Copy link
Collaborator

Pojawił się u mnie problem z pakietami rjson, caret po pobraniu jako bibiloteka. Czy są one umieszczone w odpowiednim segmencie DESCRIPTION ?

@komosinskid
Copy link
Collaborator

obydwa są w imports więc powinny działać

@kozaka93
Copy link
Collaborator

Tak, już jest wszystko ok .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants