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

copier: init at 7.0.1 #145528

Closed
wants to merge 6 commits into from
Closed

copier: init at 7.0.1 #145528

wants to merge 6 commits into from

Conversation

jonringer
Copy link
Contributor

@jonringer jonringer commented Nov 11, 2021

Motivation for this change

Thought I would try my hand at packaging this, someone mentioned they had great difficulty doing so, and I would agree.

https://discourse.nixos.org/t/buildpythonpackage-throwing-dependency-version-errors-when-i-dont-belive-it-should-be/15818

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/buildpythonpackage-throwing-dependency-version-errors-when-i-dont-belive-it-should-be/15818/2

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/buildpythonpackage-throwing-dependency-version-errors-when-i-dont-belive-it-should-be/15818/3

pkgs/tools/misc/copier/default.nix Outdated Show resolved Hide resolved
pkgs/tools/misc/copier/default.nix Outdated Show resolved Hide resolved
pkgs/tools/misc/copier/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/dunamai/default.nix Outdated Show resolved Hide resolved
];

# no tests include in sdist, and source not available
doCheck = false;
Copy link
Member

Choose a reason for hiding this comment

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

The upstream repo contains a couple of tests.

jinja2
tomlkit
];

Copy link
Member

Choose a reason for hiding this comment

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

Tests would be available if the source from GitHub is used.

pyyaml
setuptools-scm
setuptools-scm-git-archive
toml
Copy link
Member

Choose a reason for hiding this comment

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

That should be part of setuptools-scm actually.

pkgs/development/python-modules/plumbum/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/plumbum/default.nix Outdated Show resolved Hide resolved
@samuelludwig
Copy link

samuelludwig commented Nov 14, 2021

Unfortunately it seems the main functionality of this package is broken atm, in a similar way as to when I made my attempt.

${copier} --help correctly prints what's expected, however, beyond this help message, little works as it ought to:

If you set up a simple template like so:

mkdir my-template
cd my-template
echo "filename:
  type: str
  help: What's the name of the file?
  default: myDefaultName
  " > copier.yml
echo "Hi, I'm [[ filename ]]" > '[[ filename ]].txt.tmpl'

and then run copier my-template cop-test

you should get a prompt requesting a value for filename, supposing we entered "working", in cop-test there should then be one file named working.txt with the contents "Hi, I'm working".

When this package is used, versus the copier installed via pipx, a similar (but not identical) prompt appears, and seems to accept a value, however you will find that only the raw file is copied over, with no substitutions done. So in cop-test there will be a file named '[[ filename ]].txt.tmpl' with the contents "Hi, I'm [[ filename ]]".

@jonringer
Copy link
Contributor Author

When this package is used, versus the copier installed via pipx, a similar (but not identical) prompt appears, and seems to accept a value, however you will find that only the raw file is copied over, with no substitutions done. So in cop-test there will be a file named '[[ filename ]].txt.tmpl' with the contents "Hi, I'm [[ filename ]]".

This seems to be intended behavior https://github.com/copier-org/copier/blob/master/CHANGELOG.md#changed

We use Jinja 2 defaults now. {{ }} instead of [[ ]] and similar.

One thing to note is that I'm packaging off their master since it's more coherent with the rest of python packages. Breaking changes won't be reflected.

@samuelludwig
Copy link

samuelludwig commented Nov 16, 2021

When this package is used, versus the copier installed via pipx, a similar (but not identical) prompt appears, and seems to accept a value, however you will find that only the raw file is copied over, with no substitutions done. So in cop-test there will be a file named '[[ filename ]].txt.tmpl' with the contents "Hi, I'm [[ filename ]]".

This seems to be intended behavior https://github.com/copier-org/copier/blob/master/CHANGELOG.md#changed

We use Jinja 2 defaults now. {{ }} instead of [[ ]] and similar.

One thing to note is that I'm packaging off their master since it's more coherent with the rest of python packages. Breaking changes won't be reflected.

oh no... that means i might have had it in an actual working state before... my apologies, thank you, I at least for sure didn't properly package any of the dependencies for nix as you did here

EDIT: After more testing, they changed the default template extension too from .tmpl to .jinja! I didn't even see that in the changelog!

I will name one of my children after you

@hhoeflin
Copy link
Contributor

Would be great if this could be merged! Thanks

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/707

@jonringer
Copy link
Contributor Author

related issue: mtkennerly/poetry-dynamic-versioning#62

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/help-building-pdm-based-python-package/18256/2


python3.pkgs.buildPythonApplication rec {
pname = "copier";
version = "unstable-2021-11-10";
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW Copier 6 was recently released. You'd probably prefer to package that?

@Artturin Artturin changed the title copier: init at unstable-2021-11-10 copier: init at 7.0.1 Jan 7, 2023
@Artturin Artturin force-pushed the package-copier branch 2 times, most recently from db05cbc to 50710bf Compare January 7, 2023 03:57
@Artturin Artturin changed the base branch from master to staging-next January 7, 2023 03:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants