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

Support Poetry on Fly #203

Closed
6 tasks done
ehmatthes opened this issue Dec 15, 2022 · 6 comments
Closed
6 tasks done

Support Poetry on Fly #203

ehmatthes opened this issue Dec 15, 2022 · 6 comments
Labels
fly.io poetry Related to projects that use Poetry.

Comments

@ehmatthes
Copy link
Owner

ehmatthes commented Dec 15, 2022

I believe fly deployments fail on the restructure_pkg_man branch right now, because we no longer generate a requirements.txt file in simple_deploy when using Poetry, and the fly deploy script is doing nothing to respond to poetry specifically.

  • Run fly poetry integration test, expect to fail.
  • Write an add_poetry_package() method for simple_deploy.py.
    • Consider a group called deploy, and make these requirements optional so they're not required for local builds.
  • Make a poetry version of Dockerfile.
  • Make a poetry version of fly.toml, if needed. (not needed)
  • Pass integration tests. (Commit 820bcee passes.)
@ehmatthes ehmatthes added fly.io dependency management Relating to dependency management specifications poetry Related to projects that use Poetry. and removed dependency management Relating to dependency management specifications labels Dec 15, 2022
@ehmatthes
Copy link
Owner Author

ehmatthes commented Dec 15, 2022

Adding poetry packages for remote use only

  • Define an optional group in pyproject.toml ie [tool.poetry.group.deploy]
    • Can I create a group through the cli? (not that I can find)
    • I don't think so, so check if the group exists and then add it if not.
  • In simple_deploy.py, call add_poetry_package() from add_package() when poetry detected.
  • Use poetry add package_name --group deploy (No, this doesn't install which is good, but it does rewrite lock file, which we don't want.)
  • On remote server, command for installation is poetry install ---with deploy
  • We probably want to use --skip-lock, and let end users choose when to lock again. (No, this is a pipenv option not poetry.)

@ehmatthes
Copy link
Owner Author

Poetry experiment

Quick demo for trying out poetry installation commands.

$ mkdir poetry_install_test && cd poetry_install_test
$ python3 -m venv venv
$ source venv/bin/activate
$ poetry init
$ poetry add django
# Modify pyproject.toml to have a group "deploy", with "optional" property.
# Add gunicorn and dj-database-url to this group.
$ poetry install
# should not install gunicorn, dj-database-url
$ poetry install --with deploy
# should install gunicorn, dj-database-url

I'm not entirely sure how all of this impacts the poetry.lock file, ie can you install the optional group without updating the lock file?

@ehmatthes
Copy link
Owner Author

pyproject.toml

This is what pyproject.toml should look like:

...
[tool.poetry.group.deploy]
optional = true

[tool.poetry.group.deploy.dependencies]
gunicorn = "*"
dj-database-url = "*"

@ehmatthes
Copy link
Owner Author

ehmatthes commented Dec 15, 2022

Other tasks

  • Note in documentation somewhere that running manage.py simple_deploy --platform platform_name --unit-testing against a test project simulates a configuration run.
  • Take a closer look at pkg_present in _add_req_txt_pkg(). It looks like django would not be added if django-anything was already installed.
    • Write a test for this?

@ehmatthes
Copy link
Owner Author

ehmatthes commented Dec 16, 2022

Modify dockerfile to use Poetry

  • Write a dockerfile_poetry template which uses poetry instead of pip.

@ehmatthes
Copy link
Owner Author

This feels great. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fly.io poetry Related to projects that use Poetry.
Projects
None yet
Development

No branches or pull requests

1 participant