Git Product home page Git Product logo

flexlate-dev's Introduction

PyPI PyPI - License Documentation Tests Run on Ubuntu Python Versions Github Repo

flexlate-dev

Overview

Development tools for template authors using Flexlate

Getting Started

Install flexlate-dev:

pip install flexlate-dev

A simple example:

import flexlate_dev

# Do something with flexlate_dev

See a more in-depth tutorial here.

Links

See the documentation here.

Development Status

This project is currently in early-stage development. There may be breaking changes often. While the major version is 0, minor version upgrades will often have breaking changes.

Developing

Initial Setup

First, you need a couple global dependencies installed, see their documentation for details:

Note that these tools require a UNIX-style shell, such as bash or zsh. If you are on Windows, you can use WSL or Git Bash. If you are using Pycharm, you can configure the built-in terminal to use Git Bash.

Then clone the repo and run direnv allow. This will take a while on the first time to install the remaining dependencies.

Day to Day Development

Make your changes and then run just to run formatting, linting, and tests.

Develop documentation by running just docs to start up a dev server.

To run tests only, run just test. You can pass additional arguments to pytest, e.g. just test -k test_something.

Prior to committing, you can run just with no arguments to run all the checks.

Conventional Commits & Semantic Release

This project uses conventional commits to power semantic release. This means that when you commit, you should use the following format:

<type>[optional scope]: <description>

For example, feat: Add new feature or fix: Fix bug.

When creating a PR, please name the PR in this way as well so that the squashed commit from the PR will have a conventional commit message.

Pre-commit Hooks

This project uses Husky and Lint-staged to run pre-commit hooks. This means that when you commit, it will run just format and just strip on the files you edited, and also check that your commit message is a conventional commit.

If you are not able to commit, it is likely because your commit message is not in the conventional commit format.

Author

Created by Nick DeRobertis. MIT License.

flexlate-dev's People

Contributors

github-actions[bot] avatar nickderobertis avatar semantic-release-bot avatar

Stargazers

 avatar

Watchers

 avatar

flexlate-dev's Issues

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 9fe07eb96b8702c40f1248c… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 68fa0b20d416ea791a46bf1… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 89070159fd04c9efb3ccfb8… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

about adding new lines, set this back to "new content"

about adding new lines, set this back to "new content"

# After fixing the TODO about adding new lines, set this back to "new content"

        )


def test_server_back_syncs_changes_from_project_to_template_with_subdir_copier(
    copier_output_subdir_template_repo: Repo,
):
    template_path = Path(copier_output_subdir_template_repo.working_dir)
    template_output_path = template_path / "output"
    folder_name = "project"
    project_path = GENERATED_FILES_DIR / folder_name
    expect_file = project_path / "a1.txt"
    template_file = template_output_path / "{{ q1 }}.txt.jinja"
    non_templated_template_file = template_output_path / "README.md"
    non_templated_expect_file = project_path / "README.md"
    config = FlexlateDevConfig()
    with run_server(
        config, None, template_path, GENERATED_FILES_DIR, no_input=True, back_sync=True
    ) as context:
        project_repo = Repo(project_path)

        wait_until_path_exists(expect_file)
        # Check initial load
        assert expect_file.read_text() == "1"
        templated_modified_time = expect_file.lstat().st_mtime
        assert non_templated_expect_file.read_text() == "some existing content"
        assert non_templated_template_file.read_text() == "some existing content"
        non_templated_modified_time = non_templated_template_file.lstat().st_mtime

        # Cause a back sync
        non_templated_expect_file.write_text("new content")
        stage_and_commit_all(project_repo, "Trigger back sync")

        # Check back sync
        wait_until_file_has_content(
            # After fixing the TODO about adding new lines, set this back to "new content"
            non_templated_template_file,
            non_templated_modified_time,
            "new content\n",
        )

        wait_until_returns_true(
            lambda: not context.is_back_syncing, "Back sync is still running"
        )

        # Cause a reload
        template_file.write_text("new content {{ q2 }}")

        # Check reload
        wait_until_file_has_content(
            expect_file, templated_modified_time, "new content 1"
        )


def test_server_does_not_back_sync_a_forward_sync_change(
    copier_one_template_repo: Repo,
):
    template_path = Path(copier_one_template_repo.working_dir)
    folder_name = "project"
    project_path = GENERATED_FILES_DIR / folder_name
    expect_file = project_path / "a1.txt"
    non_templated_template_file = template_path / "README.md"
    non_templated_expect_file = project_path / "README.md"
    config = FlexlateDevConfig()
    with run_server(
        config, None, template_path, GENERATED_FILES_DIR, no_input=True, back_sync=True
    ) as context:
        template_repo = Repo(template_path)

        wait_until_path_exists(expect_file)
        # Check initial load
        assert expect_file.read_text() == "1"
        assert non_templated_expect_file.read_text() == "some existing content"
        assert non_templated_template_file.read_text() == "some existing content"
        non_templated_expect_modified_time = non_templated_expect_file.lstat().st_mtime

        # Check the most recent commit on the template repo. It should not change after forward sync
        last_commit_sha = template_repo.head.commit.hexsha

        # Cause a forward-sync
        non_templated_template_file.write_text("new content")

        # Check forward sync
        wait_until_file_has_content(
            non_templated_expect_file,
            non_templated_expect_modified_time,
            "new content",
        )

        # Wait for back-sync to finish sleeping, so it has a chance to run
        wait_until_returns_true(
            lambda: not context.back_sync_is_sleeping, "Back sync is still sleeping"
        )
        # Wait another half second so that back-sync definitely would have run if it was going to
        time.sleep(0.5)
        # Give time for potential back-sync to complete
        wait_until_returns_true(
            lambda: not context.is_back_syncing, "Back sync is still running"
        )

        # Last commit on template repo should not have changed after back-sync
        assert template_repo.head.commit.hexsha == last_commit_sha


# TODO: add tests for back sync cookiecutter
# TODO: add tests for auto-commit, need to set up temp git repos

c2cb6557dd0c25c1bc1dfd92638bca1228cee9e7

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 89070159fd04c9efb3ccfb8… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 68fa0b20d416ea791a46bf1… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 68fa0b20d416ea791a46bf1… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ c92b5c1f3fae3e9e9df04cb… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 89070159fd04c9efb3ccfb8… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ b0916a7b0b576ebc6441d1b… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ b0916a7b0b576ebc6441d1b… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 9fe07eb96b8702c40f1248c… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ b0916a7b0b576ebc6441d1b… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 9fe07eb96b8702c40f1248c… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ b0916a7b0b576ebc6441d1b… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ b0916a7b0b576ebc6441d1b… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 9fe07eb96b8702c40f1248c… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

for some reason the patch library will add a new line to the end of the file

for some reason the patch library will add a new line to the end of the file

even when it is not supposed to have one

# TODO: for some reason the patch library will add a new line to the end of the file

import threading
import time
from pathlib import Path
from typing import Optional, Union, cast

import patch
from git import Repo
from unidiff import PatchedFile, PatchSet

from flexlate_dev.dirutils import change_directory_to
from flexlate_dev.ext_flexlate import (
    get_flexlate_branch_names_from_project_path,
    get_non_flexlate_commits_between_commits,
    get_render_relative_root_in_template_from_project_path,
)
from flexlate_dev.ext_threading import PropagatingThread
from flexlate_dev.gitutils import stage_and_commit_all, temporary_branch_from_commits
from flexlate_dev.logger import log
from flexlate_dev.server.sync import SyncServerManager, pause_sync
from flexlate_dev.styles import INFO_STYLE, print_styled


def get_last_commit_sha(repo: Repo) -> str:
    return repo.head.commit.hexsha


