diff options
author | Jarrod Millman <jarrod.millman@gmail.com> | 2021-03-04 13:22:44 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-04 13:22:44 -0800 |
commit | f9570289c7abd568714e4114e0b9ce1d0ddc5dcf (patch) | |
tree | e9823cc1c58d752604a23f053d263e27b7245877 | |
parent | 00a2ff9ecca3787d9c55956ecc5a135470e0d6f3 (diff) | |
download | networkx-f9570289c7abd568714e4114e0b9ce1d0ddc5dcf.tar.gz |
Make main default branch (and remove gitwash) (#4649)
37 files changed, 29 insertions, 1524 deletions
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 9ddc21cf..9c699f56 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -87,8 +87,8 @@ Development Workflow * Pull the latest changes from upstream:: - git checkout master - git pull upstream master + git checkout main + git pull upstream main * Create a branch for the feature you want to work on. Since the branch name will appear in the merge message, use a sensible name @@ -108,7 +108,6 @@ Development Workflow problems early and reduces the load on the continuous integration system. - 4. Submit your contribution: * Push your changes back to your fork on GitHub:: @@ -122,10 +121,6 @@ Development Workflow <http://groups.google.com/group/networkx-discuss>`_ to explain your changes or to ask for review. -For a more detailed discussion, read these :doc:`detailed documents -<gitwash/index>` on how to use Git with ``networkx`` -(`<https://networkx.org/documentation/latest/developer/gitwash/index.html>`_). - 5. Review process: * Every Pull Request (PR) update triggers a set of `continuous integration @@ -196,14 +191,14 @@ For a more detailed discussion, read these :doc:`detailed documents where 123 is the issue number. -Divergence from ``upstream master`` ------------------------------------ +Divergence from ``upstream main`` +--------------------------------- If GitHub indicates that the branch of your Pull Request can no longer -be merged automatically, merge the master branch into yours:: +be merged automatically, merge the main branch into yours:: - git fetch upstream master - git merge upstream/master + git fetch upstream main + git merge upstream/main If any conflicts occur, they need to be fixed before continuing. See which files are in conflict using:: @@ -222,8 +217,8 @@ Inside the conflicted file, you'll find sections like these:: <<<<<<< HEAD The way the text looks in your branch ======= - The way the text looks in the master branch - >>>>>>> master + The way the text looks in the main branch + >>>>>>> main Choose one version of the text that should be kept, and delete the rest:: @@ -241,9 +236,8 @@ Once you've fixed all merge conflicts, do:: .. note:: - Advanced Git users are encouraged to `rebase instead of merge - <https://networkx.org/documentation/stable/developer/gitwash/development_workflow.html#rebase-on-trunk>`__, - but we squash and merge most PRs either way. + Advanced Git users may want to rebase instead of merge, + but we squash and merge PRs either way. Guidelines @@ -251,7 +245,7 @@ Guidelines * All code should have tests. * All code should be documented, to the same - `standard <https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt#docstring-standard>`_ + `standard <https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard>`_ as NumPy and SciPy. * All changes are reviewed. Ask on the `mailing list <http://groups.google.com/group/networkx-discuss>`_ if @@ -7,11 +7,11 @@ NetworkX .. image:: https://img.shields.io/pypi/pyversions/networkx.svg :target: https://pypi.org/project/networkx/ -.. image:: https://github.com/networkx/networkx/workflows/test/badge.svg?branch=master +.. image:: https://github.com/networkx/networkx/workflows/test/badge.svg?branch=main :target: https://github.com/networkx/networkx/actions?query=workflow%3A%22test%22 -.. image:: https://codecov.io/gh/networkx/networkx/branch/master/graph/badge.svg - :target: https://app.codecov.io/gh/networkx/networkx/branch/master +.. image:: https://codecov.io/gh/networkx/networkx/branch/main/graph/badge.svg + :target: https://app.codecov.io/gh/networkx/networkx/branch/main .. image:: https://img.shields.io/github/labels/networkx/networkx/Good%20First%20Issue?color=green&label=Contribute%20&style=flat-square :target: https://github.com/networkx/networkx/issues?q=is%3Aopen+is%3Aissue+label%3A%22Good+First+Issue%22 diff --git a/doc/Makefile b/doc/Makefile index 41461ac8..303c4fac 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -26,7 +26,6 @@ help: @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" - @echo " gitwash to update the gitwash documentation" clean: @@ -115,9 +114,3 @@ latexpdf: latex docs: clean html latexpdf cp build/latex/networkx_reference.pdf build/html/_downloads/. - -gitwash-update: - python ../tools/gitwash_dumper.py developer networkx \ - --project-url=https://networkx.org \ - --project-ml-url=https://groups.google.com/group/networkx-discuss/ \ - --gitwash-url git@github.com:matthew-brett/gitwash.git diff --git a/doc/conf.py b/doc/conf.py index 55ff3240..c63f09e7 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -81,9 +81,6 @@ source_suffix = ".rst" # The encoding of source files. source_encoding = "utf-8" -# The master toctree document. -master_doc = "index" - # Do not include release announcement template exclude_patterns = ["release/release_template.rst"] diff --git a/doc/developer/core_developer.rst b/doc/developer/core_developer.rst index 390fc014..427a1292 100644 --- a/doc/developer/core_developer.rst +++ b/doc/developer/core_developer.rst @@ -72,7 +72,7 @@ or using GitHub’s `suggestion whether to accept the changes.) Our default merge policy is to squash all PR commits into a single -commit. Users who wish to bring the latest changes from ``master`` +commit. Users who wish to bring the latest changes from ``main`` into their branch should be advised to merge, not to rebase. Even when merge conflicts arise, don’t ask for a rebase unless you know that a contributor is experienced with git. Instead, rebase the branch diff --git a/doc/developer/gitwash/branch_dropdown.png b/doc/developer/gitwash/branch_dropdown.png Binary files differdeleted file mode 100644 index 1bb7a577..00000000 --- a/doc/developer/gitwash/branch_dropdown.png +++ /dev/null diff --git a/doc/developer/gitwash/configure_git.rst b/doc/developer/gitwash/configure_git.rst deleted file mode 100644 index 7059bde1..00000000 --- a/doc/developer/gitwash/configure_git.rst +++ /dev/null @@ -1,172 +0,0 @@ -.. highlight:: bash - -.. _configure-git: - -=============== - Configure git -=============== - -.. _git-config-basic: - -Overview -======== - -Your personal git configurations are saved in the ``.gitconfig`` file in -your home directory. - -Here is an example ``.gitconfig`` file: - -.. code-block:: none - - [user] - name = Your Name - email = you@yourdomain.example.com - - [alias] - ci = commit -a - co = checkout - st = status - stat = status - br = branch - wdiff = diff --color-words - - [core] - editor = vim - - [merge] - summary = true - -You can edit this file directly or you can use the ``git config --global`` -command:: - - git config --global user.name "Your Name" - git config --global user.email you@yourdomain.example.com - git config --global alias.ci "commit -a" - git config --global alias.co checkout - git config --global alias.st "status -a" - git config --global alias.stat "status -a" - git config --global alias.br branch - git config --global alias.wdiff "diff --color-words" - git config --global core.editor vim - git config --global merge.summary true - -To set up on another computer, you can copy your ``~/.gitconfig`` file, -or run the commands above. - -In detail -========= - -user.name and user.email ------------------------- - -It is good practice to tell git_ who you are, for labeling any changes -you make to the code. The simplest way to do this is from the command -line:: - - git config --global user.name "Your Name" - git config --global user.email you@yourdomain.example.com - -This will write the settings into your git configuration file, which -should now contain a user section with your name and email: - -.. code-block:: none - - [user] - name = Your Name - email = you@yourdomain.example.com - -Of course you'll need to replace ``Your Name`` and ``you@yourdomain.example.com`` -with your actual name and email address. - -Aliases -------- - -You might well benefit from some aliases to common commands. - -For example, you might well want to be able to shorten ``git checkout`` -to ``git co``. Or you may want to alias ``git diff --color-words`` -(which gives a nicely formatted output of the diff) to ``git wdiff`` - -The following ``git config --global`` commands:: - - git config --global alias.ci "commit -a" - git config --global alias.co checkout - git config --global alias.st "status -a" - git config --global alias.stat "status -a" - git config --global alias.br branch - git config --global alias.wdiff "diff --color-words" - -will create an ``alias`` section in your ``.gitconfig`` file with contents -like this: - -.. code-block:: none - - [alias] - ci = commit -a - co = checkout - st = status -a - stat = status -a - br = branch - wdiff = diff --color-words - -Editor ------- - -You may also want to make sure that your editor of choice is used :: - - git config --global core.editor vim - -Merging -------- - -To enforce summaries when doing merges (``~/.gitconfig`` file again): - -.. code-block:: none - - [merge] - log = true - -Or from the command line:: - - git config --global merge.log true - -.. _fancy-log: - -Fancy log output ----------------- - -This is a very nice alias to get a fancy log output; it should go in the -``alias`` section of your ``.gitconfig`` file: - -.. code-block:: none - - lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)[%an]%Creset' --abbrev-commit --date=relative - -You use the alias with:: - - git lg - -and it gives graph / text output something like this (but with color!): - -.. code-block:: none - - * 6d8e1ee - (HEAD, origin/my-fancy-feature, my-fancy-feature) NF - a fancy file (45 minutes ago) [Matthew Brett] - * d304a73 - (origin/placeholder, placeholder) Merge pull request #48 from hhuuggoo/master (2 weeks ago) [Jonathan Terhorst] - |\ - | * 4aff2a8 - fixed bug 35, and added a test in test_bugfixes (2 weeks ago) [Hugo] - |/ - * a7ff2e5 - Added notes on discussion/proposal made during Data Array Summit. (2 weeks ago) [Corran Webster] - * 68f6752 - Initial implimentation of AxisIndexer - uses 'index_by' which needs to be changed to a call on an Axes object - this is all very sketchy right now. (2 weeks ago) [Corr - * 376adbd - Merge pull request #46 from terhorst/master (2 weeks ago) [Jonathan Terhorst] - |\ - | * b605216 - updated joshu example to current api (3 weeks ago) [Jonathan Terhorst] - | * 2e991e8 - add testing for outer ufunc (3 weeks ago) [Jonathan Terhorst] - | * 7beda5a - prevent axis from throwing an exception if testing equality with non-axis object (3 weeks ago) [Jonathan Terhorst] - | * 65af65e - convert unit testing code to assertions (3 weeks ago) [Jonathan Terhorst] - | * 956fbab - Merge remote-tracking branch 'upstream/master' (3 weeks ago) [Jonathan Terhorst] - | |\ - | |/ - -Thanks to Yury V. Zaytsev for posting it. - -.. include:: links.inc diff --git a/doc/developer/gitwash/development_workflow.rst b/doc/developer/gitwash/development_workflow.rst deleted file mode 100644 index 644edc22..00000000 --- a/doc/developer/gitwash/development_workflow.rst +++ /dev/null @@ -1,423 +0,0 @@ -.. highlight:: bash - -.. _development-workflow: - -#################### -Development workflow -#################### - -You already have your own forked copy of the `networkx`_ repository, by -following :ref:`forking`. You have :ref:`set-up-fork`. You have configured -git by following :ref:`configure-git`. Now you are ready for some real work. - -Workflow summary -================ - -In what follows we'll refer to the upstream networkx ``master`` branch, as -"trunk". - -* Don't use your ``master`` branch for anything. Consider deleting it. -* When you are starting a new set of changes, fetch any changes from trunk, - and start a new *feature branch* from that. -* Make a new branch for each separable set of changes |emdash| "one task, one - branch" (`ipython git workflow`_). -* Name your branch for the purpose of the changes - e.g. - ``bugfix-for-issue-14`` or ``refactor-database-code``. -* If you can possibly avoid it, avoid merging trunk or any other branches into - your feature branch while you are working. -* If you do find yourself merging from trunk, consider :ref:`rebase-on-trunk` -* Ask on the `networkx mailing list`_ if you get stuck. -* Ask for code review! - -This way of working helps to keep work well organized, with readable history. -This in turn makes it easier for project maintainers (that might be you) to see -what you've done, and why you did it. - -See `linux git workflow`_ and `ipython git workflow`_ for some explanation. - -Consider deleting your master branch -==================================== - -It may sound strange, but deleting your own ``master`` branch can help reduce -confusion about which branch you are on. See `deleting master on github`_ for -details. - -.. _update-mirror-trunk: - -Update the mirror of trunk -========================== - -First make sure you have done :ref:`linking-to-upstream`. - -From time to time you should fetch the upstream (trunk) changes from github:: - - git fetch upstream - -This will pull down any commits you don't have, and set the remote branches to -point to the right commit. For example, 'trunk' is the branch referred to by -(remote/branchname) ``upstream/master`` - and if there have been commits since -you last checked, ``upstream/master`` will change after you do the fetch. - -.. _make-feature-branch: - -Make a new feature branch -========================= - -When you are ready to make some changes to the code, you should start a new -branch. Branches that are for a collection of related edits are often called -'feature branches'. - -Making an new branch for each set of related changes will make it easier for -someone reviewing your branch to see what you are doing. - -Choose an informative name for the branch to remind yourself and the rest of us -what the changes in the branch are for. For example ``add-ability-to-fly``, or -``buxfix-for-issue-42``. - -:: - - # Update the mirror of trunk - git fetch upstream - # Make new feature branch starting at current trunk - git branch my-new-feature upstream/master - git checkout my-new-feature - -Generally, you will want to keep your feature branches on your public github_ -fork of `networkx`_. To do this, you `git push`_ this new branch up to your -github repo. Generally (if you followed the instructions in these pages, and by -default), git will have a link to your github repo, called ``origin``. You push -up to your own repo on github with:: - - git push origin my-new-feature - -In git >= 1.7 you can ensure that the link is correctly 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 the github repo. - -.. _edit-flow: - -The editing workflow -==================== - -Overview --------- - -:: - - # hack hack - git add my_new_file - git commit -am 'NF - some message' - git push - -In more detail --------------- - -#. Make some changes -#. See which files have changed with ``git status`` (see `git status`_). - You'll see a listing like this one: - - .. code-block:: none - - # On branch ny-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") - -#. Check what the actual changes are with ``git diff`` (`git diff`_). -#. Add any new files to version control ``git add new_file_name`` (see - `git add`_). -#. To commit all modified files into the local copy of your repo,, do - ``git commit -am 'A commit message'``. Note the ``-am`` options to - ``commit``. The ``m`` flag just signals that you're going to type a - message on the command line. The ``a`` flag |emdash| you can just take on - faith |emdash| or see `why the -a flag?`_ |emdash| and the helpful use-case - description in the `tangled working copy problem`_. The `git commit`_ manual - page might also be useful. -#. To push the changes up to your forked repo on github, do a ``git - push`` (see `git push`_). - -Ask for your changes to be reviewed or merged -============================================= - -When you are ready to ask for someone to review your code and consider a merge: - -#. Go to the URL of your forked repo, say - ``https://github.com/your-user-name/networkx``. -#. Use the 'Switch Branches' dropdown menu near the top left of the page to - select the branch with your changes: - - .. image:: branch_dropdown.png - -#. Click on the 'Pull request' button: - - .. image:: pull_button.png - - Enter a title for the set of changes, and some explanation of what you've - done. Say if there is anything you'd like particular attention for - like a - complicated change or some code you are not happy with. - - If you don't think your request is ready to be merged, just say so in your - pull request message. This is still a good way of getting some preliminary - code review. - -Some other things you might want to do -====================================== - -Delete a branch on github -------------------------- - -:: - - git checkout master - # delete branch locally - git branch -D my-unwanted-branch - # delete branch on github - git push origin :my-unwanted-branch - -Note the colon ``:`` before ``my-unwanted-branch``. See also: -https://help.github.com/articles/pushing-to-a-remote/#deleting-a-remote-branch-or-tag - -Several people sharing a single repository ------------------------------------------- - -If you want to work on some stuff with other people, where you are all -committing into the same repository, or even the same branch, then just -share it via github. - -First fork networkx into your account, as from :ref:`forking`. - -Then, go to your forked repository github page, say -``https://github.com/your-user-name/networkx`` - -Click on the 'Admin' button, and add anyone else to the repo as a -collaborator: - - .. image:: pull_button.png - -Now all those people can do:: - - git clone git@githhub.com:your-user-name/networkx.git - -Remember that links starting with ``git@`` use the ssh protocol and are -read-write; links starting with ``git://`` are read-only. - -Your collaborators can then commit directly into that repo with the -usual:: - - git commit -am 'ENH - much better code' - git push origin master # pushes directly into your repo - -Explore your repository ------------------------ - -To see a graphical representation of the repository branches and -commits:: - - gitk --all - -To see a linear list of commits for this branch:: - - git log - -You can also look at the `network graph visualizer`_ for your github -repo. - -Finally the :ref:`fancy-log` ``lg`` alias will give you a reasonable text-based -graph of the repository. - -.. _rebase-on-trunk: - -Rebasing on trunk ------------------ - -Let's say you thought of some work you'd like to do. You -:ref:`update-mirror-trunk` and :ref:`make-feature-branch` called -``cool-feature``. At this stage trunk is at some commit, let's call it E. Now -you make some new commits on your ``cool-feature`` branch, let's call them A, B, -C. Maybe your changes take a while, or you come back to them after a while. In -the meantime, trunk has progressed from commit E to commit (say) G: - -.. code-block:: none - - A---B---C cool-feature - / - D---E---F---G trunk - -At this stage you consider merging trunk into your feature branch, and you -remember that this here page sternly advises you not to do that, because the -history will get messy. Most of the time you can just ask for a review, and not -worry that trunk has got a little ahead. But sometimes, the changes in trunk -might affect your changes, and you need to harmonize them. In this situation -you may prefer to do a rebase. - -rebase takes your changes (A, B, C) and replays them as if they had been made to -the current state of ``trunk``. In other words, in this case, it takes the -changes represented by A, B, C and replays them on top of G. After the rebase, -your history will look like this: - -.. code-block:: none - - A'--B'--C' cool-feature - / - D---E---F---G trunk - -See `rebase without tears`_ for more detail. - -To do a rebase on trunk:: - - # Update the mirror of trunk - git fetch upstream - # go to the feature branch - git checkout cool-feature - # make a backup in case you mess up - git branch tmp cool-feature - # rebase cool-feature onto trunk - git rebase --onto upstream/master upstream/master cool-feature - -In this situation, where you are already on branch ``cool-feature``, the last -command can be written more succinctly as:: - - git rebase upstream/master - -When all looks good you can delete your backup branch:: - - git branch -D tmp - -If it doesn't look good you may need to have a look at -:ref:`recovering-from-mess-up`. - -If you have made changes to files that have also changed in trunk, this may -generate merge conflicts that you need to resolve - see the `git rebase`_ man -page for some instructions at the end of the "Description" section. There is -some related help on merging in the git user manual - see `resolving a merge`_. - -.. _recovering-from-mess-up: - -Recovering from mess-ups ------------------------- - -Sometimes, you mess up merges or rebases. Luckily, in git it is -relatively straightforward to recover from such mistakes. - -If you mess up during a rebase:: - - git rebase --abort - -If you notice you messed up after the rebase:: - - # reset branch back to the saved point - git reset --hard tmp - -If you forgot to make a backup branch:: - - # look at the reflog of the branch - git reflog show cool-feature - - 8630830 cool-feature@{0}: commit: BUG: io: close file handles immediately - 278dd2a cool-feature@{1}: rebase finished: refs/heads/my-feature-branch onto 11ee694744f2552d - 26aa21a cool-feature@{2}: commit: BUG: lib: make seek_gzip_factory not leak gzip obj - ... - - # reset the branch to where it was before the botched rebase - git reset --hard cool-feature@{2} - -.. _rewriting-commit-history: - -Rewriting commit history ------------------------- - -.. note:: - - Do this only for your own feature branches. - -There's an embarrassing typo in a commit you made? Or perhaps the you -made several false starts you would like the posterity not to see. - -This can be done via *interactive rebasing*. - -Suppose that the commit history looks like this:: - - git log --oneline - eadc391 Fix some remaining bugs - a815645 Modify it so that it works - 2dec1ac Fix a few bugs + disable - 13d7934 First implementation - 6ad92e5 * masked is now an instance of a new object, MaskedConstant - 29001ed Add pre-nep for a copule of structured_array_extensions. - ... - -and ``6ad92e5`` is the last commit in the ``cool-feature`` branch. Suppose we -want to make the following changes: - -* Rewrite the commit message for ``13d7934`` to something more sensible. -* Combine the commits ``2dec1ac``, ``a815645``, ``eadc391`` into a single one. - -We do as follows:: - - # make a backup of the current state - git branch tmp HEAD - # interactive rebase - git rebase -i 6ad92e5 - -This will open an editor with the following text in it:: - - pick 13d7934 First implementation - pick 2dec1ac Fix a few bugs + disable - pick a815645 Modify it so that it works - pick eadc391 Fix some remaining bugs - - # Rebase 6ad92e5..eadc391 onto 6ad92e5 - # - # Commands: - # p, pick = use commit - # r, reword = use commit, but edit the commit message - # e, edit = use commit, but stop for amending - # s, squash = use commit, but meld into previous commit - # f, fixup = like "squash", but discard this commit's log message - # - # If you remove a line here THAT COMMIT WILL BE LOST. - # However, if you remove everything, the rebase will be aborted. - # - -To achieve what we want, we will make the following changes to it:: - - r 13d7934 First implementation - pick 2dec1ac Fix a few bugs + disable - f a815645 Modify it so that it works - f eadc391 Fix some remaining bugs - -This means that (i) we want to edit the commit message for -``13d7934``, and (ii) collapse the last three commits into one. Now we -save and quit the editor. - -Git will then immediately bring up an editor for editing the commit -message. After revising it, we get the output:: - - [detached HEAD 721fc64] FOO: First implementation - 2 files changed, 199 insertions(+), 66 deletions(-) - [detached HEAD 0f22701] Fix a few bugs + disable - 1 files changed, 79 insertions(+), 61 deletions(-) - Successfully rebased and updated refs/heads/my-feature-branch. - -and the history looks now like this:: - - 0f22701 Fix a few bugs + disable - 721fc64 ENH: Sophisticated feature - 6ad92e5 * masked is now an instance of a new object, MaskedConstant - -If it went wrong, recovery is again possible as explained :ref:`above -<recovering-from-mess-up>`. - -.. include:: links.inc diff --git a/doc/developer/gitwash/following_latest.rst b/doc/developer/gitwash/following_latest.rst deleted file mode 100644 index 78a52ddd..00000000 --- a/doc/developer/gitwash/following_latest.rst +++ /dev/null @@ -1,38 +0,0 @@ -.. highlight:: bash - -.. _following-latest: - -============================= - Following the latest source -============================= - -These are the instructions if you just want to follow the latest -*networkx* source, but you don't need to do any development for now. - -The steps are: - -* :ref:`install-git` -* get local copy of the `networkx github`_ git repository -* update local copy from time to time - -Get the local copy of the code -============================== - -From the command line:: - - git clone git://github.com/networkx/networkx.git - -You now have a copy of the code tree in the new ``networkx`` directory. - -Updating the code -================= - -From time to time you may want to pull down the latest code. Do this with:: - - cd networkx - git pull - -The tree in ``networkx`` will now have the latest changes from the initial -repository. - -.. include:: links.inc diff --git a/doc/developer/gitwash/forking_button.png b/doc/developer/gitwash/forking_button.png Binary files differdeleted file mode 100644 index d0e04134..00000000 --- a/doc/developer/gitwash/forking_button.png +++ /dev/null diff --git a/doc/developer/gitwash/forking_hell.rst b/doc/developer/gitwash/forking_hell.rst deleted file mode 100644 index 079767a7..00000000 --- a/doc/developer/gitwash/forking_hell.rst +++ /dev/null @@ -1,34 +0,0 @@ -.. highlight:: bash - -.. _forking: - -====================================================== -Making your own copy (fork) of networkx -====================================================== - -You need to do this only once. The instructions here are very similar -to the instructions at https://help.github.com/forking/ |emdash| please see -that page for more detail. We're repeating some of it here just to give the -specifics for the `networkx`_ project, and to suggest some default names. - -Set up and configure a github account -===================================== - -If you don't have a github account, go to the github page, and make one. - -You then need to configure your account to allow write access |emdash| see -the ``Generating SSH keys`` help on `github help`_. - -Create your own forked copy of `networkx`_ -====================================================== - -#. Log into your github account. -#. Go to the `networkx`_ github home at `networkx github`_. -#. Click on the *fork* button: - - .. image:: forking_button.png - - Now, after a short pause, you should find yourself at the home page for - your own forked copy of `networkx`_. - -.. include:: links.inc diff --git a/doc/developer/gitwash/git_development.rst b/doc/developer/gitwash/git_development.rst deleted file mode 100644 index c5b910d8..00000000 --- a/doc/developer/gitwash/git_development.rst +++ /dev/null @@ -1,16 +0,0 @@ -.. _git-development: - -===================== - Git for development -===================== - -Contents: - -.. toctree:: - :maxdepth: 2 - - forking_hell - set_up_fork - configure_git - development_workflow - maintainer_workflow diff --git a/doc/developer/gitwash/git_install.rst b/doc/developer/gitwash/git_install.rst deleted file mode 100644 index 686f54ea..00000000 --- a/doc/developer/gitwash/git_install.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. highlight:: bash - -.. _install-git: - -============= - Install git -============= - -Overview -======== - -================ ============= -Debian / Ubuntu ``sudo apt-get install git`` -Fedora ``sudo dnf install git`` -Windows Download and install msysGit_ -OS X Use the git-osx-installer_ -================ ============= - -In detail -========= - -See the git page for the most recent information. - -Have a look at the github install help pages available from `github help`_ - -There are good instructions here: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git - -.. include:: links.inc diff --git a/doc/developer/gitwash/git_intro.rst b/doc/developer/gitwash/git_intro.rst deleted file mode 100644 index 19762ab9..00000000 --- a/doc/developer/gitwash/git_intro.rst +++ /dev/null @@ -1,20 +0,0 @@ -.. highlight:: bash - -============== - Introduction -============== - -These pages describe a git_ and github_ workflow for the `networkx`_ -project. - -There are several different workflows here, for different ways of -working with *networkx*. - -This is not a comprehensive git reference, it's just a workflow for our -own project. It's tailored to the github hosting service. You may well -find better or quicker ways of getting stuff done with git, but these -should get you started. - -For general resources for learning git, see :ref:`git-resources`. - -.. include:: links.inc diff --git a/doc/developer/gitwash/git_links.inc b/doc/developer/gitwash/git_links.inc deleted file mode 100644 index 59287700..00000000 --- a/doc/developer/gitwash/git_links.inc +++ /dev/null @@ -1,58 +0,0 @@ -.. This (-*- rst -*-) format file contains commonly used link targets - and name substitutions. It may be included in many files, - therefore it should only contain link targets and name - substitutions. Try grepping for "^\.\. _" to find plausible - candidates for this list. - -.. NOTE: reST targets are - __not_case_sensitive__, so only one target definition is needed for - nipy, NIPY, Nipy, etc... - -.. git stuff -.. _git: https://git-scm.com/ -.. _github: https://github.com -.. _github help: https://help.github.com -.. _msysgit: https://git-scm.com/download/win -.. _git-osx-installer: https://git-scm.com/download/mac -.. _subversion: http://subversion.tigris.org/ -.. _git cheat sheet: https://help.github.com/git-cheat-sheets/ -.. _pro git book: https://git-scm.com/book/en/v2 -.. _git svn crash course: https://git-scm.com/course/svn.html -.. _network graph visualizer: https://github.com/blog/39-say-hello-to-the-network-graph-visualizer -.. _git user manual: https://schacon.github.io/git/user-manual.html -.. _git tutorial: https://schacon.github.io/git/gittutorial.html -.. _git ready: http://gitready.com/ -.. _Fernando's git page: http://www.fperez.org/py4science/git.html -.. _git magic: http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html -.. _git concepts: https://www.sbf5.com/~cduan/technical/git/ -.. _git clone: https://schacon.github.io/git/git-clone.html -.. _git checkout: https://schacon.github.io/git/git-checkout.html -.. _git commit: https://schacon.github.io/git/git-commit.html -.. _git push: https://schacon.github.io/git/git-push.html -.. _git pull: https://schacon.github.io/git/git-pull.html -.. _git add: https://schacon.github.io/git/git-add.html -.. _git status: https://schacon.github.io/git/git-status.html -.. _git diff: https://schacon.github.io/git/git-diff.html -.. _git log: https://schacon.github.io/git/git-log.html -.. _git branch: https://schacon.github.io/git/git-branch.html -.. _git remote: https://schacon.github.io/git/git-remote.html -.. _git rebase: https://schacon.github.io/git/git-rebase.html -.. _git config: https://schacon.github.io/git/git-config.html -.. _why the -a flag?: http://gitready.com/beginner/2009/01/18/the-staging-area.html -.. _git staging area: http://gitready.com/beginner/2009/01/18/the-staging-area.html -.. _tangled working copy problem: https://2ndscale.com/rtomayko/2008/the-thing-about-git -.. _git management: https://web.archive.org/web/20090224195437/http://kerneltrap.org/Linux/Git_Management -.. _linux git workflow: https://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39091.html -.. _git parable: http://tom.preston-werner.com/2009/05/19/the-git-parable.html -.. _git foundation: https://matthew-brett.github.io/pydagogue/foundation.html -.. _deleting master on github: https://matthew-brett.github.io/pydagogue/gh_delete_master.html -.. _rebase without tears: https://matthew-brett.github.io/pydagogue/rebase_without_tears.html -.. _resolving a merge: https://schacon.github.io/git/user-manual.html#resolving-a-merge -.. _ipython git workflow: https://mail.scipy.org/pipermail/ipython-dev/2010-October/006746.html - -.. other stuff -.. _python: https://www.python.org - -.. |emdash| unicode:: U+02014 - -.. vim: ft=rst diff --git a/doc/developer/gitwash/git_resources.rst b/doc/developer/gitwash/git_resources.rst deleted file mode 100644 index bdf0496c..00000000 --- a/doc/developer/gitwash/git_resources.rst +++ /dev/null @@ -1,58 +0,0 @@ -.. highlight:: bash - -.. _git-resources: - -============= -git resources -============= - -Tutorials and summaries -======================= - -* `github help`_ has an excellent series of how-to guides. -* The `pro git book`_ is a good in-depth book on git. -* A `git cheat sheet`_ is a page giving summaries of common commands. -* The `git user manual`_ -* The `git tutorial`_ -* `git ready`_ |emdash| a nice series of tutorials -* `git magic`_ |emdash| extended introduction with intermediate detail -* The `git parable`_ is an easy read explaining the concepts behind git. -* `git foundation`_ expands on the `git parable`_. -* Fernando Perez' git page |emdash| `Fernando's git page`_ |emdash| many - links and tips -* A good but technical page on `git concepts`_ -* `git svn crash course`_: git for those of us used to subversion_ - -Advanced git workflow -===================== - -There are many ways of working with git; here are some posts on the -rules of thumb that other projects have come up with: - -* Linus Torvalds on `git management`_ -* Linus Torvalds on `linux git workflow`_ . Summary; use the git tools - to make the history of your edits as clean as possible; merge from - upstream edits as little as possible in branches where you are doing - active development. - -Manual pages online -=================== - -You can get these on your own machine with (e.g) ``git help push`` or -(same thing) ``git push --help``, but, for convenience, here are the -online manual pages for some common commands: - -* `git add`_ -* `git branch`_ -* `git checkout`_ -* `git clone`_ -* `git commit`_ -* `git config`_ -* `git diff`_ -* `git log`_ -* `git pull`_ -* `git push`_ -* `git remote`_ -* `git status`_ - -.. include:: links.inc diff --git a/doc/developer/gitwash/index.rst b/doc/developer/gitwash/index.rst deleted file mode 100644 index 4e64ea70..00000000 --- a/doc/developer/gitwash/index.rst +++ /dev/null @@ -1,16 +0,0 @@ -.. _using-git: - -Advanced Git -============ - -Contents: - -.. toctree:: - :maxdepth: 2 - - git_intro - git_install - following_latest - patching - git_development - git_resources diff --git a/doc/developer/gitwash/known_projects.inc b/doc/developer/gitwash/known_projects.inc deleted file mode 100644 index 710abe08..00000000 --- a/doc/developer/gitwash/known_projects.inc +++ /dev/null @@ -1,41 +0,0 @@ -.. Known projects - -.. PROJECTNAME placeholders -.. _PROJECTNAME: http://nipy.org -.. _`PROJECTNAME github`: https://github.com/nipy -.. _`PROJECTNAME mailing list`: https://mail.python.org/mailman/listinfo/neuroimaging - -.. numpy -.. _numpy: http://www.numpy.org -.. _`numpy github`: https://github.com/numpy/numpy -.. _`numpy mailing list`: https://mail.scipy.org/mailman/listinfo/numpy-discussion - -.. scipy -.. _scipy: https://www.scipy.org -.. _`scipy github`: https://github.com/scipy/scipy -.. _`scipy mailing list`: https://mail.scipy.org/mailman/listinfo/scipy-dev - -.. nipy -.. _nipy: http://nipy.org/nipy/ -.. _`nipy github`: https://github.com/nipy/nipy -.. _`nipy mailing list`: https://mail.python.org/mailman/listinfo/neuroimaging - -.. ipython -.. _ipython: https://ipython.org -.. _`ipython github`: https://github.com/ipython/ipython -.. _`ipython mailing list`: https://mail.scipy.org/mailman/listinfo/IPython-dev - -.. dipy -.. _dipy: http://nipy.org/dipy/ -.. _`dipy github`: https://github.com/Garyfallidis/dipy -.. _`dipy mailing list`: https://mail.python.org/mailman/listinfo/neuroimaging - -.. nibabel -.. _nibabel: http://nipy.org/nibabel/ -.. _`nibabel github`: https://github.com/nipy/nibabel -.. _`nibabel mailing list`: https://mail.python.org/mailman/listinfo/neuroimaging - -.. marsbar -.. _marsbar: http://marsbar.sourceforge.net -.. _`marsbar github`: https://github.com/matthew-brett/marsbar -.. _`MarsBaR mailing list`: https://lists.sourceforge.net/lists/listinfo/marsbar-users diff --git a/doc/developer/gitwash/links.inc b/doc/developer/gitwash/links.inc deleted file mode 100644 index 20f4dcff..00000000 --- a/doc/developer/gitwash/links.inc +++ /dev/null @@ -1,4 +0,0 @@ -.. compiling links file -.. include:: known_projects.inc -.. include:: this_project.inc -.. include:: git_links.inc diff --git a/doc/developer/gitwash/maintainer_workflow.rst b/doc/developer/gitwash/maintainer_workflow.rst deleted file mode 100644 index 8c02467d..00000000 --- a/doc/developer/gitwash/maintainer_workflow.rst +++ /dev/null @@ -1,98 +0,0 @@ -.. highlight:: bash - -.. _maintainer-workflow: - -################### -Maintainer workflow -################### - -This page is for maintainers |emdash| those of us who merge our own or other -peoples' changes into the upstream repository. - -Being as how you're a maintainer, you are completely on top of the basic stuff -in :ref:`development-workflow`. - -The instructions in :ref:`linking-to-upstream` add a remote that has read-only -access to the upstream repo. Being a maintainer, you've got read-write access. - -It's good to have your upstream remote have a scary name, to remind you that -it's a read-write remote:: - - git remote add upstream-rw git@github.com:networkx/networkx.git - git fetch upstream-rw - -******************* -Integrating changes -******************* - -Let's say you have some changes that need to go into trunk -(``upstream-rw/master``). - -The changes are in some branch that you are currently on. For example, you are -looking at someone's changes like this:: - - git remote add someone git://github.com/someone/networkx.git - git fetch someone - git branch cool-feature --track someone/cool-feature - git checkout cool-feature - -So now you are on the branch with the changes to be incorporated upstream. The -rest of this section assumes you are on this branch. - -A few commits -============= - -If there are only a few commits, consider rebasing to upstream:: - - # Fetch upstream changes - git fetch upstream-rw - # rebase - git rebase upstream-rw/master - -Remember that, if you do a rebase, and push that, you'll have to close any -github pull requests manually, because github will not be able to detect the -changes have already been merged. - -A long series of commits -======================== - -If there are a longer series of related commits, consider a merge instead:: - - git fetch upstream-rw - git merge --no-ff upstream-rw/master - -The merge will be detected by github, and should close any related pull requests -automatically. - -Note the ``--no-ff`` above. This forces git to make a merge commit, rather than -doing a fast-forward, so that these set of commits branch off trunk then rejoin -the main history with a merge, rather than appearing to have been made directly -on top of trunk. - -Check the history -================= - -Now, in either case, you should check that the history is sensible and you have -the right commits:: - - git log --oneline --graph - git log -p upstream-rw/master.. - -The first line above just shows the history in a compact way, with a text -representation of the history graph. The second line shows the log of commits -excluding those that can be reached from trunk (``upstream-rw/master``), and -including those that can be reached from current HEAD (implied with the ``..`` -at the end). So, it shows the commits unique to this branch compared to trunk. -The ``-p`` option shows the diff for these commits in patch form. - -Push to trunk -============= - -:: - - git push upstream-rw my-new-feature:master - -This pushes the ``my-new-feature`` branch in this repository to the ``master`` -branch in the ``upstream-rw`` repository. - -.. include:: links.inc diff --git a/doc/developer/gitwash/patching.rst b/doc/developer/gitwash/patching.rst deleted file mode 100644 index 1c7f41b0..00000000 --- a/doc/developer/gitwash/patching.rst +++ /dev/null @@ -1,138 +0,0 @@ -.. highlight:: bash - -================ - Making a patch -================ - -You've discovered a bug or something else you want to change -in `networkx`_ .. |emdash| excellent! - -You've worked out a way to fix it |emdash| even better! - -You want to tell us about it |emdash| best of all! - -The easiest way is to make a *patch* or set of patches. Here -we explain how. Making a patch is the simplest and quickest, -but if you're going to be doing anything more than simple -quick things, please consider following the -:ref:`git-development` model instead. - -.. _making-patches: - -Making patches -============== - -Overview --------- - -:: - - # tell git who you are - git config --global user.email you@yourdomain.example.com - git config --global user.name "Your Name Comes Here" - # get the repository if you don't have it - git clone git://github.com/networkx/networkx.git - # make a branch for your patching - cd networkx - git branch the-fix-im-thinking-of - git checkout the-fix-im-thinking-of - # hack, hack, hack - # Tell git about any new files you've made - git add somewhere/tests/test_my_bug.py - # commit work in progress as you go - git commit -am 'BF - added tests for Funny bug' - # hack hack, hack - git commit -am 'BF - added fix for Funny bug' - # make the patch files - git format-patch -M -C master - -Then, send the generated patch files to the `networkx -mailing list`_ |emdash| where we will thank you warmly. - -In detail ---------- - -#. Tell git who you are so it can label the commits you've - made:: - - git config --global user.email you@yourdomain.example.com - git config --global user.name "Your Name Comes Here" - -#. If you don't already have one, clone a copy of the - `networkx`_ repository:: - - git clone git://github.com/networkx/networkx.git - cd networkx - -#. Make a 'feature branch'. This will be where you work on - your bug fix. It's nice and safe and leaves you with - access to an unmodified copy of the code in the main - branch:: - - git branch the-fix-im-thinking-of - git checkout the-fix-im-thinking-of - -#. Do some edits, and commit them as you go:: - - # hack, hack, hack - # Tell git about any new files you've made - git add somewhere/tests/test_my_bug.py - # commit work in progress as you go - git commit -am 'BF - added tests for Funny bug' - # hack hack, hack - git commit -am 'BF - added fix for Funny bug' - - Note the ``-am`` options to ``commit``. The ``m`` flag just - signals that you're going to type a message on the command - line. The ``a`` flag |emdash| you can just take on faith |emdash| - or see `why the -a flag?`_. - -#. When you have finished, check you have committed all your - changes:: - - git status - -#. Finally, make your commits into patches. You want all the - commits since you branched from the ``master`` branch:: - - git format-patch -M -C master - - You will now have several files named for the commits: - - .. code-block:: none - - 0001-BF-added-tests-for-Funny-bug.patch - 0002-BF-added-fix-for-Funny-bug.patch - - Send these files to the `networkx mailing list`_. - -When you are done, to switch back to the main copy of the -code, just return to the ``master`` branch:: - - git checkout master - -Moving from patching to development -=================================== - -If you find you have done some patches, and you have one or -more feature branches, you will probably want to switch to -development mode. You can do this with the repository you -have. - -Fork the `networkx`_ repository on github |emdash| :ref:`forking`. -Then:: - - # checkout and refresh master branch from main repo - git checkout master - git pull origin master - # rename pointer to main repository to 'upstream' - git remote rename origin upstream - # point your repo to default read / write to your fork on github - git remote add origin git@github.com:your-user-name/networkx.git - # push up any branches you've made and want to keep - git push origin the-fix-im-thinking-of - -Then you can, if you want, follow the -:ref:`development-workflow`. - -.. include:: links.inc diff --git a/doc/developer/gitwash/pull_button.png b/doc/developer/gitwash/pull_button.png Binary files differdeleted file mode 100644 index e5031681..00000000 --- a/doc/developer/gitwash/pull_button.png +++ /dev/null diff --git a/doc/developer/gitwash/set_up_fork.rst b/doc/developer/gitwash/set_up_fork.rst deleted file mode 100644 index 12cf72b7..00000000 --- a/doc/developer/gitwash/set_up_fork.rst +++ /dev/null @@ -1,73 +0,0 @@ -.. highlight:: bash - -.. _set-up-fork: - -================== - Set up your fork -================== - -First you follow the instructions for :ref:`forking`. - -Overview -======== - -:: - - git clone git@github.com:your-user-name/networkx.git - cd networkx - git remote add upstream git://github.com/networkx/networkx.git - -In detail -========= - -Clone your fork ---------------- - -#. Clone your fork to the local computer with ``git clone - git@github.com:your-user-name/networkx.git`` -#. Investigate. Change directory to your new repo: ``cd networkx``. Then - ``git branch -a`` to show you all branches. You'll get something - like: - - .. code-block:: none - - * master - remotes/origin/master - - This tells you that you are currently on the ``master`` branch, and - that you also have a ``remote`` connection to ``origin/master``. - What remote repository is ``remote/origin``? Try ``git remote -v`` to - see the URLs for the remote. They will point to your github fork. - - Now you want to connect to the upstream `networkx github`_ repository, so - you can merge in changes from trunk. - -.. _linking-to-upstream: - -Linking your repository to the upstream repo --------------------------------------------- - -:: - - cd networkx - git remote add upstream git://github.com/networkx/networkx.git - -``upstream`` here is just the arbitrary name we're using to refer to the -main `networkx`_ repository at `networkx github`_. - -Note that we've used ``git://`` for the URL rather than ``git@``. The -``git://`` URL is read only. This means we that we can't accidentally -(or deliberately) write to the upstream repo, and we are only going to -use it to merge into our own code. - -Just for your own satisfaction, show yourself that you now have a new -'remote', with ``git remote -v show``, giving you something like: - -.. code-block:: none - - upstream git://github.com/networkx/networkx.git (fetch) - upstream git://github.com/networkx/networkx.git (push) - origin git@github.com:your-user-name/networkx.git (fetch) - origin git@github.com:your-user-name/networkx.git (push) - -.. include:: links.inc diff --git a/doc/developer/gitwash/this_project.inc b/doc/developer/gitwash/this_project.inc deleted file mode 100644 index f1c18e73..00000000 --- a/doc/developer/gitwash/this_project.inc +++ /dev/null @@ -1,5 +0,0 @@ -.. networkx -.. _`networkx`: https://networkx.org -.. _`networkx github`: https://github.com/networkx/networkx - -.. _`networkx mailing list`: https://groups.google.com/group/networkx-discuss/ diff --git a/doc/developer/index.rst b/doc/developer/index.rst index 5a67221c..3d971d4d 100644 --- a/doc/developer/index.rst +++ b/doc/developer/index.rst @@ -12,7 +12,6 @@ Developer Guide projects new_contributor_faq core_developer - gitwash/index release deprecations roadmap diff --git a/doc/developer/nxeps/nxep-0000.rst b/doc/developer/nxeps/nxep-0000.rst index 434afb22..62a14fe6 100644 --- a/doc/developer/nxeps/nxep-0000.rst +++ b/doc/developer/nxeps/nxep-0000.rst @@ -263,7 +263,7 @@ References and Footnotes .. [1] This historical record is available by the normal git commands for retrieving older revisions, and can also be browsed on - `GitHub <https://github.com/networkx/networkx/tree/master/doc/nxeps>`_. + `GitHub <https://github.com/networkx/networkx/tree/main/doc/nxeps>`_. .. [2] The URL for viewing NXEPs on the web is https://networkx.org/documentation/latest/developer/nxeps/index.html diff --git a/doc/developer/projects.rst b/doc/developer/projects.rst index c968dcd8..42401601 100644 --- a/doc/developer/projects.rst +++ b/doc/developer/projects.rst @@ -58,7 +58,7 @@ Pedagogical Interactive Notebooks for Algorithms Implemented in NetworkX - Expected Outcome: A collection of Interactive Jupyter notebooks which explain and explore network algorithms to readers and users of NetworkX. An example notebook about Random Geometric Graphs is available at - https://nbviewer.jupyter.org/github/networkx/notebooks/blob/master/generators/geometric.ipynb + https://nbviewer.jupyter.org/github/networkx/notebooks/blob/main/generators/geometric.ipynb - Complexity: Depending on the algorithms you are interested to work on. diff --git a/doc/developer/release.rst b/doc/developer/release.rst index ee54394c..f5f617eb 100644 --- a/doc/developer/release.rst +++ b/doc/developer/release.rst @@ -45,7 +45,7 @@ Release Process - Push the new meta-data to github:: - git push --tags upstream master + git push --tags upstream main (where ``upstream`` is the name of the ``github.com:networkx/networkx`` repository.) @@ -96,7 +96,7 @@ Release Process git add networkx/release.py doc/_templates/layout.html git commit -m "Bump release version" - git push upstream master + git push upstream main - Update the web frontpage: The webpage is kept in a separate repo: networkx/website diff --git a/doc/release/contribs.py b/doc/release/contribs.py index 26963675..4c924fed 100644 --- a/doc/release/contribs.py +++ b/doc/release/contribs.py @@ -1,4 +1,5 @@ -# https://github.com/scikit-image/scikit-image/blob/master/doc/release/contribs.py +# https://github.com/networkx/networkx/pull/2542 +# https://github.com/scikit-image/scikit-image/blob/main/tools/generate_release_notes.py from subprocess import check_output import sys import string diff --git a/examples/drawing/plot_knuth_miles.py b/examples/drawing/plot_knuth_miles.py index 157dc699..45ef9f5c 100644 --- a/examples/drawing/plot_knuth_miles.py +++ b/examples/drawing/plot_knuth_miles.py @@ -15,7 +15,7 @@ This example is described in Section 1.1 of The data file can be found at: -- https://github.com/networkx/networkx/blob/master/examples/drawing/knuth_miles.txt.gz +- https://github.com/networkx/networkx/blob/main/examples/drawing/knuth_miles.txt.gz """ import gzip diff --git a/examples/drawing/plot_sampson.py b/examples/drawing/plot_sampson.py index adfa6d2f..d6eff642 100644 --- a/examples/drawing/plot_sampson.py +++ b/examples/drawing/plot_sampson.py @@ -9,7 +9,7 @@ Shows how to read data from a zip file and plot multiple frames. The data file can be found at: -- https://github.com/networkx/networkx/blob/master/examples/drawing/sampson_data.zip +- https://github.com/networkx/networkx/blob/main/examples/drawing/sampson_data.zip """ import zipfile diff --git a/examples/drawing/plot_unix_email.py b/examples/drawing/plot_unix_email.py index 4e1c6b6d..25fce7ae 100644 --- a/examples/drawing/plot_unix_email.py +++ b/examples/drawing/plot_unix_email.py @@ -14,7 +14,7 @@ objects (in this case a list of email messages). The sample unix email mailbox called "unix_email.mbox" may be found here: -- https://github.com/networkx/networkx/blob/master/examples/drawing/unix_email.mbox +- https://github.com/networkx/networkx/blob/main/examples/drawing/unix_email.mbox """ from email.utils import getaddresses, parseaddr diff --git a/examples/external/javascript_force.py b/examples/external/javascript_force.py index 8304ca79..0249961e 100644 --- a/examples/external/javascript_force.py +++ b/examples/external/javascript_force.py @@ -8,7 +8,7 @@ to produce an HTML/Javascript drawing. You will need to download the following directory: -- https://github.com/networkx/networkx/tree/master/examples/external/force +- https://github.com/networkx/networkx/tree/main/examples/external/force """ import json diff --git a/examples/graph/plot_roget.py b/examples/graph/plot_roget.py index 70023b47..777c0174 100644 --- a/examples/graph/plot_roget.py +++ b/examples/graph/plot_roget.py @@ -17,7 +17,7 @@ loops. (cf. 400pungency:400 401 403 405). The data file can be found at: -- https://github.com/networkx/networkx/blob/master/examples/graph/roget_dat.txt.gz +- https://github.com/networkx/networkx/blob/main/examples/graph/roget_dat.txt.gz """ import gzip diff --git a/examples/graph/plot_words.py b/examples/graph/plot_words.py index dddea7cd..3ff8f5c9 100644 --- a/examples/graph/plot_words.py +++ b/examples/graph/plot_words.py @@ -13,7 +13,7 @@ letter, resulting in 14,135 edges. This example is described in Section 1.1 of The data file can be found at: -- https://github.com/networkx/networkx/blob/master/examples/graph/words_dat.txt.gz +- https://github.com/networkx/networkx/blob/main/examples/graph/words_dat.txt.gz """ import gzip diff --git a/examples/graphviz_layout/plot_lanl_routes.py b/examples/graphviz_layout/plot_lanl_routes.py index 4247646d..fe3ff3dd 100644 --- a/examples/graphviz_layout/plot_lanl_routes.py +++ b/examples/graphviz_layout/plot_lanl_routes.py @@ -7,7 +7,7 @@ Routes to LANL from 186 sites on the Internet. The data file can be found at: -- https://github.com/networkx/networkx/blob/master/examples/drawing/lanl_routes.edgelist +- https://github.com/networkx/networkx/blob/main/examples/drawing/lanl_routes.edgelist This example needs Graphviz and PyGraphviz. """ diff --git a/tools/gitwash_dumper.py b/tools/gitwash_dumper.py deleted file mode 100644 index 939d0172..00000000 --- a/tools/gitwash_dumper.py +++ /dev/null @@ -1,257 +0,0 @@ -#!/usr/bin/env python -""" Checkout gitwash repo into directory and do search replace on name """ - - -import os -from os.path import join as pjoin -import shutil -import sys -import re -import glob -import fnmatch -import tempfile -from subprocess import call -from optparse import OptionParser - -verbose = False - - -def clone_repo(url, branch): - cwd = os.getcwd() - tmpdir = tempfile.mkdtemp() - try: - cmd = f"git clone {url} {tmpdir}" - call(cmd, shell=True) - os.chdir(tmpdir) - cmd = "git checkout %s" % branch - call(cmd, shell=True) - except: - shutil.rmtree(tmpdir) - raise - finally: - os.chdir(cwd) - return tmpdir - - -def cp_files(in_path, globs, out_path): - try: - os.makedirs(out_path) - except OSError: - pass - out_fnames = [] - for in_glob in globs: - in_glob_path = pjoin(in_path, in_glob) - for in_fname in glob.glob(in_glob_path): - out_fname = in_fname.replace(in_path, out_path) - pth, _ = os.path.split(out_fname) - if not os.path.isdir(pth): - os.makedirs(pth) - shutil.copyfile(in_fname, out_fname) - out_fnames.append(out_fname) - return out_fnames - - -def filename_search_replace(sr_pairs, filename, backup=False): - """Search and replace for expressions in files""" - with open(filename) as in_fh: - in_txt = in_fh.read(-1) - out_txt = in_txt[:] - for in_exp, out_exp in sr_pairs: - in_exp = re.compile(in_exp) - out_txt = in_exp.sub(out_exp, out_txt) - if in_txt == out_txt: - return False - with open(filename, "wt") as out_fh: - out_fh.write(out_txt) - if backup: - with open(filename + ".bak", "wt") as bak_fh: - bak_fh.write(in_txt) - return True - - -def copy_replace( - replace_pairs, repo_path, out_path, cp_globs=("*",), rep_globs=("*",), renames=() -): - out_fnames = cp_files(repo_path, cp_globs, out_path) - renames = [(re.compile(in_exp), out_exp) for in_exp, out_exp in renames] - fnames = [] - for rep_glob in rep_globs: - fnames += fnmatch.filter(out_fnames, rep_glob) - if verbose: - print("\n".join(fnames)) - for fname in fnames: - filename_search_replace(replace_pairs, fname, False) - for in_exp, out_exp in renames: - new_fname, n = in_exp.subn(out_exp, fname) - if n: - os.rename(fname, new_fname) - break - - -def make_link_targets( - proj_name, - user_name, - repo_name, - known_link_fname, - out_link_fname, - url=None, - ml_url=None, -): - """Check and make link targets - - If url is None or ml_url is None, check if there are links present for these - in `known_link_fname`. If not, raise error. The check is: - - Look for a target `proj_name`. - Look for a target `proj_name` + ' mailing list' - - Also, look for a target `proj_name` + 'github'. If this exists, don't write - this target into the new file below. - - If we are writing any of the url, ml_url, or github address, then write new - file with these links, of form: - - .. _`proj_name` - .. _`proj_name`: url - .. _`proj_name` mailing list: url - """ - with open(known_link_fname) as link_fh: - link_contents = link_fh.readlines() - have_url = not url is None - have_ml_url = not ml_url is None - have_gh_url = None - for line in link_contents: - if not have_url: - match = re.match(r"..\s+_`%s`:\s+" % proj_name, line) - if match: - have_url = True - if not have_ml_url: - match = re.match(r"..\s+_`%s mailing list`:\s+" % proj_name, line) - if match: - have_ml_url = True - if not have_gh_url: - match = re.match(r"..\s+_`%s github`:\s+" % proj_name, line) - if match: - have_gh_url = True - if not have_url or not have_ml_url: - raise RuntimeError( - "Need command line or known project " "and / or mailing list URLs" - ) - lines = [] - if not url is None: - lines.append(f".. _`{proj_name}`: {url}\n") - if not have_gh_url: - gh_url = f"https://github.com/{user_name}/{repo_name}\n" - lines.append(f".. _`{proj_name} github`: {gh_url}\n") - if not ml_url is None: - lines.append(f".. _`{proj_name} mailing list`: {ml_url}\n") - if len(lines) == 0: - # Nothing to do - return - # A neat little header line - lines = [".. %s\n" % proj_name] + lines - with open(out_link_fname, "wt") as out_links: - out_links.writelines(lines) - - -USAGE = """ <output_directory> <project_name> - -If not set with options, the repository name is the same as the <project -name> - -If not set with options, the main github user is the same as the -repository name.""" - - -GITWASH_CENTRAL = "git://github.com/matthew-brett/gitwash.git" -GITWASH_BRANCH = "master" - - -def main(): - parser = OptionParser() - parser.set_usage(parser.get_usage().strip() + USAGE) - parser.add_option( - "--repo-name", - dest="repo_name", - help="repository name - e.g. nitime", - metavar="REPO_NAME", - ) - parser.add_option( - "--github-user", - dest="main_gh_user", - help="github username for main repo - e.g fperez", - metavar="MAIN_GH_USER", - ) - parser.add_option( - "--gitwash-url", - dest="gitwash_url", - help="URL to gitwash repository - default %s" % GITWASH_CENTRAL, - default=GITWASH_CENTRAL, - metavar="GITWASH_URL", - ) - parser.add_option( - "--gitwash-branch", - dest="gitwash_branch", - help="branch in gitwash repository - default %s" % GITWASH_BRANCH, - default=GITWASH_BRANCH, - metavar="GITWASH_BRANCH", - ) - parser.add_option( - "--source-suffix", - dest="source_suffix", - help="suffix of ReST source files - default '.rst'", - default=".rst", - metavar="SOURCE_SUFFIX", - ) - parser.add_option( - "--project-url", - dest="project_url", - help="URL for project web pages", - default=None, - metavar="PROJECT_URL", - ) - parser.add_option( - "--project-ml-url", - dest="project_ml_url", - help="URL for project mailing list", - default=None, - metavar="PROJECT_ML_URL", - ) - (options, args) = parser.parse_args() - if len(args) < 2: - parser.print_help() - sys.exit() - out_path, project_name = args - if options.repo_name is None: - options.repo_name = project_name - if options.main_gh_user is None: - options.main_gh_user = options.repo_name - repo_path = clone_repo(options.gitwash_url, options.gitwash_branch) - try: - copy_replace( - ( - ("PROJECTNAME", project_name), - ("REPONAME", options.repo_name), - ("MAIN_GH_USER", options.main_gh_user), - ), - repo_path, - out_path, - cp_globs=(pjoin("gitwash", "*"),), - rep_globs=("*.rst",), - renames=((r"\.rst$", options.source_suffix),), - ) - make_link_targets( - project_name, - options.main_gh_user, - options.repo_name, - pjoin(out_path, "gitwash", "known_projects.inc"), - pjoin(out_path, "gitwash", "this_project.inc"), - options.project_url, - options.project_ml_url, - ) - finally: - shutil.rmtree(repo_path) - - -if __name__ == "__main__": - main() |