TODO - How to update your package name / prevent name overlap by adding your github to the package name
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.
- Replace all references to
pyospackageinpyproject.tomltopyospackage_<your_github>
- e.g.
pyospackage_pb_413 - It cannot have hyphens (
-) as separators; use underscores (_) instead - pb-413 -> pb_413 ->
pyospackage_pb_413( notpyospackage_pb-413!)
- Rename the
src\pyospackagefolder to the same name,pyospackage_<your_github>
- e.g.
src\pyospackage_pb_413
- Delete old hatch env?
- not 100% sure this was necessary; lmk if I should double check that
- steps:
-
hatch env show-> grab name; for me,default -
hatch env find default-> grab path - navigate to path in explorer
- delete contents of
...\hatch\env\virtual\, 3 levels up - Recreate environment with
hatch env create
- not sure if this is necessary; lmk if I should try without
- 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
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.
This might be a duplicate of #244, or maybe it is just related.
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!
@all-contributors add @pb-413 for code, review
@kierisi
@pb-413 already contributed before to code, review