def get_diff_between_commits(repo: Repo, sha1: str, sha2: str) -> PatchSet:
    diff_str = repo.git.diff(sha1, sha2)
    return PatchSet(diff_str)


def commit_in_one_repo_with_another_repo_commit_message(
    repo: Repo,
    other_repo: Repo,
    commit_sha: str,
) -> None:
    commit_message = repo.commit(commit_sha).message
    # Convert commit message to str if it is a bytes object
    if isinstance(commit_message, bytes):
        message_str = commit_message.decode("utf-8")
    else:
        message_str = commit_message
    print_styled(f"Committing change: {message_str}", INFO_STYLE)
    stage_and_commit_all(other_repo, message_str)


def _relative_path_from_diff_path(diff_path: str) -> Optional[Path]:
    """
    Converts a git diff path in the following formats:
    a/path/file.txt
    b/file.txt
    b/path/file.txt

    To the relative paths:
    path/file.txt
    file.txt
    path/file.txt

    :param diff_path: diff path from git diff
    :return: relative with without a/ or b/ prefix
    """
    if diff_path.startswith("a/"):
        return Path(diff_path[2:])
    elif diff_path.startswith("b/"):
        return Path(diff_path[2:])
    elif diff_path == "/dev/null":
        return None
    else:
        raise ValueError(f"Unknown diff path {diff_path}")


def apply_diff_between_commits_to_separate_project(
    repo: Repo, sha1: str, sha2: str, project_path: Path
) -> None:
    diff = get_diff_between_commits(repo, sha1, sha2)
    apply_diff_to_project(project_path, diff)


def apply_diff_to_project(project_path: Path, diff: PatchSet) -> None:
    log.debug(f"Applying to {project_path}:\n{diff}")
    for file_diff in diff:
        apply_file_diff_to_project(project_path, file_diff)


def _get_content_from_file_added_diff(diff: PatchedFile) -> str:
    # Combine lines
    return "\n".join(["".join([line.value for line in hunk]) for hunk in diff])


def _apply_patch(diff: Union[PatchedFile, PatchSet, str], project_path: Path) -> None:
    # TODO: for some reason the patch library will add a new line to the end of the file
    #  even when it is not supposed to have one
    patch_set = patch.fromstring(str(diff).encode("utf-8"))
    with change_directory_to(project_path):
        patch_set.apply()
    return


def is_pure_rename(diff: PatchedFile) -> bool:
    return diff.is_rename and "similarity index 100%" in str(diff.patch_info)


def apply_file_diff_to_project(project_path: Path, diff: PatchedFile) -> None:
    def project_file_path(diff_path: str) -> Optional[Path]:
        file_path = _relative_path_from_diff_path(diff_path)
        if file_path is None:
            return None
        return project_path / file_path

    log.debug(
        f"Applying diff {diff.source_file} to {diff.target_file} in {project_path}"
    )
    target_path = project_file_path(diff.target_file)
    source_path = project_file_path(diff.source_file)

    def rename():
        target_path.parent.mkdir(parents=True, exist_ok=True)
        source_path.rename(target_path)

    if diff.is_added_file:
        out_path = cast(Path, target_path)
        content = _get_content_from_file_added_diff(diff)
        out_path.parent.mkdir(parents=True, exist_ok=True)
        out_path.write_text(content)
    elif diff.is_removed_file:
        out_path = cast(Path, source_path)
        out_path.unlink()
    elif is_pure_rename(diff):
        rename()
    elif diff.is_rename:
        # Rename with modifications
        rename()
        _apply_patch(diff, project_path)
    elif diff.is_modified_file:
        # Modifications in place
        _apply_patch(diff, project_path)
    else:
        raise NotImplementedError("Unknown diff type")


