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

Keep trailing newlines from templates #1808

Merged
merged 1 commit into from
Oct 17, 2023

Conversation

nils-werner
Copy link
Contributor

Both rustfmt and pycodestyle/PEP8 require a trailing newline in code files. These newlines are produced by most code editors and are there in the code templates, however minijinja is configured to remove any trailing newlines. This means maturin produces templates that don't adhere to the code styles in both Rust an Python.

This PR

  1. Bumps the minijinja requirement to 1.0.7 (that's when the option was introduced)
  2. Sets Environment::set_keep_trailing_newline(true)

I'm relatively new to Rust and Cargo, and I am a bit worried by the massive change in Cargo.lock. Is this supposed to happen, or did I do something wrong?

@netlify
Copy link

netlify bot commented Oct 17, 2023

Deploy Preview for maturin-guide ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 95ee7b5
🔍 Latest deploy log https://app.netlify.com/sites/maturin-guide/deploys/652e695ac3f70200089370bc
😎 Deploy Preview https://deploy-preview-1808--maturin-guide.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@nils-werner nils-werner changed the title Keep trailing newlines fro templates Keep trailing newlines from templates Oct 17, 2023
@messense
Copy link
Member

I'm relatively new to Rust and Cargo, and I am a bit worried by the massive change in Cargo.lock. Is this supposed to happen, or did I do something wrong?

Don't run cargo update, cargo build will take care of it automatically when Cargo.toml changed.

@nils-werner
Copy link
Contributor Author

Don't run cargo update, cargo build will take care of it automatically when Cargo.toml changed.

Ah, thanks! I've force-pushed an amendment to get rid of the mess.

Copy link
Member

@messense messense left a comment

Choose a reason for hiding this comment

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

Thanks!

@messense messense merged commit 2cb2274 into PyO3:main Oct 17, 2023
29 of 32 checks passed
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Nov 7, 2023
https://build.opensuse.org/request/show/1123696
by user mia + anag+factory
- Update to 1.3.1
  * Use external uniffi-bindgen if no root package is configured
    gh#PyO3/maturin#1797
  * Add trusted publishing section to the user guide
    gh#PyO3/maturin#1800
  * Fix wheel filename for GraalPy
    gh#PyO3/maturin#1802
  * Pytest skeleton in mixed template
    gh#PyO3/maturin#1807
  * Keep trailing newlines from templates
    gh#PyO3/maturin#1808
  * Bump rustix from 0.37.23 to 0.37.25
    gh#PyO3/maturin#1809
  * Auto detect Python 3.13
    gh#PyO3/maturin#1810
  * Fix missing workspace.members in sdist
    gh#PyO3/maturin#1811
  * Don't set MACOSX_DEPLOYMENT_TARGET for editable builds
    gh#PyO3/maturin#1815
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants