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

Convert the project from setuptools -> poetry #52

Merged
merged 22 commits into from
May 20, 2020
Merged

Convert the project from setuptools -> poetry #52

merged 22 commits into from
May 20, 2020

Conversation

tarkatronic
Copy link
Contributor

@tarkatronic tarkatronic commented May 6, 2020

This sets us up with Poetry instead of setuptools. This way we actually have a legit package manager, dev environment manager, deterministic builds, etc etc etc.

Steps for this to be considered complete:

  • Move setup.py metadata into pyproject.toml
  • Update sphinx to pull version from pyproject.toml
  • Update tox to work with/use Poetry
  • Update Dockerfile to work with/use Poetry
  • Update build script(s) to work with/use Poetry
  • Update Travis config to use Poetry
  • Update contributing docs to guide users on using Poetry
  • Deprecate setup.cfg
    • Move config to pyproject.toml where possible
    • Otherwise, move to tool-specific config file
    • Bonus: Bring other config files into pyproject.coml where possible

I'm pretty sure that's all that's left... I will add any other things here which pop up.

@codecov
Copy link

codecov bot commented May 12, 2020

Codecov Report

Merging #52 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #52   +/-   ##
=======================================
  Coverage   81.00%   81.00%           
=======================================
  Files           5        5           
  Lines         416      416           
  Branches       88       88           
=======================================
  Hits          337      337           
  Misses         60       60           
  Partials       19       19           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce4258e...d2bf668. Read the comment docs.

@tarkatronic tarkatronic marked this pull request as ready for review May 13, 2020 00:34
@tarkatronic
Copy link
Contributor Author

@kquerna I would love to get your input on the updates to the contributing docs here. 😄

CONTRIBUTING.md Outdated Show resolved Hide resolved
@mxhenry-godaddy mxhenry-godaddy added the documentation Improvements or additions to documentation label May 13, 2020
Comment on lines +14 to +20
RUN python -m venv /venv

COPY pyproject.toml poetry.lock ./
RUN poetry export -f requirements.txt | /venv/bin/pip install -r /dev/stdin

COPY . .
RUN poetry build && /venv/bin/pip install dist/*.whl
Copy link

Choose a reason for hiding this comment

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

Curious why we are going this route, rather than just using poetry install and poetry build?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea here is that we ship a final image with none of the build artifacts; only the finally installed product. If you notice, poetry is not installed into the venv, and so doesn't actually get copied over to the final image. Same with the -dev packages installed on line 12. The main goal here is to provide as compact and clean an image as we can.

So with all of that in mind, the easiest way to get Poetry to use the Python interpreter in the venv, is to do this export and pip install.

Of course, all this is adapted from a number of examples I've found online. So I'd be happy if somebody is able to help build a better way!

```
Now, setting up a development environment is super simple!

Step 1: [Install Poetry]
Copy link

Choose a reason for hiding this comment

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

Consider including a link on how to install poetry?
https://python-poetry.org/docs/#installation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like this? 😄

@tarkatronic tarkatronic merged commit 4bc8dd9 into master May 20, 2020
@tarkatronic tarkatronic deleted the poetry branch May 20, 2020 18:51
tarkatronic added a commit that referenced this pull request May 21, 2020
Convert the project from setuptools -> poetry
tarkatronic added a commit that referenced this pull request May 21, 2020
tarkatronic added a commit that referenced this pull request May 26, 2020
Backport #52 -- switch from setuptools -> poetry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants