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 pyproject.toml and versioning #140

Merged
merged 15 commits into from
Jun 1, 2022
Merged

Add pyproject.toml and versioning #140

merged 15 commits into from
Jun 1, 2022

Conversation

MarkKoz
Copy link
Member

@MarkKoz MarkKoz commented May 31, 2022

Summary

  • Add a pyproject.toml using setuptools as the PEP 517 build backend
  • Use setuptools's experimental PEP 621 support to define metadata in pyproject.toml
  • Version the package using a CalVer variant which is derived from the current commit's date
  • Use the version instead of the SHA to tag containers and the Sentry release
  • Make Gunicorn and Sentry SDK optional dependencies (installed via extras)

The addition of versioning is progress towards #138. Originally I planned to just use the commit SHA, but I realised that it's not an adequate version since it cannot be properly constrained (except for ==). I chose CalVer because I don't want the maintenance burden of SemVer and I don't want to have to tag releases. Deriving the version from the commit allows for the current workflow to remain: every push to master creates a new release that is deployed automatically.

Review Process

Try installing the package (pip install .), importing it, and checking that the __version__ matches the HEAD commit's date. Also run the tests with make test to ensure the dev container still works.

MarkKoz added 12 commits May 30, 2022 14:34
Falcon provides a WSGI app which can be used by any server, not just
gunicorn. Thus, make gunicorn optional in case the user wants to use
a different server. There shouldn't be any import errors since the class
is now in an isolated module. The only time that module is imported is
when gunicorn loads its config.

Sentry is there for Python Discord mainly, so this dependency shouldn't
be imposed on others.
Use the HEAD commit's date as the package's version. Append the number
of commits made on the same date as HEAD to ensure multiple releases on
the same date still have unique versions.
Subpackages weren't being included.
@MarkKoz MarkKoz requested review from jb3 and Den4200 as code owners May 31, 2022 21:25
@coveralls
Copy link

coveralls commented May 31, 2022

Coverage Status

Coverage increased (+0.7%) to 84.731% when pulling 6ba9182 on pyproject into f94e5f3 on main.

@MarkKoz MarkKoz added type: feature New feature or request area: CI Related to continuous intergration and deployment priority: 3 - low area: packaging Related to packaging (setuptools, versioning, pyproject.toml) labels May 31, 2022
Copy link
Contributor

@Akarys42 Akarys42 left a comment

Choose a reason for hiding this comment

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

Seems to work as intended! I did find one typo.

@@ -2,8 +2,13 @@
*

# Make exceptions for what's needed
!snekbox
!.git/
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be further filtered to speed up transfer time, but I doubt it is worth spending time on.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not familiar with the structure of the directory and what exactly I need. However, it's never even copied; it's just mounted.

Co-authored-by: Matteo Bertucci <[email protected]>
@MarkKoz MarkKoz merged commit b0fb2bf into main Jun 1, 2022
@MarkKoz MarkKoz deleted the pyproject branch June 1, 2022 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: CI Related to continuous intergration and deployment area: packaging Related to packaging (setuptools, versioning, pyproject.toml) priority: 3 - low type: feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants