Skip to content

Packaging - #15

Open
XLIU-hub wants to merge 4 commits into
masterfrom
packaging
Open

XLIU-hub wants to merge 4 commits into
masterfrom
packaging

Conversation

@XLIU-hub

Copy link
Copy Markdown

Update packaging

Move packaging metadata into pyproject.toml , see detailed at #14

@mihailefter mihailefter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @XLIU-hub! Thanks for the PR. Please find below some suggestions to improve this work further:

  • Delete .travis.yml since this is no longer used.
  • Add .readthedocs.yaml since RTD requires this file since 2023; builds without it fail. Check also if the docs compile and make the appropriate changes there.
  • Build the docs in CI. One step that runs sphinx-build -W docs docs/_build would have caught the _authors error.
  • Build and check the package in CI. Adding python -m build and twine check dist/* catches broken metadata or a README that won't render on PyPI.
  • Update actions/checkout and actions/setup-python from v2 to v7 in the GitHub workflow.

from re import split
from typing import Callable

from .backtranslate import BackTranslate

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
from .backtranslate import BackTranslate
from .backtranslate import BackTranslate

It looks like this convenience import was removed. We need to keep it exposed in __init__.py so that external packages can still import it directly instead of having to map out the deep internal path.

Comment on lines +8 to +12
class ProtectedFileType(FileType):
def __call__(self, string):
if 'w' in self._mode and exists(string):
raise IOError('failed to create "{}": file exists.'.format(string))
return super(ProtectedFileType, self).__call__(string)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I haven't seen this being used anywhere in the code. Is it related to sphinx-argparse but not used there yet?

Comment thread pyproject.toml
@@ -0,0 +1,50 @@
[build-system]
requires = ["setuptools>=61"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
requires = ["setuptools>=61"]
requires = ["setuptools>=77"]

A plain string license = "MIT" needs setuptools ≥ 77. With older versions the build fails with "project.license must be valid exactly by one definition".

Comment thread docs/conf.py
Comment on lines +1 to +7
from mutalyzer_backtranslate import _authors, _project, _version, _info


author = _get_metadata('Author')
copyright = _get_metadata('Author')
project = _get_metadata('Name')
release = _get_metadata('Version')
author = _authors
project = _project
release = _version
info = _info

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

_authors isn't defined in __init__.py (it's _author).

Suggested change
from mutalyzer_backtranslate import _authors, _project, _version, _info
author = _get_metadata('Author')
copyright = _get_metadata('Author')
project = _get_metadata('Name')
release = _get_metadata('Version')
author = _authors
project = _project
release = _version
info = _info
from mutalyzer_backtranslate import _author, _project, _version
author = _author
copyright = _author
project = _project
release = _version

Comment on lines +1 to +3
from argparse import FileType
from importlib.metadata import PackageNotFoundError, metadata
from os.path import exists

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ProtectedFileType isn't used anywhere. Removing it also makes the FileType and exists imports unused.

Comment thread pyproject.toml
Comment on lines +36 to +37
"pytest-pep8>=1.0.6",
"pytest>=4.0.1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pytest-pep8 has some incompatibilities with recent pytest versions. I suggest removing it, together with raising the minimum pytest version.

Suggested change
"pytest-pep8>=1.0.6",
"pytest>=4.0.1",
"pytest>=8",

Comment thread pyproject.toml
exclude_lines = ["def main()"]

[tool.coverage.run]
source = ["mutalyzer_backtranslate"] No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing newline at the end of this file.

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