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;








7












$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?










share|improve this question











$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 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

















7












$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?










share|improve this question











$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 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













7












7








7


2



$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?










share|improve this question











$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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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












  • 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







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










1 Answer
1






active

oldest

votes


















9












$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.






share|improve this answer









$endgroup$








  • 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













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
);



);













draft saved

draft discarded


















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









9












$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.






share|improve this answer









$endgroup$








  • 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















9












$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.






share|improve this answer









$endgroup$








  • 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













9












9








9





$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.






share|improve this answer









$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.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jun 18 at 8:58









KubaKuba

109k12 gold badges215 silver badges551 bronze badges




109k12 gold badges215 silver badges551 bronze badges







  • 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












  • 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







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

















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?