class BackSyncServer:
    def __init__(
        self,
        template_path: Path,
        project_folder: Path,
        sync_manager: SyncServerManager,
        auto_commit: bool = True,
        check_interval_seconds: int = 1,
    ):
        super().__init__()
        self.template_path = template_path
        self.project_folder = project_folder
        self.sync_manager = sync_manager
        self.auto_commit = auto_commit
        self.check_interval_seconds = check_interval_seconds

        self.project_repo: Repo = Repo(self.project_folder)
        self.template_repo: Repo = Repo(
            self.template_path, search_parent_directories=True
        )
        self.last_commit = get_last_commit_sha(self.project_repo)
        self.thread: Optional[threading.Thread] = None
        self.is_syncing = False
        self.is_sleeping = False
        self.template_output_path = (
            self.template_path
            / get_render_relative_root_in_template_from_project_path(
                self.project_folder
            )
        )
        self.branch_names = get_flexlate_branch_names_from_project_path(
            self.project_folder
        )

    def start(self):
        if self.thread is not None:
            raise RuntimeError("Already started")
        # Run start_sync on a background thread
        self.thread = PropagatingThread(target=self.start_sync, daemon=True)
        self.thread.start()

    def stop(self):
        if self.thread is not None:
            log.debug("Killing back sync thread")
            self.thread.join(timeout=0.1)
            self.thread = None

    def start_sync(self):
        while True:
            new_commit = get_last_commit_sha(self.project_repo)
            if self.last_commit == new_commit:
                self._sleep()
                continue
            self.sync()
            self.last_commit = new_commit
            self._sleep()

    def sync(self):
        self.is_syncing = True
        try:
            self._sync()
        finally:
            self.is_syncing = False

    def _sleep(self):
        self.is_sleeping = True
        time.sleep(self.check_interval_seconds)
        self.is_sleeping = False

    def _sync(self):
        last_commit = self.project_repo.commit(self.last_commit)
        new_commit = self.project_repo.commit(get_last_commit_sha(self.project_repo))
        new_commits = get_non_flexlate_commits_between_commits(
            self.project_repo,
            last_commit,
            new_commit,
            self.branch_names.merged_branch_name,
            self.branch_names.template_branch_name,
        )
        if not new_commits:
            log.debug("Skipping back-sync as there are no non-flexlate commits")
            return
        print_styled(
            f"Back-syncing commits: {[f'{commit.hexsha}: {commit.message}' for commit in new_commits]}",
            INFO_STYLE,
        )
        with pause_sync(self.sync_manager):
            with temporary_branch_from_commits(
                self.project_repo, last_commit, new_commits
            ) as branch_info:
                last_commit_sha = self.last_commit
                for new_commit_sha in branch_info.commit_shas:
                    apply_diff_between_commits_to_separate_project(
                        self.project_repo,
                        last_commit_sha,
                        new_commit_sha,
                        self.template_output_path,
                    )
                    if self.auto_commit:
                        commit_in_one_repo_with_another_repo_commit_message(
                            self.project_repo, self.template_repo, new_commit_sha
                        )
                    last_commit_sha = new_commit_sha

    def __enter__(self) -> "BackSyncServer":
        self.start()
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        self.stop()

47817abb7bd6605bf7f1435d52208ad2e56fccda

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 68fa0b20d416ea791a46bf1… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

check that the file is correct

check that the file is correct

# TODO: check that the file is correct

from unidiff import PatchedFile

from flexlate_dev.server.back_sync import apply_file_diff_to_project
from tests.config import (
    GENERATED_FILES_DIR,
    MODIFIED_FILE,
    RENAMED_AND_MODIFIED_FILE,
    RENAMED_FILE,
)
from tests.fixtures.diff import (
    file_added_diff,
    file_modified_diff,
    file_removed_diff,
    file_renamed_and_modified_diff,
    file_renamed_diff,
)
from tests.fixtures.repo import flexlate_dev_repo
from tests.fixtures.temp_dir import inside_generated_dir


