Development workflow — NumPy v2.4 Manual
Skip to main content GitHub Development workflow # You already have your own forked copy of the NumPy repository, have configured Git, and have linked the upstream repository as explained in Linking your repository to the upstream repo . What is described below is a recommended workflow with Git. Basic workflow # In short: Start a new feature branch for each set of edits that you do. See below . Hack away! See below When finished: Contributors : push your feature branch to your own Github repo, and create a pull request .
Core developers : If you want to push changes without further review, see the notes below . This way of working helps to keep work well organized and the history as clear as possible. Making a new feature branch # First, fetch new commits from the upstream repository: git fetch upstream Then, create a new branch based on the main branch of the upstream repository: git checkout - b my - new - feature upstream / main The editing workflow # Overview # # hack hack git status # Optional git diff # Optional git add modified_file git commit # push the branch to your own Github repo git push origin my - new - feature In more detail # Make some changes.
When you feel that you’ve made a complete, working set of related changes, move on to the next steps. Optional: Check which files have changed with git status . You’ll see a listing like this one: # On branch my-new-feature # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: README # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # INSTALL no changes added to commit ( use "git add" and / or "git commit -a" ) Optional: Compare the changes with the previous version using with git diff .
This brings up a simple text browser interface that highlights the difference between your files and the previous version. Add any relevant modified or new files using git add modified_file . This puts the files into a staging area, which is a queue of files that will be added to your next commit. Only add files that have related, complete changes. Leave files with unfinished changes for later commits. To commit the staged files into the local copy of your repo, do git commit .
At this point, a text editor will open up to allow you to write a commit message. Read the commit message section to be sure that you are writing a properly formatted and sufficiently detailed commit message. After saving your message and closing the editor, your commit will be saved. For trivial commits, a short commit message can be passed in through the command line using the -m flag. For example, git commit -am "ENH: Some message" .
In some cases, you will see this form of the commit command: git commit -a . The extra -a flag automatically commits all modified files and removes all deleted files. This can save you some typing of numerous git add commands; however, it can add unwanted changes to a commit if you’re not careful. Push the changes to your fork on GitHub: git push origin my - new - feature Note Assuming you have followed the instructions in these pages, git will create a default link to your GitHb repo called origin .
You can ensure that the link to origin is permanently set by using the --set-upstream option: git push -- set - upstream origin my - new - feature From now on, git will know that my-new-feature is related to the my-new-feature branch in your own GitHub repo. Subsequent push calls are then simplified to the following: git push You have to use --set-upstream for each new branch that you create. It may be the case that while you were working on your edits, new commits have been added to upstream that affect your work.
In this case, follow the Rebasing on main section of this document to apply those changes to your branch. Writing the commit message # Commit messages should be clear and follow a few basic rules. Example: ENH : add functionality X to numpy .< submodule >. The first line of the commit message starts with a capitalized acronym ( options listed below ) indicating what type of commit this is . Then a blank line , then more text if needed .
Lines shouldn 't be longer than 72 characters . If the commit is related to a ticket , indicate that with "See #3456" , "See ticket 3456" , "Closes #3456" or similar . Describing the motivation for a change, the nature of a bug for bug fixes or some details on what an enhancement does are also good to include in a commit message. Messages should be understandable without looking at the code changes. A commit message like MAINT: fixed another one is an example of what not to do; the reader has to go look for context elsewhere.
Standard acronyms to start the commit message with are: API : an ( incompatible ) API change BENCH : changes to the benchmark suite BLD : change related to building numpy BUG : bug fix CI : continuous integration DEP : deprecate something , or remove a deprecated object DEV : development tool or utility DOC : documentation ENH : enhancement MAINT : maintenance commit ( refactoring , typos , etc . ) MNT : alias for MAINT NEP : NumPy enhancement proposals REL : related to releasing numpy REV : revert an earlier commit STY : style fix ( whitespace , PEP8 ) TST : addition or modification of tests TYP : static typing WIP : work in progress , do not merge Commands to skip continuous integration # By default a lot of continuous integration (CI) jobs are run for every PR, from running the test suite on different operating systems and hardware platforms to building the docs.
In some cases you already know that CI isn’t needed (or not all of it), for example if you work on CI config files, text in the README, or other files that aren’t involved in regular build, test or docs sequences. In such cases you may explicitly skip CI by including one or more of these fragments in each commit message of a PR: [skip ci] : skip all CI Only recommended if you are still not ready for the checks to run on your PR (for example, if this is only a draft.) [skip actions] : skip GitHub Actions jobs GitHub Actions is where most of the CI checks are run, including the linter, benchmarking, running basic tests for most architectures and OSs, and several compiler and CPU optimization settings.
See the configuration files for these checks. [skip circle] : skip CircleCI jobs CircleCI is where we build the documentation and store the generated artifact for preview in each PR. This check will also run all the docstrings examples and verify their results. If you don’t make documentation changes, but you make changes to a function’s API, for example, you may need to run these tests to verify that the doctests are still valid.
See the configuration file for these checks. [skip cirrus] : skip Cirrus jobs CirrusCI mostly triggers Linux aarch64 and MacOS Arm64 wheels uploads. See the configuration file for these checks. Test building wheels # Numpy currently uses cibuildwheel in order to build wheels through continuous integration services. To save resources, the cibuildwheel wheel builders are not run by default on every single PR or commit to main.
If you would like to test that your pull request do not break the wheel builders, you can do so by appending [wheel build] to the first line of the commit message of the newest commit in your PR. Please only do so for build-related PRs, because running all wheel builds is slow and expensive. The wheels built via github actions (including 64-bit Linux, x86-64 macOS, and 32/64-bit Windows) will be uploaded as artifacts in zip files.
You can access them from the Summary page of the “Wheel builder” action. The aarch64 Linux and arm64 macOS wheels built via Cirrus CI are not available as artifacts. Additionally, the wheels will be uploaded to https://anaconda.org/scientific-python-nightly-wheels/ on the following conditions: by a weekly cron job or if the GitHub Ac
The rest of this page is on the live site.