Questions tagged [package]

Package broadly refers to two things: 1) a usable unit/component of built/compiled software, or 2) a partition of the global namespace (Java).

Package may refer to a software component or the action of creating a package. The component could be a portion of a whole system, or the whole system itself, or any level of granularity between. Typical packaging mechanisms include: tar, jar, zip, rpm, war, exe. In this context it may also be used as a verb: "I was packaging my software and...".

Package is also a term from the java world to refer to the mechanism used to partition the global namespace with the intention of making it possible of having two classes with the same name and of creating a logical structure in which classes may be held. In java packages are most commonly represented by directories. Package is also a java keyword used at the start of a class file to indicate the package to which the class belongs. This is important because of 'package' scoped access rules, which allow classes in the same package to access a field/method/class.

Because of the ambiguity here it is best to use other tags to help define the meaning of this one. If you're asking about java packages, please include the Java tag. If you're asking about packaging up your software for deployment/use add other appropriate tags, such as 'Maven', 'Make', 'Ant', etc.

16844 questions
187
votes
2 answers

How to import and use different packages of the same name

For example, I want to use both text/template and html/template in one source file. But the code below throw errors. import ( "fmt" "net/http" "text/template" // template redeclared as imported package name "html/template" //…
hardPass
  • 19,033
  • 19
  • 40
  • 42
186
votes
7 answers

LaTeX package for syntax highlighting of code in various languages

I am looking for a LaTeX package that does syntax highlighting on code. For example, right now I use the verbatim block to write code: \begin{verbatim} Hello
Vincent Ramdhanie
  • 102,349
  • 23
  • 137
  • 192
185
votes
9 answers

Hiding certain methods from other packages

I have two packages in my project: odp.proj and odp.proj.test. There are certain methods that I want to be visible only to the classes in these two packages. How can I do this? If there is no concept of a subpackage in Java, is there any way around…
Nick Heiner
  • 119,074
  • 188
  • 476
  • 699
185
votes
16 answers

Go build: "Cannot find package" (even though GOPATH is set)

Even though I have GOPATH properly set, I still can't get "go build" or "go run" to find my own packages. What am I doing wrong? $ echo $GOROOT /usr/local/go $ echo $GOPATH /home/mitchell/go $ cat ~/main.go package main import "foobar" func main()…
MitchellSalad
  • 4,171
  • 8
  • 23
  • 24
183
votes
4 answers

Can I use __init__.py to define global variables?

I want to define a constant that should be available in all of the submodules of a package. I've thought that the best place would be in in the __init__.py file of the root package. But I don't know how to do this. Suppose I have a few subpackages…
Andrei Vajna II
  • 4,642
  • 5
  • 35
  • 38
180
votes
16 answers

Check for installed packages before running install.packages()

I have an R script that is shared with several users on different computers. One of its lines contains the install.packages("xtable") command. The problem is that every time someone runs the script, R spends a great deal of time apparently…
Waldir Leoncio
  • 10,853
  • 19
  • 77
  • 107
177
votes
14 answers

How to list all installed packages and their versions in Python?

Is there a way in Python to list all installed packages and their versions? I know I can go inside python/Lib/site-packages and see what files and directories exist, but I find this very awkward. What I'm looking for something that is similar to npm…
jsalonen
  • 29,593
  • 15
  • 91
  • 109
174
votes
12 answers

Painless way to install a new version of R?

Andrew Gelman recently lamented the lack of an easy upgrade process for R (probably more relevant on Windows than Linux). Does anyone have a good trick for doing the upgrade, from installing the software to copying all the settings/packages…
Shane
  • 98,550
  • 35
  • 224
  • 217
173
votes
7 answers

Should I commit yarn.lock and package-lock.json files?

We're using yarn for all our deterministic pkg installations but don't prevent the user from using npm - I'm guessing having both these files will cause issues however. Should one be added to your .gitignore dir?
BisonAVC
  • 1,980
  • 2
  • 13
  • 12
171
votes
12 answers

How to make rpm auto install dependencies

I have built two RPM packages proj1-1.0-1.x86_64.rpm libtest1-1.0-1.x86_64.rpm proj1 depends on the file libtest1.so being present and it is reflected correctly in the RPM packages as seen here: user@my-pc:~$ rpm -qp --requires…
HAL
  • 3,888
  • 3
  • 19
  • 28
169
votes
21 answers

Check if Python Package is installed

What's a good way to check if a package is installed while within a Python script? I know it's easy from the interpreter, but I need to do it within a script. I guess I could check if there's a directory on the system that's created during the…
Kevin
  • 2,361
  • 2
  • 20
  • 20
168
votes
7 answers

Is it possible to change the package name of an Android app on Google Play?

I would like to know whether it is technically possible, not whether it is easy or not, to change the actual package name of an Android app that is on Google Play. What I mean by package name is the name that will show up in the URL. Please, can…
user2426316
  • 7,131
  • 20
  • 52
  • 83
168
votes
10 answers

How to organize large R programs?

When I undertake an R project of any complexity, my scripts quickly get long and confusing. What are some practices I can adopt so that my code will always be a pleasure to work with? I'm thinking about things like Placement of functions in source…
Dan Goldstein
  • 24,229
  • 18
  • 37
  • 41
167
votes
16 answers

How to npm publish specific folder but as package root

I have a project that include a gulp task for building and packaging the sources and release in a directory called dist. My goal is publish it as a npm package, but only my dist folder. The npm documentation says that I can use the files tag to…
robsonrosa
  • 2,548
  • 5
  • 23
  • 31
164
votes
7 answers

How to remove a package in sublime text 2

I would like to remove and/or deactivate the Emmet package in Sublime Text 2. Should I just remove the Emmet directory or what is the typical workflow for removal of a package?
thomasstephn
  • 3,775
  • 4
  • 24
  • 29