Contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.
The best place to start is to check the issues for something that interests you.
Please include:
-
A short, self-contained snippet reproducing the problem. You can format the code by using GitHub markdown. For example:
```sh python-project create ``` -
Explain what is currently happening and what you expect instead.
In order to work on the project you will need your own fork. To do this click the "Fork" button on this project.
Once the project is forked clone it to your local machine:
git clone git@github.com:your-user-name/python-project-generator
cd python-project-generator
git remote add upstream git@github.com:sanders41/python-project-generatorThis creates the directory python-project-generator and connects your repository to the upstream (main project) repository.
You want your main branch to reflect only production-ready code, so create a feature branch for making your changes. For example:
git checkout -b my-new-featureThis changes your working directory to the my-new-feature branch. Keep any changes in this branch specific to one bug or feature so the purpose is clear. You can have many my-new-features and switch in between them using the git checkout command.
When creating this branch, make sure your main branch is up to date with the latest upstream main version. To update your local main branch, you can do:
git checkout main
git pull upstream main --ff-onlycargo clippyTo check with the FastAPI feature enabled
cargo clippy -F fastapicargo fmt --allinsta is used for snapshot testing. It is recommended to install cargo-insta to run the tests
cargo install cargo-insta --lockedTo run the tests:
cargo insta testTo run tests with the fastapi feature enabled
cargo insta test -F fastapi
If the code change is expected to update a snapshot, for example when updating a default
dependency, run the tests with the verify flat and check that the new snapshots are correct, then
accept them.
```sh
cargo insta test --verifyFor the fastapi feature
cargo insta test --verify -F fastapicargo checkFor the fastapi feature
cargo check -F fastapiBe sure to run all these checks before submitting your pull request.
If you have just installed it can be used for testing and linting.
To run linting:
just lintTo run tests:
just test-allTo run tests and review snapshots:
just test-reviewTo run tests with the FastAPI feature enabled and review snapshots:
just test-review-fastapiTo see a full list of just commands run just --list
Once you have made changes to the code on your branch you can see which files have changed by running:
git statusIf new files were created that and are not tracked by git they can be added by running:
git add .Now you can commit your changes in your local repository:
git commit -am 'Some short helpful message to describe your changes'Once your changes are ready and all linting/tests are passing you can push your changes to your forked repository:
git push origin my-new-featureorigin is the default name of your remote repository on GitHub. You can see all of your remote repositories by running:
git remote -vAfter pushing your code to origin it is now on GitHub but not yet part of the python-project-generator project. When you’re ready to ask for a code review, file a pull request. Before you do, once again make sure that you have followed all the guidelines outlined in this document regarding code style, tests, and documentation. You should also double check your branch changes against the branch it was based on by:
- Navigating to your repository on GitHub
- Click on Branches
- Click on the Compare button for your feature branch
- Select the base and compare branches, if necessary. This will be main and my-new-feature, respectively.
Pull Pequests authored and/or co-authored by AI (for example LLMs) will not be accepted. You can use these tools, however as the person submitting the Pull Request you are responsible for manually reviewing and testing 100% of the changes before creating a Pull Request, and the AI should not be listed as a creator. Failure to do this will result in the Pull Request being closed.
If everything looks good, you are ready to make a pull request. This is how you let the maintainers of the python-project-generator project know you have code ready to be reviewed. To submit the pull request:
- Navigate to your repository on GitHub
- Click on the Pull Request button for your feature branch
- You can then click on Commits and Files Changed to make sure everything looks okay one last time
- Write a description of your changes in the Conversation tab
- Click Send Pull Request
This request then goes to the repository maintainers, and they will review the code.
Changes to your code may be needed based on the review of your pull request. If this is the case you can make them in your branch, add a new commit to that branch, push it to GitHub, and the pull request will be automatically updated. Pushing them to GitHub again is done by:
git push origin my-new-featureThis will automatically update your pull request with the latest code and restart the Continuous Integration tests.
Another reason you might need to update your pull request is to solve conflicts with changes that have been merged into the main branch since you opened your pull request.
To do this, you need to rebase your branch:
git checkout my-new-feature
git fetch upstream
git rebase upstream/mainThere may be some merge conflicts that need to be resolved. After the feature branch has been update locally, you can now update your pull request by pushing to the branch on GitHub:
git push origin my-new-featureIf you rebased and get an error when pushing your changes you can resolve it with:
git push origin my-new-feature --forceOnce your feature branch is accepted into upstream, you’ll probably want to get rid of the branch. First, merge upstream main into your main branch so git knows it is safe to delete your branch:
git fetch upstream
git checkout main
git merge upstream/mainThen you can do:
git branch -d my-new-featureMake sure you use a lower-case -d, or else git won’t warn you if your feature branch has not actually been merged.
The branch will still exist on GitHub, so to delete it there do:
git push origin --delete my-new-feature