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

TODO - How to update your package name / prevent name overlap by adding your github to the package name #261

Open
pb-413 opened this issue May 20, 2024 · 6 comments

Comments

@pb-413
Copy link
Contributor

pb-413 commented May 20, 2024

Glad to see this is a TODO:

https://github.com/pyOpenSci/python-package-guide/blob/a9fc8c19b1b63113fea3b66bd06177c53be2aa5a/tutorials/publish-pypi.md?plain=1#L206C1-L213C4

I will document the steps I take here; if desired, I can make a PR with changes that walk a reader through these steps.

Also, we should consider updating earlier steps (if we want to avoid needing to rename) to create the tutorial package with a better name. e.g. hatch new pyospackage_<your-github-here> , hatch new pyospackage_pb-413.

@pb-413
Copy link
Contributor Author

pb-413 commented May 20, 2024

  1. Replace all references to pyospackage in pyproject.toml to pyospackage_<your_github>
  • e.g. pyospackage_pb_413
  • It cannot have hyphens (-) as separators; use underscores (_) instead
  • pb-413 -> pb_413 -> pyospackage_pb_413 ( not pyospackage_pb-413!)
  1. Rename the src\pyospackage folder to the same name, pyospackage_<your_github>
  • e.g. src\pyospackage_pb_413
  1. Delete old hatch env?
  • not 100% sure this was necessary; lmk if I should double check that
  • steps:
  1. hatch env show -> grab name; for me, default
  2. hatch env find default -> grab path
  3. navigate to path in explorer
  4. delete contents of ...\hatch\env\virtual\, 3 levels up
  5. Recreate environment with hatch env create
  • not sure if this is necessary; lmk if I should try without
  1. Rebuild with hatch build

Note: I had errors when I renamed to a name with hyphens. I think your documentation already mentioned something about that, but it was on a previous page. Here is the error that pointed me to renaming that; hatch seemed to be looking for the same folder name but with underscores instead of hyphens:

> hatch env create
error: subprocess-exited-with-error

  Preparing editable metadata (pyproject.toml) did not run successfully.
  exit code: 1

  [42 lines of output]
  # big stack trace
  The most likely cause of this is that there is no directory that matches the name of your project (pyospackage_pb_413).
  # extra info

References: https://hatch.pypa.io/dev/tutorials/environment/basic-usage/#locating-environments

@pb-413
Copy link
Contributor Author

pb-413 commented May 20, 2024

Just found out there is a command to prune (delete all) or remove (delete named) environments in hatch:

> hatch env
Usage: hatch env [OPTIONS] COMMAND [ARGS]...

Options:
  -h, --help  Show this message and exit.

Commands:
  create  Create environments
  find    Locate environments
  prune   Remove all environments
  remove  Remove environments
  run     Run commands within project environments
  show    Show the available environments

Those might be better than locating and manually deleting environments.

@pb-413
Copy link
Contributor Author

pb-413 commented May 21, 2024

This might be a duplicate of #244, or maybe it is just related.

@lwasser
Copy link
Member

lwasser commented May 31, 2024

thank you... let's see what @Tyler-Bonnell thinks about the change. i did just merge it!! but actually i think you have a bit more information related to hatch and environments potentially here too. i can look at this more closely later or someone else in our team can do it!

@kierisi
Copy link
Contributor

kierisi commented May 31, 2024

@all-contributors add @pb-413 for code, review

Copy link
Contributor

@kierisi

@pb-413 already contributed before to code, review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants