Skip to content

Ideal Version of Enforcing Poetry Version #113

Open

Description

@keithrfung

This issue is somewhat related to #111 and #112 . The concern is to solve issues with poetry itself, both the DockerFile and MakeFile contain a reference to a specific version of poetry. The ideal version:

Running make environment for the first time would install a specific version of poetry (call it vX.Y)
Running make environment on an existing environment would ensure the correct version of poetry is installed
The docker container would use the correct poetry version in all cases
Our linting or CI could include some verification that the lock file is generated for the correct version of poetry (I haven't looked deeply enough at the lock file to know how hard this would be).

Activity

  1. changed the title [-]Better version of locking Poetry Version[/-] [+]Ideal Version of Enforcing Poetry Version[/+] on Oct 1, 2020
  2. TuTomasz commented on Oct 8, 2020

    @TuTomasz

    I had an idea how to possibly approach this issue.

    POETRY_VERSION = 1.0.10
    
    all: environment lint start
    
    environment:
    	@echo 🔧 SETUP
    	make install-gmp
    	@echo Check if need cleanup
    	[ -f ./.env ] && rm -r .env || echo env file not found
    	[ -f ./poetry.lock ] && rm -r poetry.lock || echo lock file not found
    	touch .env
    	@echo Install Poetry Version $(POETRY_VERSION)
    	pip install --upgrade --force-reinstall 'poetry==$(POETRY_VERSION)'
    	@echo Install Dependencies
    	poetry install
    	@echo POETRY_VERSION==$(POETRY_VERSION) > .env

    Something like this would possibly tackle the first two points of enforcing that the existing environment is always correct regenerating lock files and re-installing dependencies on version change. Also, generate .env with that specific Poetry version defined in the makefile (could be used for other future constants).

    This .env file would be used in docker-compose.yml and in dockerfile to pass the correct Poetry version (other constants) when generating containers. This would ensure the third point of containers always having the right Poetry version passed. All that is taken care of when you use "make environment".

    And lastly, for the fourth point, this approach regenerates a lock file on every "make environment" call so that way there shouldn't be any version conflicts and incompatible lock files. Let me know if I'm missing something here.

  3. keithrfung commented on Oct 6, 2021

    @keithrfung
    ContributorAuthor

    @TuTomasz You really hit it out of the park with that answer. I'm sorry I missed it. This seems like right approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions