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

Added CONTRIBUTING.md and modified README.md #17

Merged
merged 8 commits into from
Jul 5, 2024

Conversation

santacodes
Copy link
Collaborator

I used the PyBaMM's CONTRIBUTING.md file as a template for this project as well. It was modified and omitted for it to be in accordance with this project. README.md file had to be written mostly on its own.

@brosaplanella sorry for the delay but I hope it helps with the setup process for your workshop :). The parameter sets have to be included within the template in order for them to get copied to the user-generated cookiecutter project, if you want to use the parameter sets feature I suggest you do an editable install to the pybamm-cookiecutter project under a virtual environment, the instructions are in README.md.

@agriyakhetarpal agriyakhetarpal changed the title Added CONTRIBUTIND.md and modified README.md Added CONTRIBUTING.md and modified README.md Jun 25, 2024
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
santacodes and others added 2 commits June 26, 2024 23:24
Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com>
Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com>
Copy link
Member

@brosaplanella brosaplanella left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! Will try to install today :)

@brosaplanella
Copy link
Member

Initialising the cookiecutter worked well, but can't install using pip (see error below) nor nox because the dev session is not defined.

Defaulting to user installation because normal site-packages is not writeable
Obtaining file:///home/brosaplanella/chocomaths
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Installing backend dependencies ... done
  Preparing editable metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      Traceback (most recent call last):
        File "/home/brosaplanella/.local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/brosaplanella/.local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/brosaplanella/.local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 176, in prepare_metadata_for_build_editable
          whl_basename = build_hook(metadata_directory, config_settings)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-nrjma6ib/overlay/local/lib/python3.11/dist-packages/hatchling/build.py", line 83, in build_editable
          return os.path.basename(next(builder.build(directory=wheel_directory, versions=['editable'])))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-nrjma6ib/overlay/local/lib/python3.11/dist-packages/hatchling/builders/plugin/interface.py", line 90, in build
          self.metadata.validate_fields()
        File "/tmp/pip-build-env-nrjma6ib/overlay/local/lib/python3.11/dist-packages/hatchling/metadata/core.py", line 265, in validate_fields
          _ = self.version
              ^^^^^^^^^^^^
        File "/tmp/pip-build-env-nrjma6ib/overlay/local/lib/python3.11/dist-packages/hatchling/metadata/core.py", line 149, in version
          self._version = self._get_version()
                          ^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-nrjma6ib/overlay/local/lib/python3.11/dist-packages/hatchling/metadata/core.py", line 248, in _get_version
          version = self.hatch.version.cached
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-nrjma6ib/overlay/local/lib/python3.11/dist-packages/hatchling/metadata/core.py", line 1466, in cached
          raise type(e)(message) from None
      LookupError: Error getting the version from source `vcs`: setuptools-scm was unable to detect version for /home/brosaplanella/chocomaths.

      Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work.

      For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

UPDATE: Actually, the issue was the I didn't initialise git, that's why it broke. We should add a line telling people to initialise git before installing.

@santacodes
Copy link
Collaborator Author

Initialising the cookiecutter worked well, but can't install using pip (see error below) nor nox because the dev session is not defined.

Defaulting to user installation because normal site-packages is not writeable
Obtaining file:///home/brosaplanella/chocomaths
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Installing backend dependencies ... done
  Preparing editable metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      Traceback (most recent call last):
        File "/home/brosaplanella/.local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/brosaplanella/.local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/brosaplanella/.local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 176, in prepare_metadata_for_build_editable
          whl_basename = build_hook(metadata_directory, config_settings)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-nrjma6ib/overlay/local/lib/python3.11/dist-packages/hatchling/build.py", line 83, in build_editable
          return os.path.basename(next(builder.build(directory=wheel_directory, versions=['editable'])))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-nrjma6ib/overlay/local/lib/python3.11/dist-packages/hatchling/builders/plugin/interface.py", line 90, in build
          self.metadata.validate_fields()
        File "/tmp/pip-build-env-nrjma6ib/overlay/local/lib/python3.11/dist-packages/hatchling/metadata/core.py", line 265, in validate_fields
          _ = self.version
              ^^^^^^^^^^^^
        File "/tmp/pip-build-env-nrjma6ib/overlay/local/lib/python3.11/dist-packages/hatchling/metadata/core.py", line 149, in version
          self._version = self._get_version()
                          ^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-nrjma6ib/overlay/local/lib/python3.11/dist-packages/hatchling/metadata/core.py", line 248, in _get_version
          version = self.hatch.version.cached
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-nrjma6ib/overlay/local/lib/python3.11/dist-packages/hatchling/metadata/core.py", line 1466, in cached
          raise type(e)(message) from None
      LookupError: Error getting the version from source `vcs`: setuptools-scm was unable to detect version for /home/brosaplanella/chocomaths.

      Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work.

      For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

UPDATE: Actually, the issue was the I didn't initialise git, that's why it broke. We should add a line telling people to initialise git before installing.

I added it, but I think part of that problem also has to do with the absence of nox dev session in this particular PR branch. It only exists in the other parametersets branch in case you tried cookiecutter with this or the main branch. Also a git repository should be automatically initialised if a user uses this template to make their project within GitHub itself. I am not sure about pip though, if it would initialise a git repository or not. Maybe we could add a prompt and a script to ask the user Initialise git? and if it's a yes we execute git init through the script, or we just make it mandatory for all to have the project as a git repository.

@brosaplanella
Copy link
Member

I cloned the repo and initialised it locally (only pushed to Github later) so had to initalise git manually. I suspect if you initialise directly on Github then you just clone the remote repo locally which already creates a .git folder.

Copy link
Member

@agriyakhetarpal agriyakhetarpal left a comment

Choose a reason for hiding this comment

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

I think this looks good to me for the initial go. We will iterate on this in further passes before we push the code to PyPI, and I see no reason to be too pedantic :) Thanks, @santacodes!

arjxn-py and others added 2 commits July 5, 2024 23:14
Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com>
Copy link
Member

@arjxn-py arjxn-py left a comment

Choose a reason for hiding this comment

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

Thanks @santacodes, i think this should be good to merge now. Knowing that we'd be coming back to this in other PR's as well as things are progressing.

CONTRIBUTING.md Show resolved Hide resolved
README.md Show resolved Hide resolved
@agriyakhetarpal agriyakhetarpal merged commit 341cf53 into pybamm-team:main Jul 5, 2024
18 checks passed
@santacodes santacodes deleted the contributormd branch July 18, 2024 16:16
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.

4 participants