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 poetry and bump dependencies #701

Merged

Conversation

lykahb
Copy link
Contributor

@lykahb lykahb commented Aug 1, 2024

The configuration with pyproject.toml is a more declarative convention.

One breaking change is that the minimal version of Python is raised 3.7 to 3.9 to upgrade the dependencies to the most recent versions.

I verified that katrain works and ran the CI scripts manually for the test and release workflows. Testing the MacOSX packaging seems to be much easier with CI.

@lykahb lykahb force-pushed the lykahb/add-poetry-bump-dependencies branch from 34727ed to 84179a2 Compare August 1, 2024 20:56
@@ -49,14 +47,13 @@ def find_package_resource(path, silent_errors=False):
if path.startswith("katrain"):
if not PATHS.get("PACKAGE"):
try:
with pkg_resources.path("katrain", "gui.kv") as p:
PATHS["PACKAGE"] = os.path.split(str(p))[0]
PATHS["PACKAGE"] = str(pkg_resources.files("katrain").absolute())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A drive-by improvement to use the package path directly instead of getting full path to file and discarding the file part.

pyproject.toml Show resolved Hide resolved
pyproject.toml Outdated
{path = "katrain/sounds/*"},
{path = "katrain/img/*"},
{path = "katrain/img/flags/*"},
{path = "katrain/i18n/*"}
Copy link
Contributor Author

@lykahb lykahb Aug 1, 2024

Choose a reason for hiding this comment

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

This logic from setup.py is more sophisticated, but the simpler configuration here seems to be equivalent.

-- setup.py
package_data = {"": ["*.json", "*.kv", "*.wav"], "katrain": [], "tests": []}

def include_data_files(directory):

I ran the python3 setup.py sdist and poetry build with verbose mode and diffed their output to confirm that nothing extra is included. They are nearly the same. The setup.py included the tests/*.py that poetry doesn't.

Copy link
Owner

Choose a reason for hiding this comment

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

can we remove it entirely and just rely on the default? I can't remember why this was added in the first place 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I also verified that the same files get included.

@@ -1,3 +1,4 @@
[flake8]
ignore = E501, E203, W503, E402 # line length, space before binary op, line break before binary op, import not at top
# line length, space before binary op, line break before binary op, import not at top
ignore = E501, E203, W503, E402
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This config was invalid. Flake8 was failing with:

ValueError: Error code '#' supplied to 'ignore' option does not match '^[A-Z]{1,3}[0-9]{0,3}$'

@sanderland sanderland changed the base branch from master to 1.15.0 August 15, 2024 18:45
@sanderland
Copy link
Owner

Can you also check the docs and see if they refer to requirements.txt?

@lykahb lykahb force-pushed the lykahb/add-poetry-bump-dependencies branch from f01ceda to d4e538e Compare August 15, 2024 19:00
@lykahb
Copy link
Contributor Author

lykahb commented Aug 15, 2024

Rebased on the sanderland:1.15.0 branch. There should be no more references to the older build system, in particular to the requirements.txt.

@sanderland
Copy link
Owner

Thank you! poetry-dynamic-versioning is a neat plugin as well.

@sanderland sanderland merged commit a42aba2 into sanderland:1.15.0 Aug 16, 2024
@sanderland
Copy link
Owner

sanderland commented Aug 17, 2024

https://github.com/sanderland/katrain/actions/runs/10434894929/job/28898286719
Aside from pypi auth having changed, this doesn't look good:

Publishing KaTrain (0.0.0) to PyPI

edit: fixed by

poetry self add "poetry-dynamic-versioning[plugin]"

@lykahb
Copy link
Contributor Author

lykahb commented Aug 20, 2024

Sorry about that, testing on a clean virtual env could've caught it

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