Skip to content

Conversation

sondrelg
Copy link
Contributor

@sondrelg sondrelg commented Jun 8, 2021

This PR adds Poetry for package management.

Changes:

  • Replaced setup.py with Poetry and pyproject.toml configuration
  • I added isort for import management in the pre-commit config (say the word and we can revert this)
  • I removed the __version__ declaration in __init__.py since I think this relies on the setup.py setup
  • I added a new github action workflow for publishing pytest-split to pypi - you might not want to use this, but I thought I'd include it just in case. If you do want to try it, you will need to add the two secrets referenced in the workflow 🙂

Are you familiar with Poetry already @jerry-git? If not I would recommend just reading their docs - they're pretty short and very good 👍

The tl;dr is

  • poetry install to install all dependencies
  • poetry update to update dependencies
  • poetry build to build the package (though that's usually not something I would do locally ever)
  • poetry add <package> to add a dependency
  • poetry add -D <package> to add a dev dependency

@sondrelg sondrelg force-pushed the sondrelg/add-poetry branch 2 times, most recently from c60b85e to eb11a54 Compare June 8, 2021 13:34
@sondrelg sondrelg marked this pull request as draft June 8, 2021 13:38
@sondrelg sondrelg force-pushed the sondrelg/add-poetry branch from eb11a54 to b34d334 Compare June 8, 2021 13:40
@sondrelg sondrelg force-pushed the sondrelg/add-poetry branch from b34d334 to 310ca2b Compare June 8, 2021 13:51
@sondrelg sondrelg marked this pull request as ready for review June 8, 2021 14:44
@@ -1,3 +1,58 @@
[tool.poetry]
name = "pytest-split"
version = "0.2.1"
Copy link
Owner

Choose a reason for hiding this comment

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

How is this updated? Manually?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah so when I update a package I would manually indent the version here and publish a release in the github repo 🙂

Copy link
Owner

Choose a reason for hiding this comment

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

I wonder if there's some way to get the version from git tags with poetry 🤔 But yeah, I can look into that later.

Copy link
Contributor Author

@sondrelg sondrelg Jun 11, 2021

Choose a reason for hiding this comment

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

I've not used it, but this popped up in my feed a few weeks back https://github.com/tiangolo/poetry-version-plugin

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you want to add this in a follow-up PR you'd just need to change the test and publish action to this as well, since it requires >= 1.2.0a1

      - name: Install poetry
        uses: snok/install-poetry@v1.1.6
        with:
          version: 1.2.0a1
          virtualenvs-in-project: true

@jerry-git
Copy link
Owner

There's btw still the travis setup which publishes to PyPI on tags

pytest-split/.travis.yml

Lines 10 to 16 in beed24d

deploy:
provider: pypi
user: "__token__"
password:
secure: fqQELRdzI4Jx4p4WdFsDbfgv0yhyWuEEQ+udTRWnHcDuNR3YHTGR6jcORMKoRCxV3UqjvhKv5NQURLkhyugF2WxP6YynaCvCxdWfVgvPVawgHHLSOEomdlfj3Ezr3bqnF1xvSVKpK7JhHSkGO+3ZQkkr5m/cf9IygkMYCRPekHrhsNR1zE0Wt67o/nXXbP7vkhi5fkTE4K71yU5DVtJRsxsySKHVJwu8rWthNOInI5Gnj8RQXJfHcdp/Re8XW55YKZ3aeQuLe2zFTwK0+BT8GrxY0y+5T9jTDavE2TJz4kwwFdkFTpvaa9awkmiQm8kGaRIvGkAwzCR6gs2OziF5g273jKUKMyFYwYL6qwjRK7Hulrj6l3/ALbYaLBKzh8jcAJDYQWmR6jLtyfeASMczQZNJT4QT878Qh8M7JVDmqlGPPWispnNgOdkZlaDaoEVlz30Xgpqv7DSuOdhpPN0PszwRZAH9VtVmQfYDoXNTraFmh18WVxAUQlS1yqpd6HbJa5gpASRHUF6hETyPS6i4W5foyVaVXFNMH0TIAeOYnPkHjKGthx6PAVcfny74gZ4padg/U5sENI2lKPC4IE7UuvqwwK7LU4n/4djBJYm9Ap3ZA/FvbWYY1hepkysXGh+P8Rf/Rh2PBY76z1GWkBtEOlGo6+MoDDP6MwaN21YHEbk=
on:
tags: true


on:
release:
types: [published, edited]
Copy link
Owner

Choose a reason for hiding this comment

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

Why on edited?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No reason really - I can remove it. Think I added it to a project when the initial release failed because of bad credentials in the repo.

Pypi won't allow you to re-republish a package though, so you could in theory run the workflow 100x and it would only publish successfully once.

Copy link
Owner

Choose a reason for hiding this comment

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

I assume edited will be triggered also with some simple typo fix? Let's have only published here 🙂

@sondrelg
Copy link
Contributor Author

There's btw still the travis setup which publishes to PyPI on tags

pytest-split/.travis.yml

Lines 10 to 16 in beed24d

deploy:
provider: pypi
user: "__token__"
password:
secure: fqQELRdzI4Jx4p4WdFsDbfgv0yhyWuEEQ+udTRWnHcDuNR3YHTGR6jcORMKoRCxV3UqjvhKv5NQURLkhyugF2WxP6YynaCvCxdWfVgvPVawgHHLSOEomdlfj3Ezr3bqnF1xvSVKpK7JhHSkGO+3ZQkkr5m/cf9IygkMYCRPekHrhsNR1zE0Wt67o/nXXbP7vkhi5fkTE4K71yU5DVtJRsxsySKHVJwu8rWthNOInI5Gnj8RQXJfHcdp/Re8XW55YKZ3aeQuLe2zFTwK0+BT8GrxY0y+5T9jTDavE2TJz4kwwFdkFTpvaa9awkmiQm8kGaRIvGkAwzCR6gs2OziF5g273jKUKMyFYwYL6qwjRK7Hulrj6l3/ALbYaLBKzh8jcAJDYQWmR6jLtyfeASMczQZNJT4QT878Qh8M7JVDmqlGPPWispnNgOdkZlaDaoEVlz30Xgpqv7DSuOdhpPN0PszwRZAH9VtVmQfYDoXNTraFmh18WVxAUQlS1yqpd6HbJa5gpASRHUF6hETyPS6i4W5foyVaVXFNMH0TIAeOYnPkHjKGthx6PAVcfny74gZ4padg/U5sENI2lKPC4IE7UuvqwwK7LU4n/4djBJYm9Ap3ZA/FvbWYY1hepkysXGh+P8Rf/Rh2PBY76z1GWkBtEOlGo6+MoDDP6MwaN21YHEbk=
on:
tags: true

Should I just delete the travis.yml file?

@jerry-git
Copy link
Owner

Should I just delete the travis.yml file?

Yeah let's burn it 🔥

'flake8-print',
'flake8-type-checking',
]
- repo: https://github.com/pycqa/isort
Copy link
Owner

Choose a reason for hiding this comment

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

👍

@jerry-git jerry-git merged commit 1ac5288 into jerry-git:master Jun 14, 2021
@jerry-git
Copy link
Owner

Seems to work nicely, 0.2.1 was published using the GHA workflow added here 👍

@sondrelg
Copy link
Contributor Author

Nice 🚀

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

Successfully merging this pull request may close these issues.

2 participants