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

Improvements to generate #2492

Merged
merged 9 commits into from
May 25, 2021
Merged

Conversation

pazner
Copy link
Contributor

@pazner pazner commented Apr 6, 2021

Following discussion in #1923, un-deprecates ] generate and makes several improvements:

Also, points users to PkgTemplates in the docstrings if they need more than the minimal functionality provided by generate.

Regarding #2168, perhaps the issue is not in generate and rather in parse_package_identifier (specifically this regex does not match "∂xxxxx", but Pkg.API.check_package_name("∂xxxxx") does not give an error). I am not clear on whether "∂xxxxx" is supposed to be a valid package name or not.

Mention that functionality is minimal, point users to PkgTemplates.jl if more
features are needed.
@anandijain
Copy link

Could you remove greet() = print("Hello World!") from the module? That's way too cute and annoying for practical use. A comment is much better suited than actually defining anything within the new env.

@anandijain
Copy link

Also thank you for working on this

@pazner
Copy link
Contributor Author

pazner commented Apr 8, 2021

Could you remove greet() = print("Hello World!") from the module? That's way too cute and annoying for practical use. A comment is much better suited than actually defining anything within the new env.

Done. I've had the same thought in the past.

src/generate.jl Outdated Show resolved Hide resolved
src/generate.jl Outdated
"""
module $pkg

greet() = print("Hello World!")
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this? I like having some function in here that does something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just because of this comment. Personally, I always found greet() = print("Hello World!") a bit weird, but I have no strong preference one way or the other.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function should not remove, there is nothing weird.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I reverted it

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boo 😔😔😔😔😔

Copy link
Contributor Author

@pazner pazner May 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't satisfy everyone 😄. We can do an emoji vote here to decide.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put it in the main issue this is buried

:arg_count => 1 => 1,
:arg_parser => ((x,y) -> map(expanduser, unwrap(x))),
:description => "generate files for a new project",
:help => md"""
generate pkgname

Create a project called `pkgname` in the current folder.
Create a minimal project called `pkgname` in the current folder. For more featureful package creation, please see `PkgTemplates.jl`.
Copy link
Sponsor Member

@johnnychen94 johnnychen94 Apr 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to not ship this redirection in the docstring, but instead in the documentation. We have no idea whether it is still PkgTemplates.jl five years later. If someone is still using Julia 1.7 five years later for unknown reasons, he doesn't get directed to the wrong place then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but keep in mind that currently, ] generate is deprecated in favor of PkgTemplates.jl with the deprecation warning: Pkg.generate is deprecated. Please use PkgTemplates.jl instead.

Incidentally, I think that makes a good case for having this "core" functionality built-in to Pkg.jl.

@pazner
Copy link
Contributor Author

pazner commented May 12, 2021

There were some conflicting opinions on whether the body of the generated module should contain greet() = print("Hello World!") or not (perhaps some other placeholder, such as # module contents).

What are people's opinions?

  • 👍 keep greet() = print("Hello World!")
  • 👎 delete it

@KristofferC KristofferC merged commit 2029bee into JuliaLang:master May 25, 2021
@KristofferC KristofferC added the backport 1.6 Change should be backported to release-1.6 label Dec 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.6 Change should be backported to release-1.6
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can we have docstring for Pkg.generate()? Cannot generate package when removing default env
8 participants