def test_apply_added_file_diff_to_project(
    file_added_diff: PatchedFile, inside_generated_dir: None
):
    out_dir = GENERATED_FILES_DIR
    expect_file = "setup.cfg"
    expect_path = out_dir / expect_file
    apply_file_diff_to_project(out_dir, file_added_diff)

    assert expect_path.exists()
    assert expect_path.read_text() == "[metadata]\nversion = 0.17.1\n"
    # TODO: check that the file is correct


def test_apply_removed_file_diff_to_project(
    file_removed_diff: PatchedFile, inside_generated_dir: None
):
    out_dir = GENERATED_FILES_DIR
    expect_path = out_dir / "docsrc" / "source" / "_static" / "custom.css"
    expect_path.parent.mkdir(parents=True, exist_ok=True)
    expect_path.touch()
    apply_file_diff_to_project(out_dir, file_removed_diff)

    assert not expect_path.exists()


def test_apply_renamed_file_diff_to_project(
    file_renamed_diff, inside_generated_dir: None
):
    out_dir = GENERATED_FILES_DIR
    common_path = out_dir / "flexlate_dev"
    orig_path = common_path / "gituitls.py"
    moved_to_path = common_path / "gitutils.py"
    orig_file_content = RENAMED_FILE.read_text()
    orig_path.parent.mkdir(parents=True, exist_ok=True)
    orig_path.write_text(orig_file_content)
    assert not moved_to_path.exists()

    apply_file_diff_to_project(out_dir, file_renamed_diff)

    assert not orig_path.exists()
    assert moved_to_path.exists()


def test_apply_renamed_and_modified_file_diff_to_project(
    file_renamed_and_modified_diff, inside_generated_dir: None
):
    out_dir = GENERATED_FILES_DIR
    common_path = out_dir / "flexlate_dev"
    orig_path = common_path / "server.py"
    moved_to_path = common_path / "server" / "sync.py"
    orig_path.parent.mkdir(parents=True, exist_ok=True)
    orig_file_content = RENAMED_AND_MODIFIED_FILE.read_text()
    orig_path.write_text(orig_file_content)
    assert not moved_to_path.exists()

    apply_file_diff_to_project(out_dir, file_renamed_and_modified_diff)

    assert not orig_path.exists()
    assert moved_to_path.exists()

    # Check that the file was also modified
    assert "def serve_template" not in moved_to_path.read_text()


def test_apply_modified_file_diff_to_project(
    file_modified_diff: PatchedFile, inside_generated_dir: None
):
    out_dir = GENERATED_FILES_DIR
    expect_file = "setup.cfg"
    expect_path = out_dir / expect_file
    orig_file_content = MODIFIED_FILE.read_text()
    expect_path.parent.mkdir(parents=True, exist_ok=True)
    expect_path.write_text(orig_file_content)
    assert "0.20.0" not in orig_file_content

    apply_file_diff_to_project(out_dir, file_modified_diff)

    assert expect_path.exists()
    new_file_content = expect_path.read_text()
    assert new_file_content != orig_file_content
    assert "0.20.0" in new_file_content

7d6e40548fef74d92f2d0612d6e80dbaa10e4212

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 68fa0b20d416ea791a46bf1… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Need a better wait to wait until the server has processed the change, perhaps ca...

Need a better wait to wait until the server has processed the change, perhaps can expose events from the server

The default ignore is in the .git directory, and so it should never exist.

# TODO: Need a better wait to wait until the server has processed the change, perhaps can expose events from the server

        # Check reload
        wait_until_file_has_content(expect_file, modified_time, "new content 4")


