How to (optionally) suppress package welcome message?FeynRules PackagePackage Loading: How to get rid of Needs::nocont?What is the appropriate way to handle JVM memory issues in a Mathematica package?Where does a package have to be loaded?linking usage message to package documentationDisable “Load at Startup” checkbox in Add-Ons listWhy can't package call imported association list?How to install custom packagePackage MathWorldHow to load a package
Why won't the ground take my seed?
Who gets an Apparition licence?
What is "oversubscription" in Networking?
Can I ask to speak to my future colleagues before accepting an offer?
What does Mildred mean by this line in Three Billboards Outside Ebbing, Missouri?
Prime parity peregrination
Is there reliable evidence that depleted uranium from the 1999 NATO bombing is causing cancer in Serbia?
Why do I need two parameters in an HTTP parameter pollution attack?
How exactly is a normal force exerted, at the molecular level?
Was it really unprofessional of me to leave without asking for a raise first?
Is there any problem with this camera not having a lens cover?
Skipping over failed imports until they are needed (if ever)
Wrong corporate name on employment agreement
Why do the keys in the circle of fifths have the pattern of accidentals that they do?
Do the 26 richest billionaires own as much wealth as the poorest 3.8 billion people?
Why does a brace command group need spaces after the opening brace in POSIX Shell Grammar?
What are good ways to spray paint a QR code on a footpath?
One folder two different locations on ubuntu 18.04
Can a Federation colony become a member world?
Understanding Lasso Regression's sparsity geometrically
What is the highest number of sneak attacks that a Pure/High Level Rogue (Level 17+) can make in one round?
Does Anosov geodesic flow imply asphericity?
Is there a way for presidents to legally extend their terms beyond the maximum of four years?
Can I travel from Germany to England alone as an unaccompanied minor?
How to (optionally) suppress package welcome message?
FeynRules PackagePackage Loading: How to get rid of Needs::nocont?What is the appropriate way to handle JVM memory issues in a Mathematica package?Where does a package have to be loaded?linking usage message to package documentationDisable “Load at Startup” checkbox in Add-Ons listWhy can't package call imported association list?How to install custom packagePackage MathWorldHow to load a package
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
I'm working on a package and I want it to (usually) print a welcome message when it's loaded, primarily to leave a written trace of the version number in the notebook where it's used. For example:
BeginPackage["Test`"];
Test::usage="Testing";
Begin["`Private`"];
Print["Test Package Version 1.0"];
Test:=Print["123"];
End[];
EndPackage[];
<<Test`
(* Test Package Version 1.0 *)
However this gets cumbersome in the documentation pages I'm writing, so I'd like a way to omit the welcome message. Maybe with a semicolon, as:
Needs["Test`"];
(* silently loads package *)
However, the Print
inside the package doesn't care if Needs
has a semicolon or not. Is there some straightforward way to achieve this effect?
packages
$endgroup$
|
show 3 more comments
$begingroup$
I'm working on a package and I want it to (usually) print a welcome message when it's loaded, primarily to leave a written trace of the version number in the notebook where it's used. For example:
BeginPackage["Test`"];
Test::usage="Testing";
Begin["`Private`"];
Print["Test Package Version 1.0"];
Test:=Print["123"];
End[];
EndPackage[];
<<Test`
(* Test Package Version 1.0 *)
However this gets cumbersome in the documentation pages I'm writing, so I'd like a way to omit the welcome message. Maybe with a semicolon, as:
Needs["Test`"];
(* silently loads package *)
However, the Print
inside the package doesn't care if Needs
has a semicolon or not. Is there some straightforward way to achieve this effect?
packages
$endgroup$
2
$begingroup$
Instead of Print your could just return your string after EndPackage[].
$endgroup$
– Kuba♦
Jun 18 at 8:46
$begingroup$
@Kuba Thanks, I suspected there might be an easy way. I'd tried including the string, but not afterEndPackage[]
.
$endgroup$
– Chris K
Jun 18 at 8:49
$begingroup$
@Kuba Have you ever used this in practice? I'd like to read opinions about how well it works in practice. I never thought of this solution, but it looks to be very useful.
$endgroup$
– Szabolcs
Jun 18 at 8:51
$begingroup$
@Szabolcs It seems to work for me so far.
$endgroup$
– Chris K
Jun 18 at 8:54
$begingroup$
@Szabolcs I didn't have a use case for such message. Otoh the fewer side effects package loading has the better. Atm I don't see where this can lead to a problem.
$endgroup$
– Kuba♦
Jun 18 at 8:56
|
show 3 more comments
$begingroup$
I'm working on a package and I want it to (usually) print a welcome message when it's loaded, primarily to leave a written trace of the version number in the notebook where it's used. For example:
BeginPackage["Test`"];
Test::usage="Testing";
Begin["`Private`"];
Print["Test Package Version 1.0"];
Test:=Print["123"];
End[];
EndPackage[];
<<Test`
(* Test Package Version 1.0 *)
However this gets cumbersome in the documentation pages I'm writing, so I'd like a way to omit the welcome message. Maybe with a semicolon, as:
Needs["Test`"];
(* silently loads package *)
However, the Print
inside the package doesn't care if Needs
has a semicolon or not. Is there some straightforward way to achieve this effect?
packages
$endgroup$
I'm working on a package and I want it to (usually) print a welcome message when it's loaded, primarily to leave a written trace of the version number in the notebook where it's used. For example:
BeginPackage["Test`"];
Test::usage="Testing";
Begin["`Private`"];
Print["Test Package Version 1.0"];
Test:=Print["123"];
End[];
EndPackage[];
<<Test`
(* Test Package Version 1.0 *)
However this gets cumbersome in the documentation pages I'm writing, so I'd like a way to omit the welcome message. Maybe with a semicolon, as:
Needs["Test`"];
(* silently loads package *)
However, the Print
inside the package doesn't care if Needs
has a semicolon or not. Is there some straightforward way to achieve this effect?
packages
packages
edited Jun 18 at 14:50
user64494
4,1252 gold badges14 silver badges23 bronze badges
4,1252 gold badges14 silver badges23 bronze badges
asked Jun 18 at 8:35
Chris KChris K
8,7382 gold badges23 silver badges48 bronze badges
8,7382 gold badges23 silver badges48 bronze badges
2
$begingroup$
Instead of Print your could just return your string after EndPackage[].
$endgroup$
– Kuba♦
Jun 18 at 8:46
$begingroup$
@Kuba Thanks, I suspected there might be an easy way. I'd tried including the string, but not afterEndPackage[]
.
$endgroup$
– Chris K
Jun 18 at 8:49
$begingroup$
@Kuba Have you ever used this in practice? I'd like to read opinions about how well it works in practice. I never thought of this solution, but it looks to be very useful.
$endgroup$
– Szabolcs
Jun 18 at 8:51
$begingroup$
@Szabolcs It seems to work for me so far.
$endgroup$
– Chris K
Jun 18 at 8:54
$begingroup$
@Szabolcs I didn't have a use case for such message. Otoh the fewer side effects package loading has the better. Atm I don't see where this can lead to a problem.
$endgroup$
– Kuba♦
Jun 18 at 8:56
|
show 3 more comments
2
$begingroup$
Instead of Print your could just return your string after EndPackage[].
$endgroup$
– Kuba♦
Jun 18 at 8:46
$begingroup$
@Kuba Thanks, I suspected there might be an easy way. I'd tried including the string, but not afterEndPackage[]
.
$endgroup$
– Chris K
Jun 18 at 8:49
$begingroup$
@Kuba Have you ever used this in practice? I'd like to read opinions about how well it works in practice. I never thought of this solution, but it looks to be very useful.
$endgroup$
– Szabolcs
Jun 18 at 8:51
$begingroup$
@Szabolcs It seems to work for me so far.
$endgroup$
– Chris K
Jun 18 at 8:54
$begingroup$
@Szabolcs I didn't have a use case for such message. Otoh the fewer side effects package loading has the better. Atm I don't see where this can lead to a problem.
$endgroup$
– Kuba♦
Jun 18 at 8:56
2
2
$begingroup$
Instead of Print your could just return your string after EndPackage[].
$endgroup$
– Kuba♦
Jun 18 at 8:46
$begingroup$
Instead of Print your could just return your string after EndPackage[].
$endgroup$
– Kuba♦
Jun 18 at 8:46
$begingroup$
@Kuba Thanks, I suspected there might be an easy way. I'd tried including the string, but not after
EndPackage[]
.$endgroup$
– Chris K
Jun 18 at 8:49
$begingroup$
@Kuba Thanks, I suspected there might be an easy way. I'd tried including the string, but not after
EndPackage[]
.$endgroup$
– Chris K
Jun 18 at 8:49
$begingroup$
@Kuba Have you ever used this in practice? I'd like to read opinions about how well it works in practice. I never thought of this solution, but it looks to be very useful.
$endgroup$
– Szabolcs
Jun 18 at 8:51
$begingroup$
@Kuba Have you ever used this in practice? I'd like to read opinions about how well it works in practice. I never thought of this solution, but it looks to be very useful.
$endgroup$
– Szabolcs
Jun 18 at 8:51
$begingroup$
@Szabolcs It seems to work for me so far.
$endgroup$
– Chris K
Jun 18 at 8:54
$begingroup$
@Szabolcs It seems to work for me so far.
$endgroup$
– Chris K
Jun 18 at 8:54
$begingroup$
@Szabolcs I didn't have a use case for such message. Otoh the fewer side effects package loading has the better. Atm I don't see where this can lead to a problem.
$endgroup$
– Kuba♦
Jun 18 at 8:56
$begingroup$
@Szabolcs I didn't have a use case for such message. Otoh the fewer side effects package loading has the better. Atm I don't see where this can lead to a problem.
$endgroup$
– Kuba♦
Jun 18 at 8:56
|
show 3 more comments
1 Answer
1
active
oldest
votes
$begingroup$
Moving my comment to the answer: you can put your message after EndPackage[]
instead of printing it:
BeginPackage["Test`"];
Test::usage="Testing";
Begin["`Private`"];
Test:=Print["123"];
End[];
EndPackage[];
"Test Package Version 1.0"
It seems to do exactly what you want.
$endgroup$
3
$begingroup$
Reference from the documentation forGet
: "<<name
reads in a file, evaluating each expression in it and returning the last one."
$endgroup$
– Michael E2
Jun 18 at 22:50
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "387"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f200577%2fhow-to-optionally-suppress-package-welcome-message%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Moving my comment to the answer: you can put your message after EndPackage[]
instead of printing it:
BeginPackage["Test`"];
Test::usage="Testing";
Begin["`Private`"];
Test:=Print["123"];
End[];
EndPackage[];
"Test Package Version 1.0"
It seems to do exactly what you want.
$endgroup$
3
$begingroup$
Reference from the documentation forGet
: "<<name
reads in a file, evaluating each expression in it and returning the last one."
$endgroup$
– Michael E2
Jun 18 at 22:50
add a comment |
$begingroup$
Moving my comment to the answer: you can put your message after EndPackage[]
instead of printing it:
BeginPackage["Test`"];
Test::usage="Testing";
Begin["`Private`"];
Test:=Print["123"];
End[];
EndPackage[];
"Test Package Version 1.0"
It seems to do exactly what you want.
$endgroup$
3
$begingroup$
Reference from the documentation forGet
: "<<name
reads in a file, evaluating each expression in it and returning the last one."
$endgroup$
– Michael E2
Jun 18 at 22:50
add a comment |
$begingroup$
Moving my comment to the answer: you can put your message after EndPackage[]
instead of printing it:
BeginPackage["Test`"];
Test::usage="Testing";
Begin["`Private`"];
Test:=Print["123"];
End[];
EndPackage[];
"Test Package Version 1.0"
It seems to do exactly what you want.
$endgroup$
Moving my comment to the answer: you can put your message after EndPackage[]
instead of printing it:
BeginPackage["Test`"];
Test::usage="Testing";
Begin["`Private`"];
Test:=Print["123"];
End[];
EndPackage[];
"Test Package Version 1.0"
It seems to do exactly what you want.
answered Jun 18 at 8:58
Kuba♦Kuba
109k12 gold badges215 silver badges551 bronze badges
109k12 gold badges215 silver badges551 bronze badges
3
$begingroup$
Reference from the documentation forGet
: "<<name
reads in a file, evaluating each expression in it and returning the last one."
$endgroup$
– Michael E2
Jun 18 at 22:50
add a comment |
3
$begingroup$
Reference from the documentation forGet
: "<<name
reads in a file, evaluating each expression in it and returning the last one."
$endgroup$
– Michael E2
Jun 18 at 22:50
3
3
$begingroup$
Reference from the documentation for
Get
: "<<name
reads in a file, evaluating each expression in it and returning the last one."$endgroup$
– Michael E2
Jun 18 at 22:50
$begingroup$
Reference from the documentation for
Get
: "<<name
reads in a file, evaluating each expression in it and returning the last one."$endgroup$
– Michael E2
Jun 18 at 22:50
add a comment |
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f200577%2fhow-to-optionally-suppress-package-welcome-message%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
$begingroup$
Instead of Print your could just return your string after EndPackage[].
$endgroup$
– Kuba♦
Jun 18 at 8:46
$begingroup$
@Kuba Thanks, I suspected there might be an easy way. I'd tried including the string, but not after
EndPackage[]
.$endgroup$
– Chris K
Jun 18 at 8:49
$begingroup$
@Kuba Have you ever used this in practice? I'd like to read opinions about how well it works in practice. I never thought of this solution, but it looks to be very useful.
$endgroup$
– Szabolcs
Jun 18 at 8:51
$begingroup$
@Szabolcs It seems to work for me so far.
$endgroup$
– Chris K
Jun 18 at 8:54
$begingroup$
@Szabolcs I didn't have a use case for such message. Otoh the fewer side effects package loading has the better. Atm I don't see where this can lead to a problem.
$endgroup$
– Kuba♦
Jun 18 at 8:56