jupyterlab / hatch-jupyter-builder

A hatch plugin to help build Jupyter packages
https://hatch-jupyter-builder.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
39 stars 14 forks source link

Migration script fails if the project doesn't have a `pyproject.toml` yet #87

Closed jtpio closed 1 year ago

jtpio commented 2 years ago

Description

Running:

python -m hatch_jupyter_builder.migrate .

On a project that doesn't have a pyproject.toml file yet fails with:

Starting pyproject.toml migration
Traceback (most recent call last):
  File "/workspace/.pyenv_mirror/user/current/lib/python3.8/site-packages/hatch_jupyter_builder/migrate/_migrate.py", line 27, in <module>
    data = tomli.loads(pyproject.read_text("utf-8"))
  File "/home/gitpod/.pyenv/versions/3.8.13/lib/python3.8/pathlib.py", line 1236, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
  File "/home/gitpod/.pyenv/versions/3.8.13/lib/python3.8/pathlib.py", line 1222, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "/home/gitpod/.pyenv/versions/3.8.13/lib/python3.8/pathlib.py", line 1078, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: 'pyproject.toml'

Reproduce

Repo with a setup.cfg and / or setup.py.

Expected behavior

pyproject.toml should be created if needed.

jtpio commented 2 years ago

Probably hatch new --init can be used as a workaround for now.