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

Add support for Poetry #13

Closed
ehmatthes opened this issue Oct 29, 2021 · 6 comments
Closed

Add support for Poetry #13

ehmatthes opened this issue Oct 29, 2021 · 6 comments

Comments

@ehmatthes
Copy link
Owner

I've been looking forward to trying Poetry for a while, this should be fun. :)

@ehmatthes
Copy link
Owner Author

ehmatthes commented Oct 29, 2021

  • Build a local sample project using Poetry.
    • Add editable version of simple-deploy.
    • Try poetry run python manage.py check, poetry shell and then python manage.py check.
    • Run the project locally.
    • Worked: poetry shell, pip install -e /local/path/to/django-simple-deploy, manage.py check
  • Add to sample project repo.
    • With a pyproject.toml file, but no poetry.lock
    • Try to build an environment from this project manually before moving on.
  • Modify simple_deploy.py to support the Poetry-based projects.
    • If this isn't working, try it manually (ie adding gunicorn to existing pyproject.toml, etc)
  • Update tests to include an option to test Poetry-based deployments.
  • Update all documentation.
  • Test all dep man approaches
    • poetry
    • requirements.txt
    • pipenv
  • Merge
  • Build new release
  • Test release
    • req_txt
    • poetry (needed manual cache clear)
    • pipenv

@ehmatthes
Copy link
Owner Author

ehmatthes commented Oct 29, 2021

Notes

This is the first time I'm using Poetry, so some notes:

  • Will focus on pyproject.toml file.
  • In project with no dependencies yet, use the following commands:
    • poetry init
    • poetry add django
    • poetry add django-bootstrap4
  • It seems like Heroku does not yet support Poetry, or pyproject.toml, so maybe use Poetry to generate a requirements.txt file and call it good?
  • Could also set a buildpack that works with Poetry.
  • Start, exit venv: poetry shell, exit
  • venv info: poetry env info
  • Destroy venv: poetry env remove 3.10 more here
  • Opposite of poetry add is poetry remove.
  • Poetry seems to have issues with specifying "*" as package version, so specify more recent versions of each related package. No issue, just need to regenerate lock file before installing (after manually modifying pyproject.toml)?

@ehmatthes
Copy link
Owner Author

ehmatthes commented Oct 30, 2021

More notes

  • Works from a fresh copy of project with only pyproject.toml, with "*" version spec:
    • poetry shell, poetry lock, poetry install, pip install -e /local/path/to/django-simple-deployo

@ehmatthes
Copy link
Owner Author

ehmatthes commented Oct 31, 2021

Cleanup

  • Let requirements.txt file presence take precedence over any other approach.
    • Simplify _inspect_project() with this in mind.
    • (Comment explaining current thinking on this.)
  • Add comment to requirements.txt that file was generated during simple_deploy run.

@ehmatthes
Copy link
Owner Author

ehmatthes commented Oct 31, 2021

Ugh

  • How is this passing the test using a release that doesn't support Poetry, in a poetry project? (./autoconfigure_deploy_test.sh -t pypi -d poetry passes, which means it's using the 0.1.4 release that doesn't have any poetry-specific code in it, on a project that shouldn't have a requirements.txt file.)
    • Final conclusion: cache issue was causing it to use local code, even though it was reporting pypi code? Only reasonable explanation at this point.
    • Run the test, but examine the sample project before destroying it.
    • Try this manually, using pypi django-simple-deploy in the poetry-based sample project.
      • Fails here, as expected. There's no requirements.txt, and it doesn't create one.
  • poetry cache clear --all pypi may help. (tried this in the manual attempt)
  • Test script is working better now; it seems to be using the tmp environment? I think the cache may have been affecting test runs. The -t pypi -d poetry is failing now, as it should.
  • If this happens again, bump the version number temporarily and see if that shows up in the installed version. ie, that should confirm whether it's installing django-simple-deploy from pypi or from a local repo.

@ehmatthes
Copy link
Owner Author

Always good to close an issue associated with a new release. :)

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

No branches or pull requests

1 participant