How to start and structure a new application?

Hi,

I just read the docs about Pkg.jl and there in the glossary we can find the definition of the three words project, package and application.

Project: is an umbrella term: packages and applications are kinds of projects
Package: Code that’s intended to be reused.
Application: Standalone code

Now let’s say I want to make a very small application that does something fancy called FancyApp. How exactly do I initiate such a new application and what’s its structure?

E.g. is there a command that generates me an dummy application (not a package)? Or could I just e.g. create the following empty files and directories:

FancyApp
- src/FancyApp.jl
- Manifest.toml
- Project.toml

Furthermore, is it possible to just navigate there with my own terminal and then do “julia” and julia knows “Ah, I’m in the application FancyApp”?

2 Likes

navigate there with my own terminal and then do “julia” and julia knows “Ah, I’m in the application FancyApp”?

You would still have to write ]activate . to actually activate the environment.

Read up on one way to automate this: https://bkamins.github.io/julialang/2020/05/10/julia-project-environments.html

Not quite but there’s generate integrated into Pkg. Read up on a possible workflow here: https://bkamins.github.io/julialang/2020/05/18/project-workflow.html

1 Like

Check out PkgTemplates.jl!

2 Likes

where? :slight_smile:

] generate

Yeah, I thought so. I hope that I can basically just create my application at and then cd path; julia; and it automatically set’s everything up like the environment. That’s not possible?

Sorry, forgot to paste the link. :smiley:

Thanks! I was googlin for such an article. It summarizes everything perfectly.

No problem. Bogumil’s blog is a gold mine, so don’t hesitate to read a few more of his articles. :slight_smile:

Otherwise don’t hesitate to just post here for bigger questions or on Slack/Zulip (whichever you prefer) for smaller or more casual questions.

1 Like

I don’t see why he checks for both, the Project.toml and the Manifest.toml.

If you use generate you only have a Project.toml and no Manifest.toml. The later only exists once you added dependencies.

So shouldn’t it rather only check for Project.toml?

He wrote:

We are informed that Project.toml and Manifest.toml were updated. Let us inspect their contents from within Julia as an exercise:

In general Manifest.toml contains the exact specification of all dependencies of our project (direct and recursive) and Project.toml lists only essential information about direct dependencies.

So he just checks for Manifest out of curiosity and to explain their differences. It’s not needed, of course. Just a little extra info for the interested reader.

Thanks