def test_server_ignores_changes_to_ignored_files(
    copier_one_template_path: Path,
):
    template_path = copier_one_template_path
    project_path = GENERATED_FILES_DIR / "project"
    default_ignored_template_file = template_path / ".git" / "something.txt"
    default_ignored_template_file.parent.mkdir()
    default_ignored_template_file.write_text("initial content")
    default_ignored_expect_file = project_path / ".git" / "something.txt"
    custom_ignored_template_file = template_path / "ignored.txt"
    custom_ignored_template_file.write_text("initial content")
    custom_ignored_expect_file = project_path / "ignored.txt"
    expect_file = project_path / "a1.txt"
    template_file = template_path / "{{ q1 }}.txt.jinja"
    config = FlexlateDevConfig.load(IGNORES_AND_EXTEND_DATA_PATH)
    with run_server(config, None, template_path, GENERATED_FILES_DIR, no_input=True):
        wait_until_path_exists(expect_file)
        wait_until_path_exists(custom_ignored_expect_file)
        assert not default_ignored_expect_file.exists()
        # Check initial load
        assert expect_file.read_text() == "2"
        assert custom_ignored_expect_file.read_text() == "initial content"

        # Should not reload from a change to the custom or default ignored file
        custom_ignored_template_file.write_text("new content")
        default_ignored_template_file.write_text("new content")

        # TODO: Need a better wait to wait until the server has processed the change, perhaps can expose events from the server
        time.sleep(5)

        # Files should be unchanged
        assert expect_file.read_text() == "2"
        assert not default_ignored_expect_file.exists()
        assert custom_ignored_expect_file.read_text() == "initial content"

        # Cause a reload
        modified_time = expect_file.lstat().st_mtime
        template_file.write_text("new content {{ q2 }}")

        # Check reload
        wait_until_file_has_content(expect_file, modified_time, "new content 2")
        # Should have updated the files that were ignored. Content still updates once they actually do get reloaded.
        # The default ignore is in the .git directory, and so it should never exist.
        assert custom_ignored_expect_file.read_text() == "new content"
        assert not default_ignored_expect_file.exists()

617e6296388346b009124a68e57e49fabd7902c6

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 9fe07eb96b8702c40f1248c… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 68fa0b20d416ea791a46bf1… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

get version statically inside package by restructuring template

get version statically inside package by restructuring template

# TODO: get version statically inside package by restructuring template

# TODO: get version statically inside package by restructuring template
import pkg_resources
from flexlate.get_version import get_flexlate_version


def get_flexlate_dev_version() -> str:
    return pkg_resources.get_distribution("flexlate-dev").version

0242e4caaf6fc3558f18fb4f72b340b039609f15

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 89070159fd04c9efb3ccfb8… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 89070159fd04c9efb3ccfb8… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ 68fa0b20d416ea791a46bf1… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but the current updates include changes to the Github Actions workflow files, and Github Actions does not allow those to be updated by another workflow.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ 17a027c62ef31bef4c5c9a… β”‚ a4e29acb94c1eb53c49d0e4… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Allow passing options to Jinja environment

Allow passing options to Jinja environment

# TODO: Allow passing options to Jinja environment

    known_folder_name: Optional[str] = None,
    default_folder_name: str = DEFAULT_PROJECT_NAME,
) -> str:
    # TODO: Allow passing options to Jinja environment
    jinja_env = create_jinja_environment()

    def init_project() -> str:
        return initialize_project_get_folder(
            template_path,
            out_root,
            config,
            run_config,
            jinja_env,
            no_input=no_input,
            data=data,
            save=save,

204d6eb24e598bc402587f10053aa5522c3cb5fc

Manual Update to Files from Copier Needed

The template from the Copier that created this project must be updated using Flexlate.

Normally this is an automated process, but there were merge conflicts while applying the update.

Run pipenv run fxt update -n then manually review and update the changes, before pushing a PR
for this.

πŸ“ Some templates are not up to date. Run fxt update to update
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Template Name ┃ Current Version ┃ Latest Version ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ copier-pypi-sphinx-fle… β”‚ bc97a3fd5f4390aebe817f… β”‚ b0916a7b0b576ebc6441d1b… β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.