mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Merge branch 'master' into bugfix/3718
This commit is contained in:
+222
-67
@@ -1,99 +1,254 @@
|
||||
# Contribution Guidelines
|
||||
Contributing to Pipenv
|
||||
======================
|
||||
|
||||
Before opening any issues or proposing any pull requests, please do the
|
||||
following:
|
||||
If you\'re reading this, you\'re probably interested in contributing to
|
||||
Pipenv. Thank you very much! Open source projects live-and-die based on
|
||||
the support they receive from others, and the fact that you\'re even
|
||||
considering contributing to the Pipenv project is *very* generous of
|
||||
you.
|
||||
|
||||
1. Read our [Contributor's Guide](https://docs.pipenv.org/en/latest/dev/contributing/).
|
||||
2. Understand our [development philosophy](https://docs.pipenv.org/en/latest/dev/philosophy/).
|
||||
This document lays out guidelines and advice for contributing to this
|
||||
project. If you\'re thinking of contributing, please start by reading
|
||||
this document and getting a feel for how contributing to this project
|
||||
works. If you have any questions, feel free to reach out to either [Dan
|
||||
Ryan](https://github.com/techalchemy), [Tzu-ping
|
||||
Chung](https://github.com/uranusjr), or [Nate
|
||||
Prewitt](https://github.com/nateprewitt), the primary maintainers.
|
||||
|
||||
To get the greatest chance of helpful responses, please also observe the
|
||||
following additional notes.
|
||||
The guide is split into sections based on the type of contribution
|
||||
you\'re thinking of making, with a section that covers general
|
||||
guidelines for all contributors.
|
||||
|
||||
## Questions
|
||||
General Guidelines
|
||||
------------------
|
||||
|
||||
The GitHub issue tracker is for *bug reports* and *feature requests*. Please do
|
||||
not use it to ask questions about how to use Pipenv. These questions should
|
||||
instead be directed to [Stack Overflow](https://stackoverflow.com/). Make sure
|
||||
that your question is tagged with the `pipenv` tag when asking it on
|
||||
Stack Overflow, to ensure that it is answered promptly and accurately.
|
||||
### Be Cordial
|
||||
|
||||
## Good Bug Reports
|
||||
> **Be cordial or be on your way**. *---Kenneth Reitz*
|
||||
|
||||
Please be aware of the following things when filing bug reports:
|
||||
Pipenv has one very important rule governing all forms of contribution,
|
||||
including reporting bugs or requesting features. This golden rule is
|
||||
\"[be cordial or be on your
|
||||
way](https://www.kennethreitz.org/essays/be-cordial-or-be-on-your-way)\".
|
||||
|
||||
1. Avoid raising duplicate issues. *Please* use the GitHub issue search feature
|
||||
to check whether your bug report or feature request has been mentioned in
|
||||
the past. Duplicate bug reports and feature requests are a huge maintenance
|
||||
burden on the limited resources of the project. If it is clear from your
|
||||
report that you would have struggled to find the original, that's ok, but
|
||||
if searching for a selection of words in your issue title would have found
|
||||
the duplicate then the issue will likely be closed extremely abruptly.
|
||||
2. When filing bug reports about exceptions or tracebacks, please include the
|
||||
*complete* traceback. Partial tracebacks, or just the exception text, are
|
||||
not helpful. Issues that do not contain complete tracebacks may be closed
|
||||
without warning.
|
||||
3. Make sure you provide a suitable amount of information to work with. This
|
||||
means you should provide:
|
||||
**All contributions are welcome**, as long as everyone involved is
|
||||
treated with respect.
|
||||
|
||||
- Guidance on **how to reproduce the issue**. Ideally, this should be a
|
||||
*small* code sample that can be run immediately by the maintainers.
|
||||
Failing that, let us know what you're doing, how often it happens, what
|
||||
environment you're using, etc. Be thorough: it prevents us needing to ask
|
||||
further questions.
|
||||
- Tell us **what you expected to happen**. When we run your example code,
|
||||
what are we expecting to happen? What does "success" look like for your
|
||||
code?
|
||||
- Tell us **what actually happens**. It's not helpful for you to say "it
|
||||
doesn't work" or "it fails". Tell us *how* it fails: do you get an
|
||||
exception? A hang? The packages installed seem incorrect?
|
||||
How was the actual result different from your expected result?
|
||||
- Tell us **what version of Pipenv you're using**, and
|
||||
**how you installed it**. Different versions of Pipenv behave
|
||||
differently and have different bugs, and some distributors of Pipenv
|
||||
ship patches on top of the code we supply.
|
||||
### Get Early Feedback {#early-feedback}
|
||||
|
||||
If you do not provide all of these things, it will take us much longer to
|
||||
fix your problem. If we ask you to clarify these and you never respond, we
|
||||
will close your issue without fixing it.
|
||||
If you are contributing, do not feel the need to sit on your
|
||||
contribution until it is perfectly polished and complete. It helps
|
||||
everyone involved for you to seek feedback as early as you possibly can.
|
||||
Submitting an early, unfinished version of your contribution for
|
||||
feedback in no way prejudices your chances of getting that contribution
|
||||
accepted, and can save you from putting a lot of work into a
|
||||
contribution that is not suitable for the project.
|
||||
|
||||
## Development Setup
|
||||
### Contribution Suitability
|
||||
|
||||
Our project maintainers have the last word on whether or not a
|
||||
contribution is suitable for Pipenv. All contributions will be
|
||||
considered carefully, but from time to time, contributions will be
|
||||
rejected because they do not suit the current goals or needs of the
|
||||
project.
|
||||
|
||||
If your contribution is rejected, don\'t despair! As long as you
|
||||
followed these guidelines, you will have a much better chance of getting
|
||||
your next contribution accepted.
|
||||
|
||||
Questions
|
||||
---------
|
||||
|
||||
The GitHub issue tracker is for *bug reports* and *feature requests*.
|
||||
Please do not use it to ask questions about how to use Pipenv. These
|
||||
questions should instead be directed to [Stack
|
||||
Overflow](https://stackoverflow.com/). Make sure that your question is
|
||||
tagged with the `pipenv` tag when asking it on Stack Overflow, to ensure
|
||||
that it is answered promptly and accurately.
|
||||
|
||||
Code Contributions
|
||||
------------------
|
||||
|
||||
### Steps for Submitting Code
|
||||
|
||||
When contributing code, you\'ll want to follow this checklist:
|
||||
|
||||
1. Understand our [development
|
||||
philosophy](https://docs.pipenv.org/dev/philosophy/).
|
||||
2. Fork the repository on GitHub.
|
||||
3. Set up your `dev-setup`{.interpreted-text role="ref"}
|
||||
4. Run the tests (`testing`{.interpreted-text role="ref"}) to confirm
|
||||
they all pass on your system. If they don\'t, you\'ll need to
|
||||
investigate why they fail. If you\'re unable to diagnose this
|
||||
yourself, raise it as a bug report by following the guidelines in
|
||||
this document: `bug-reports`{.interpreted-text role="ref"}.
|
||||
5. Write tests that demonstrate your bug or feature. Ensure that they
|
||||
fail.
|
||||
6. Make your change.
|
||||
7. Run the entire test suite again, confirming that all tests pass
|
||||
*including the ones you just added*.
|
||||
8. Send a GitHub Pull Request to the main repository\'s `master`
|
||||
branch. GitHub Pull Requests are the expected method of code
|
||||
collaboration on this project.
|
||||
|
||||
The following sub-sections go into more detail on some of the points
|
||||
above.
|
||||
|
||||
### Development Setup {#dev-setup}
|
||||
|
||||
To get your development environment setup, run:
|
||||
|
||||
```sh
|
||||
``` {.sh}
|
||||
pip install -e .
|
||||
pipenv install --dev
|
||||
```
|
||||
|
||||
This will install the repo version of Pipenv and then install the development
|
||||
dependencies. Once that has completed, you can start developing.
|
||||
This will install the repo version of Pipenv and then install the
|
||||
development dependencies. Once that has completed, you can start
|
||||
developing.
|
||||
|
||||
The repo version of Pipenv must be installed over other global versions to
|
||||
resolve conflicts with the `pipenv` folder being implicitly added to `sys.path`.
|
||||
See [pypa/pipenv#2557](https://github.com/pypa/pipenv/issues/2557) for more details.
|
||||
The repo version of Pipenv must be installed over other global versions
|
||||
to resolve conflicts with the `pipenv` folder being implicitly added to
|
||||
`sys.path`. See
|
||||
[pypa/pipenv\#2557](https://github.com/pypa/pipenv/issues/2557) for more
|
||||
details.
|
||||
|
||||
### Testing
|
||||
|
||||
Tests are written in `pytest` style and can be run very simply:
|
||||
|
||||
```sh
|
||||
``` {.sh}
|
||||
pytest
|
||||
```
|
||||
|
||||
This will run all Pipenv tests, which can take awhile. To run a subset of the
|
||||
tests, the standard pytest filters are available, such as:
|
||||
This will run all Pipenv tests, which can take awhile. To run a subset
|
||||
of the tests, the standard pytest filters are available, such as:
|
||||
|
||||
- provide a directory or file: `pytest tests/unit` or `pytest tests/unit/test_cmdparse.py`
|
||||
- provide a keyword expression: `pytest -k test_lock_editable_vcs_without_install`
|
||||
- provide a nodeid: `pytest tests/unit/test_cmdparse.py::test_parse`
|
||||
- provide a test marker: `pytest -m lock`
|
||||
- provide a directory or file: `pytest tests/unit` or
|
||||
`pytest tests/unit/test_cmdparse.py`
|
||||
- provide a keyword expression:
|
||||
`pytest -k test_lock_editable_vcs_without_install`
|
||||
- provide a nodeid: `pytest tests/unit/test_cmdparse.py::test_parse`
|
||||
- provide a test marker: `pytest -m lock`
|
||||
|
||||
#### Package Index
|
||||
### Code Review
|
||||
|
||||
Contributions will not be merged until they\'ve been code reviewed. You
|
||||
should implement any code review feedback unless you strongly object to
|
||||
it. In the event that you object to the code review feedback, you should
|
||||
make your case clearly and calmly. If, after doing so, the feedback is
|
||||
judged to still apply, you must either apply the feedback or withdraw
|
||||
your contribution.
|
||||
|
||||
### Package Index
|
||||
|
||||
To speed up testing, tests that rely on a package index for locking and
|
||||
installing use a local server that contains vendored packages in the
|
||||
`tests/pypi` directory. Each vendored package should have it's own folder
|
||||
containing the necessary releases. When adding a release for a package, it is
|
||||
easiest to use either the `.tar.gz` or universal wheels (ex: `py2.py3-none`). If
|
||||
a `.tar.gz` or universal wheel is not available, add wheels for all available
|
||||
architectures and platforms.
|
||||
`tests/pypi` directory. Each vendored package should have it\'s own
|
||||
folder containing the necessary releases. When adding a release for a
|
||||
package, it is easiest to use either the `.tar.gz` or universal wheels
|
||||
(ex: `py2.py3-none`). If a `.tar.gz` or universal wheel is not
|
||||
available, add wheels for all available architectures and platforms.
|
||||
|
||||
Documentation Contributions
|
||||
---------------------------
|
||||
|
||||
Documentation improvements are always welcome! The documentation files
|
||||
live in the `docs/` directory of the codebase. They\'re written in
|
||||
[reStructuredText](http://docutils.sourceforge.net/rst.html), and use
|
||||
[Sphinx](http://sphinx-doc.org/index.html) to generate the full suite of
|
||||
documentation.
|
||||
|
||||
When contributing documentation, please do your best to follow the style
|
||||
of the documentation files. This means a soft-limit of 79 characters
|
||||
wide in your text files and a semi-formal, yet friendly and
|
||||
approachable, prose style.
|
||||
|
||||
When presenting Python code, use single-quoted strings (`'hello'`
|
||||
instead of `"hello"`).
|
||||
|
||||
Bug Reports
|
||||
-----------
|
||||
|
||||
Bug reports are hugely important! They are recorded as [GitHub
|
||||
issues](https://github.com/pypa/pipenv/issues). Please be aware of the
|
||||
following things when filing bug reports:
|
||||
|
||||
1. Avoid raising duplicate issues. *Please* use the GitHub issue search
|
||||
feature to check whether your bug report or feature request has been
|
||||
mentioned in the past. Duplicate bug reports and feature requests
|
||||
are a huge maintenance burden on the limited resources of the
|
||||
project. If it is clear from your report that you would have
|
||||
struggled to find the original, that\'s ok, but if searching for a
|
||||
selection of words in your issue title would have found the
|
||||
duplicate then the issue will likely be closed extremely abruptly.
|
||||
|
||||
2. When filing bug reports about exceptions or tracebacks, please
|
||||
include the *complete* traceback. Partial tracebacks, or just the
|
||||
exception text, are not helpful. Issues that do not contain complete
|
||||
tracebacks may be closed without warning.
|
||||
|
||||
3. Make sure you provide a suitable amount of information to work with.
|
||||
This means you should provide:
|
||||
|
||||
- Guidance on **how to reproduce the issue**. Ideally, this should
|
||||
be a *small* code sample that can be run immediately by the
|
||||
maintainers. Failing that, let us know what you\'re doing, how
|
||||
often it happens, what environment you\'re using, etc. Be
|
||||
thorough: it prevents us needing to ask further questions.
|
||||
- Tell us **what you expected to happen**. When we run your
|
||||
example code, what are we expecting to happen? What does
|
||||
\"success\" look like for your code?
|
||||
- Tell us **what actually happens**. It\'s not helpful for you to
|
||||
say \"it doesn\'t work\" or \"it fails\". Tell us *how* it
|
||||
fails: do you get an exception? A hang? The packages installed
|
||||
seem incorrect? How was the actual result different from your
|
||||
expected result?
|
||||
- Tell us **what version of Pipenv you\'re using**, and **how you
|
||||
installed it**. Different versions of Pipenv behave differently
|
||||
and have different bugs, and some distributors of Pipenv ship
|
||||
patches on top of the code we supply.
|
||||
|
||||
If you do not provide all of these things, it will take us much
|
||||
longer to fix your problem. If we ask you to clarify these and you
|
||||
never respond, we will close your issue without fixing it.
|
||||
|
||||
Run the tests
|
||||
-------------
|
||||
|
||||
Three ways of running the tests are as follows:
|
||||
|
||||
1. `make test` (which uses `docker`)
|
||||
2. `./run-tests.sh` or `run-tests.bat`
|
||||
3. Using pipenv:
|
||||
|
||||
``` {.console}
|
||||
$ git clone https://github.com/pypa/pipenv.git
|
||||
$ cd pipenv
|
||||
$ git submodule sync && git submodule update --init --recursive
|
||||
$ pipenv install --dev
|
||||
$ pipenv run pytest
|
||||
```
|
||||
|
||||
For the last two, it is important that your environment is setup
|
||||
correctly, and this may take some work, for example, on a specific Mac
|
||||
installation, the following steps may be needed:
|
||||
|
||||
# Make sure the tests can access github
|
||||
if [ "$SSH_AGENT_PID" = "" ]
|
||||
then
|
||||
eval `ssh-agent`
|
||||
ssh-add
|
||||
fi
|
||||
|
||||
# Use unix like utilities, installed with brew,
|
||||
# e.g. brew install coreutils
|
||||
for d in /usr/local/opt/*/libexec/gnubin /usr/local/opt/python/libexec/bin
|
||||
do
|
||||
[[ ":$PATH:" != *":$d:"* ]] && PATH="$d:${PATH}"
|
||||
done
|
||||
|
||||
export PATH
|
||||
|
||||
# PIP_FIND_LINKS currently breaks test_uninstall.py
|
||||
unset PIP_FIND_LINKS
|
||||
|
||||
@@ -412,6 +412,7 @@ Environment variables may be specified as ``${MY_ENVAR}`` or ``$MY_ENVAR``.
|
||||
|
||||
On Windows, ``%MY_ENVAR%`` is supported in addition to ``${MY_ENVAR}`` or ``$MY_ENVAR``.
|
||||
|
||||
.. _configuration-with-environment-variables:
|
||||
|
||||
☤ Configuration With Environment Variables
|
||||
------------------------------------------
|
||||
|
||||
+6
-8
@@ -183,12 +183,12 @@ in your ``Pipfile.lock`` for now, run ``pipenv lock --keep-outdated``. Make sur
|
||||
☤ Specifying Versions of a Package
|
||||
----------------------------------
|
||||
|
||||
You can specify versions of a package using the `Semantic Versioning scheme <https://semver.org/>`_
|
||||
(i.e. ``major.minor.micro``).
|
||||
You can specify versions of a package using the `Semantic Versioning scheme <https://semver.org/>`_
|
||||
(i.e. ``major.minor.micro``).
|
||||
|
||||
For example, to install requests you can use: ::
|
||||
|
||||
$ pipenv install requests~=1.2 # equivalent to requests~=1.2.0
|
||||
$ pipenv install requests~=1.2 # equivalent to requests~=1.2.0
|
||||
|
||||
Pipenv will install version ``1.2`` and any minor update, but not ``2.0``.
|
||||
|
||||
@@ -202,11 +202,11 @@ To make inclusive or exclusive version comparisons you can use: ::
|
||||
|
||||
$ pipenv install "requests>=1.4" # will install a version equal or larger than 1.4.0
|
||||
$ pipenv install "requests<=2.13" # will install a version equal or lower than 2.13.0
|
||||
$ pipenv install "requests>2.19" # will install 2.19.1 but not 2.19.0
|
||||
$ pipenv install "requests>2.19" # will install 2.19.1 but not 2.19.0
|
||||
|
||||
.. note:: The use of double quotes around the package and version specification (i.e. ``"requests>2.19"``) is highly recommended
|
||||
to avoid issues with `Input and output redirection <https://robots.thoughtbot.com/input-output-redirection-in-the-shell>`_
|
||||
in Unix-based operating systems.
|
||||
in Unix-based operating systems.
|
||||
|
||||
The use of ``~=`` is preferred over the ``==`` identifier as the latter prevents pipenv from updating the packages: ::
|
||||
|
||||
@@ -399,10 +399,8 @@ environment into production. You can use ``pipenv lock`` to compile your depende
|
||||
your development environment and deploy the compiled ``Pipfile.lock`` to all of your
|
||||
production environments for reproducible builds.
|
||||
|
||||
.. note:
|
||||
.. note::
|
||||
|
||||
If you'd like a ``requirements.txt`` output of the lockfile, run ``$ pipenv lock -r``.
|
||||
This will include all hashes, however (which is great!). To get a ``requirements.txt``
|
||||
without hashes, use ``$ pipenv run pip freeze``.
|
||||
|
||||
.. _configuration-with-environment-variables:https://docs.pipenv.org/advanced/#configuration-with-environment-variables
|
||||
|
||||
+133
-16
@@ -20,8 +20,12 @@ The guide is split into sections based on the type of contribution you're
|
||||
thinking of making, with a section that covers general guidelines for all
|
||||
contributors.
|
||||
|
||||
|
||||
General Guidelines
|
||||
------------------
|
||||
|
||||
Be Cordial
|
||||
----------
|
||||
~~~~~~~~~~
|
||||
|
||||
**Be cordial or be on your way**. *—Kenneth Reitz*
|
||||
|
||||
@@ -34,10 +38,11 @@ everyone involved is treated with respect.
|
||||
|
||||
.. _be cordial or be on your way: https://www.kennethreitz.org/essays/be-cordial-or-be-on-your-way
|
||||
|
||||
|
||||
.. _early-feedback:
|
||||
|
||||
Get Early Feedback
|
||||
------------------
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you are contributing, do not feel the need to sit on your contribution until
|
||||
it is perfectly polished and complete. It helps everyone involved for you to
|
||||
@@ -47,7 +52,7 @@ getting that contribution accepted, and can save you from putting a lot of work
|
||||
into a contribution that is not suitable for the project.
|
||||
|
||||
Contribution Suitability
|
||||
------------------------
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Our project maintainers have the last word on whether or not a contribution is
|
||||
suitable for Pipenv. All contributions will be considered carefully, but from
|
||||
@@ -58,29 +63,92 @@ If your contribution is rejected, don't despair! As long as you followed these
|
||||
guidelines, you will have a much better chance of getting your next
|
||||
contribution accepted.
|
||||
|
||||
|
||||
Questions
|
||||
---------
|
||||
|
||||
The GitHub issue tracker is for *bug reports* and *feature requests*. Please do
|
||||
not use it to ask questions about how to use Pipenv. These questions should
|
||||
instead be directed to `Stack Overflow`_. Make sure that your question is tagged
|
||||
with the ``pipenv`` tag when asking it on Stack Overflow, to ensure that it is
|
||||
answered promptly and accurately.
|
||||
|
||||
.. _Stack Overflow: https://stackoverflow.com/
|
||||
|
||||
|
||||
Code Contributions
|
||||
------------------
|
||||
|
||||
|
||||
Steps for Submitting Code
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
When contributing code, you'll want to follow this checklist:
|
||||
|
||||
1. Fork the repository on GitHub.
|
||||
2. `Run the tests`_ to confirm they all pass on your system. If they don't, you'll
|
||||
need to investigate why they fail. If you're unable to diagnose this
|
||||
yourself, raise it as a bug report by following the guidelines in this
|
||||
document: :ref:`bug-reports`.
|
||||
3. Write tests that demonstrate your bug or feature. Ensure that they fail.
|
||||
4. Make your change.
|
||||
5. Run the entire test suite again, confirming that all tests pass *including
|
||||
#. Understand our `development philosophy`_.
|
||||
#. Fork the repository on GitHub.
|
||||
#. Set up your :ref:`dev-setup`
|
||||
#. Run the tests (:ref:`testing`) to confirm they all pass on your system.
|
||||
If they don't, you'll need to investigate why they fail. If you're unable
|
||||
to diagnose this yourself, raise it as a bug report by following the guidelines
|
||||
in this document: :ref:`bug-reports`.
|
||||
#. Write tests that demonstrate your bug or feature. Ensure that they fail.
|
||||
#. Make your change.
|
||||
#. Run the entire test suite again, confirming that all tests pass *including
|
||||
the ones you just added*.
|
||||
6. Send a GitHub Pull Request to the main repository's ``master`` branch.
|
||||
#. Send a GitHub Pull Request to the main repository's ``master`` branch.
|
||||
GitHub Pull Requests are the expected method of code collaboration on this
|
||||
project.
|
||||
|
||||
The following sub-sections go into more detail on some of the points above.
|
||||
|
||||
.. _development philosophy: https://docs.pipenv.org/dev/philosophy/
|
||||
|
||||
|
||||
.. _dev-setup:
|
||||
|
||||
Development Setup
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
To get your development environment setup, run:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
pip install -e .
|
||||
pipenv install --dev
|
||||
|
||||
|
||||
This will install the repo version of Pipenv and then install the development
|
||||
dependencies. Once that has completed, you can start developing.
|
||||
|
||||
The repo version of Pipenv must be installed over other global versions to
|
||||
resolve conflicts with the ``pipenv`` folder being implicitly added to ``sys.path``.
|
||||
See `pypa/pipenv#2557`_ for more details.
|
||||
|
||||
.. _pypa/pipenv#2557: https://github.com/pypa/pipenv/issues/2557
|
||||
|
||||
|
||||
.. _testing:
|
||||
|
||||
Testing
|
||||
~~~~~~~
|
||||
|
||||
Tests are written in ``pytest`` style and can be run very simply:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
pytest
|
||||
|
||||
|
||||
This will run all Pipenv tests, which can take awhile. To run a subset of the
|
||||
tests, the standard pytest filters are available, such as:
|
||||
|
||||
- provide a directory or file: ``pytest tests/unit`` or ``pytest tests/unit/test_cmdparse.py``
|
||||
- provide a keyword expression: ``pytest -k test_lock_editable_vcs_without_install``
|
||||
- provide a nodeid: ``pytest tests/unit/test_cmdparse.py::test_parse``
|
||||
- provide a test marker: ``pytest -m lock``
|
||||
|
||||
|
||||
Code Review
|
||||
~~~~~~~~~~~
|
||||
|
||||
@@ -90,6 +158,20 @@ event that you object to the code review feedback, you should make your case
|
||||
clearly and calmly. If, after doing so, the feedback is judged to still apply,
|
||||
you must either apply the feedback or withdraw your contribution.
|
||||
|
||||
|
||||
Package Index
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
To speed up testing, tests that rely on a package index for locking and
|
||||
installing use a local server that contains vendored packages in the
|
||||
``tests/pypi`` directory. Each vendored package should have it's own folder
|
||||
containing the necessary releases. When adding a release for a package, it is
|
||||
easiest to use either the ``.tar.gz`` or universal wheels (ex: ``py2.py3-none``). If
|
||||
a ``.tar.gz`` or universal wheel is not available, add wheels for all available
|
||||
architectures and platforms.
|
||||
|
||||
|
||||
|
||||
Documentation Contributions
|
||||
---------------------------
|
||||
|
||||
@@ -114,13 +196,48 @@ When presenting Python code, use single-quoted strings (``'hello'`` instead of
|
||||
Bug Reports
|
||||
-----------
|
||||
|
||||
Bug reports are hugely important! Before you raise one, though, please check
|
||||
through the `GitHub issues`_, **both open and closed**, to confirm that the bug
|
||||
hasn't been reported before. Duplicate bug reports are a huge drain on the time
|
||||
of other contributors, and should be avoided as much as possible.
|
||||
Bug reports are hugely important! They are recorded as `GitHub issues`_. Please
|
||||
be aware of the following things when filing bug reports:
|
||||
|
||||
.. _GitHub issues: https://github.com/pypa/pipenv/issues
|
||||
|
||||
1. Avoid raising duplicate issues. *Please* use the GitHub issue search feature
|
||||
to check whether your bug report or feature request has been mentioned in
|
||||
the past. Duplicate bug reports and feature requests are a huge maintenance
|
||||
burden on the limited resources of the project. If it is clear from your
|
||||
report that you would have struggled to find the original, that's ok, but
|
||||
if searching for a selection of words in your issue title would have found
|
||||
the duplicate then the issue will likely be closed extremely abruptly.
|
||||
2. When filing bug reports about exceptions or tracebacks, please include the
|
||||
*complete* traceback. Partial tracebacks, or just the exception text, are
|
||||
not helpful. Issues that do not contain complete tracebacks may be closed
|
||||
without warning.
|
||||
3. Make sure you provide a suitable amount of information to work with. This
|
||||
means you should provide:
|
||||
|
||||
- Guidance on **how to reproduce the issue**. Ideally, this should be a
|
||||
*small* code sample that can be run immediately by the maintainers.
|
||||
Failing that, let us know what you're doing, how often it happens, what
|
||||
environment you're using, etc. Be thorough: it prevents us needing to ask
|
||||
further questions.
|
||||
- Tell us **what you expected to happen**. When we run your example code,
|
||||
what are we expecting to happen? What does "success" look like for your
|
||||
code?
|
||||
- Tell us **what actually happens**. It's not helpful for you to say "it
|
||||
doesn't work" or "it fails". Tell us *how* it fails: do you get an
|
||||
exception? A hang? The packages installed seem incorrect?
|
||||
How was the actual result different from your expected result?
|
||||
- Tell us **what version of Pipenv you're using**, and
|
||||
**how you installed it**. Different versions of Pipenv behave
|
||||
differently and have different bugs, and some distributors of Pipenv
|
||||
ship patches on top of the code we supply.
|
||||
|
||||
If you do not provide all of these things, it will take us much longer to
|
||||
fix your problem. If we ask you to clarify these and you never respond, we
|
||||
will close your issue without fixing it.
|
||||
|
||||
.. _run-the-tests:
|
||||
|
||||
Run the tests
|
||||
-------------
|
||||
|
||||
|
||||
+1
-1
@@ -223,7 +223,7 @@ have access to your installed packages with ``$ pipenv shell``.
|
||||
|
||||
|
||||
☤ Virtualenv mapping caveat
|
||||
============
|
||||
===========================
|
||||
|
||||
- Pipenv automatically maps projects to their specific virtualenvs.
|
||||
- The virtualenv is stored globally with the name of the project’s root directory plus the hash of the full path to the project's root (e.g., ``my_project-a3de50``).
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Consolidate all contributing docs in the rst file
|
||||
@@ -0,0 +1 @@
|
||||
Update the out-dated manual page.
|
||||
@@ -104,7 +104,7 @@ def cli(
|
||||
|
||||
if man:
|
||||
if system_which("man"):
|
||||
path = os.sep.join([os.path.dirname(__file__), "pipenv.1"])
|
||||
path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "pipenv.1")
|
||||
os.execle(system_which("man"), "man", path, os.environ)
|
||||
return 0
|
||||
else:
|
||||
|
||||
+2933
-172
File diff suppressed because it is too large
Load Diff
+106
-68
@@ -8,9 +8,7 @@ import sys
|
||||
import invoke
|
||||
|
||||
from parver import Version
|
||||
from towncrier._builder import (
|
||||
find_fragments, render_fragments, split_fragments
|
||||
)
|
||||
from towncrier._builder import find_fragments, render_fragments, split_fragments
|
||||
from towncrier._settings import load_config
|
||||
|
||||
from pipenv.__version__ import __version__
|
||||
@@ -19,13 +17,13 @@ from pipenv.vendor.vistir.contextmanagers import temp_environ
|
||||
from .vendoring import _get_git_root, drop_dir
|
||||
|
||||
|
||||
VERSION_FILE = 'pipenv/__version__.py'
|
||||
VERSION_FILE = "pipenv/__version__.py"
|
||||
ROOT = pathlib.Path(".").parent.parent.absolute()
|
||||
PACKAGE_NAME = "pipenv"
|
||||
|
||||
|
||||
def log(msg):
|
||||
print('[release] %s' % msg)
|
||||
print("[release] %s" % msg)
|
||||
|
||||
|
||||
def get_version_file(ctx):
|
||||
@@ -34,41 +32,41 @@ def get_version_file(ctx):
|
||||
|
||||
def find_version(ctx):
|
||||
version_file = get_version_file(ctx).read_text()
|
||||
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",version_file, re.M)
|
||||
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
|
||||
if version_match:
|
||||
return version_match.group(1)
|
||||
raise RuntimeError("Unable to find version string.")
|
||||
|
||||
|
||||
def get_history_file(ctx):
|
||||
return _get_git_root(ctx).joinpath('HISTORY.txt')
|
||||
return _get_git_root(ctx).joinpath("HISTORY.txt")
|
||||
|
||||
|
||||
def get_dist_dir(ctx):
|
||||
return _get_git_root(ctx) / 'dist'
|
||||
return _get_git_root(ctx) / "dist"
|
||||
|
||||
|
||||
def get_build_dir(ctx):
|
||||
return _get_git_root(ctx) / 'build'
|
||||
return _get_git_root(ctx) / "build"
|
||||
|
||||
|
||||
def _render_log():
|
||||
"""Totally tap into Towncrier internals to get an in-memory result.
|
||||
"""
|
||||
config = load_config(ROOT)
|
||||
definitions = config['types']
|
||||
definitions = config["types"]
|
||||
fragments, fragment_filenames = find_fragments(
|
||||
pathlib.Path(config['directory']).absolute(),
|
||||
config['sections'],
|
||||
pathlib.Path(config["directory"]).absolute(),
|
||||
config["sections"],
|
||||
None,
|
||||
definitions,
|
||||
)
|
||||
rendered = render_fragments(
|
||||
pathlib.Path(config['template']).read_text(encoding='utf-8'),
|
||||
config['issue_format'],
|
||||
pathlib.Path(config["template"]).read_text(encoding="utf-8"),
|
||||
config["issue_format"],
|
||||
split_fragments(fragments, definitions),
|
||||
definitions,
|
||||
config['underlines'][1:],
|
||||
config["underlines"][1:],
|
||||
False, # Don't add newlines to wrapped text.
|
||||
)
|
||||
return rendered
|
||||
@@ -81,20 +79,25 @@ def release(ctx, dry_run=False):
|
||||
version = find_version(ctx)
|
||||
tag_content = _render_log()
|
||||
if dry_run:
|
||||
ctx.run('towncrier --draft > CHANGELOG.draft.rst')
|
||||
log('would remove: news/*')
|
||||
log('would remove: CHANGELOG.draft.rst')
|
||||
ctx.run("towncrier --draft > CHANGELOG.draft.rst")
|
||||
log("would remove: news/*")
|
||||
log("would remove: CHANGELOG.draft.rst")
|
||||
log(f'Would commit with message: "Release v{version}"')
|
||||
else:
|
||||
ctx.run('towncrier')
|
||||
ctx.run("git add CHANGELOG.rst news/ {0}".format(get_version_file(ctx).as_posix()))
|
||||
ctx.run("towncrier")
|
||||
ctx.run(
|
||||
"git add CHANGELOG.rst news/ {0}".format(get_version_file(ctx).as_posix())
|
||||
)
|
||||
ctx.run("git rm CHANGELOG.draft.rst")
|
||||
generate_manual(ctx)
|
||||
ctx.run(f'git commit -m "Release v{version}"')
|
||||
|
||||
tag_content = tag_content.replace('"', '\\"')
|
||||
if dry_run:
|
||||
log(f"Generated tag content: {tag_content}")
|
||||
markdown = ctx.run("pandoc CHANGELOG.draft.rst -f rst -t markdown", hide=True).stdout.strip()
|
||||
markdown = ctx.run(
|
||||
"pandoc CHANGELOG.draft.rst -f rst -t markdown", hide=True
|
||||
).stdout.strip()
|
||||
content = clean_mdchangelog(ctx, markdown)
|
||||
log(f"would generate markdown: {content}")
|
||||
else:
|
||||
@@ -104,8 +107,8 @@ def release(ctx, dry_run=False):
|
||||
build_dists(ctx)
|
||||
if dry_run:
|
||||
dist_pattern = f'{PACKAGE_NAME.replace("-", "[-_]")}-*'
|
||||
artifacts = list(ROOT.joinpath('dist').glob(dist_pattern))
|
||||
filename_display = '\n'.join(f' {a}' for a in artifacts)
|
||||
artifacts = list(ROOT.joinpath("dist").glob(dist_pattern))
|
||||
filename_display = "\n".join(f" {a}" for a in artifacts)
|
||||
log(f"Would upload dists: {filename_display}")
|
||||
else:
|
||||
upload_dists(ctx)
|
||||
@@ -113,66 +116,90 @@ def release(ctx, dry_run=False):
|
||||
|
||||
|
||||
def drop_dist_dirs(ctx):
|
||||
log('Dropping Dist dir...')
|
||||
log("Dropping Dist dir...")
|
||||
drop_dir(get_dist_dir(ctx))
|
||||
log('Dropping build dir...')
|
||||
log("Dropping build dir...")
|
||||
drop_dir(get_build_dir(ctx))
|
||||
|
||||
|
||||
@invoke.task
|
||||
def build_dists(ctx):
|
||||
drop_dist_dirs(ctx)
|
||||
for py_version in ['3.6', '2.7']:
|
||||
env = {'PIPENV_PYTHON': py_version}
|
||||
for py_version in ["3.6", "2.7"]:
|
||||
env = {"PIPENV_PYTHON": py_version}
|
||||
with ctx.cd(ROOT.as_posix()), temp_environ():
|
||||
executable = ctx.run("python -c 'import sys; print(sys.executable)'", hide=True).stdout.strip()
|
||||
log('Building sdist using %s ....' % executable)
|
||||
executable = ctx.run(
|
||||
"python -c 'import sys; print(sys.executable)'", hide=True
|
||||
).stdout.strip()
|
||||
log("Building sdist using %s ...." % executable)
|
||||
os.environ["PIPENV_PYTHON"] = py_version
|
||||
ctx.run('pipenv install --dev', env=env)
|
||||
ctx.run('pipenv run pip install -e . --upgrade --upgrade-strategy=eager', env=env)
|
||||
log('Building wheel using python %s ....' % py_version)
|
||||
if py_version == '3.6':
|
||||
ctx.run('pipenv run python setup.py sdist bdist_wheel', env=env)
|
||||
ctx.run("pipenv install --dev", env=env)
|
||||
ctx.run(
|
||||
"pipenv run pip install -e . --upgrade --upgrade-strategy=eager", env=env
|
||||
)
|
||||
log("Building wheel using python %s ...." % py_version)
|
||||
if py_version == "3.6":
|
||||
ctx.run("pipenv run python setup.py sdist bdist_wheel", env=env)
|
||||
else:
|
||||
ctx.run('pipenv run python setup.py bdist_wheel', env=env)
|
||||
ctx.run("pipenv run python setup.py bdist_wheel", env=env)
|
||||
|
||||
|
||||
@invoke.task(build_dists)
|
||||
def upload_dists(ctx, repo="pypi"):
|
||||
dist_pattern = f'{PACKAGE_NAME.replace("-", "[-_]")}-*'
|
||||
artifacts = list(ROOT.joinpath('dist').glob(dist_pattern))
|
||||
filename_display = '\n'.join(f' {a}' for a in artifacts)
|
||||
print(f'[release] Will upload:\n{filename_display}')
|
||||
artifacts = list(ROOT.joinpath("dist").glob(dist_pattern))
|
||||
filename_display = "\n".join(f" {a}" for a in artifacts)
|
||||
print(f"[release] Will upload:\n{filename_display}")
|
||||
try:
|
||||
input('[release] Release ready. ENTER to upload, CTRL-C to abort: ')
|
||||
input("[release] Release ready. ENTER to upload, CTRL-C to abort: ")
|
||||
except KeyboardInterrupt:
|
||||
print('\nAborted!')
|
||||
print("\nAborted!")
|
||||
return
|
||||
|
||||
arg_display = ' '.join(f'"{n}"' for n in artifacts)
|
||||
arg_display = " ".join(f'"{n}"' for n in artifacts)
|
||||
ctx.run(f'twine upload --repository="{repo}" {arg_display}')
|
||||
|
||||
|
||||
|
||||
@invoke.task
|
||||
def generate_markdown(ctx):
|
||||
log('Generating markdown from changelog...')
|
||||
ctx.run('pandoc CHANGELOG.rst -f rst -t markdown -o CHANGELOG.md')
|
||||
log("Generating markdown from changelog...")
|
||||
ctx.run("pandoc CHANGELOG.rst -f rst -t markdown -o CHANGELOG.md")
|
||||
|
||||
|
||||
@invoke.task
|
||||
def generate_manual(ctx, commit=False):
|
||||
log("Generating manual from reStructuredText source...")
|
||||
ctx.run("make man -C docs")
|
||||
ctx.run("cp docs/_build/man/pipenv.1 pipenv/")
|
||||
if commit:
|
||||
log("Commiting...")
|
||||
ctx.run("git add pipenv/pipenv.1")
|
||||
ctx.run('git commit -m "Update manual page."')
|
||||
|
||||
|
||||
@invoke.task
|
||||
def generate_contributing_md(ctx, commit=False):
|
||||
log("Generating CONTRIBUTING.md from reStructuredText source...")
|
||||
ctx.run("pandoc docs/dev/contributing.rst -f rst -t markdown -o CONTRIBUTING.md")
|
||||
if commit:
|
||||
log("Commiting...")
|
||||
ctx.run("git add CONTRIBUTING.md")
|
||||
ctx.run('git commit -m "Update CONTRIBUTING.md."')
|
||||
|
||||
|
||||
@invoke.task
|
||||
def generate_changelog(ctx, commit=False, draft=False):
|
||||
log('Generating changelog...')
|
||||
log("Generating changelog...")
|
||||
if draft:
|
||||
commit = False
|
||||
log('Writing draft to file...')
|
||||
ctx.run('towncrier --draft > CHANGELOG.draft.rst')
|
||||
log("Writing draft to file...")
|
||||
ctx.run("towncrier --draft > CHANGELOG.draft.rst")
|
||||
else:
|
||||
ctx.run('towncrier')
|
||||
ctx.run("towncrier")
|
||||
if commit:
|
||||
log('Committing...')
|
||||
ctx.run('git add CHANGELOG.rst')
|
||||
ctx.run('git rm CHANGELOG.draft.rst')
|
||||
log("Committing...")
|
||||
ctx.run("git add CHANGELOG.rst")
|
||||
ctx.run("git rm CHANGELOG.draft.rst")
|
||||
ctx.run('git commit -m "Update changelog."')
|
||||
|
||||
|
||||
@@ -182,7 +209,12 @@ def clean_mdchangelog(ctx, content=None):
|
||||
if not content:
|
||||
changelog = _get_git_root(ctx) / "CHANGELOG.md"
|
||||
content = changelog.read_text()
|
||||
content = re.sub(r"([^\n]+)\n?\s+\[[\\]+(#\d+)\]\(https://github\.com/pypa/[\w\-]+/issues/\d+\)", r"\1 \2", content, flags=re.MULTILINE)
|
||||
content = re.sub(
|
||||
r"([^\n]+)\n?\s+\[[\\]+(#\d+)\]\(https://github\.com/pypa/[\w\-]+/issues/\d+\)",
|
||||
r"\1 \2",
|
||||
content,
|
||||
flags=re.MULTILINE,
|
||||
)
|
||||
if changelog:
|
||||
changelog.write_text(content)
|
||||
else:
|
||||
@@ -193,12 +225,12 @@ def clean_mdchangelog(ctx, content=None):
|
||||
def tag_version(ctx, push=False):
|
||||
version = find_version(ctx)
|
||||
version = Version.parse(version)
|
||||
log('Tagging revision: v%s' % version.normalize())
|
||||
ctx.run('git tag v%s' % version.normalize())
|
||||
log("Tagging revision: v%s" % version.normalize())
|
||||
ctx.run("git tag v%s" % version.normalize())
|
||||
if push:
|
||||
log('Pushing tags...')
|
||||
ctx.run('git push origin master')
|
||||
ctx.run('git push --tags')
|
||||
log("Pushing tags...")
|
||||
ctx.run("git push origin master")
|
||||
ctx.run("git push --tags")
|
||||
|
||||
|
||||
@invoke.task
|
||||
@@ -206,32 +238,38 @@ def bump_version(ctx, dry_run=False, dev=False, pre=False, tag=None, commit=Fals
|
||||
current_version = Version.parse(__version__)
|
||||
today = datetime.date.today()
|
||||
tomorrow = today + datetime.timedelta(days=1)
|
||||
next_month = datetime.date.today().replace(month=today.month+1, day=1)
|
||||
next_year = datetime.date.today().replace(year=today.year+1, month=1, day=1)
|
||||
next_month = datetime.date.today().replace(month=today.month + 1, day=1)
|
||||
next_year = datetime.date.today().replace(year=today.year + 1, month=1, day=1)
|
||||
if pre and not tag:
|
||||
print('Using "pre" requires a corresponding tag.')
|
||||
return
|
||||
if not (dev or pre or tag):
|
||||
new_version = current_version.replace(release=today.timetuple()[:3]).clear(pre=True, dev=True)
|
||||
new_version = current_version.replace(release=today.timetuple()[:3]).clear(
|
||||
pre=True, dev=True
|
||||
)
|
||||
if pre and dev:
|
||||
raise RuntimeError("Can't use 'pre' and 'dev' together!")
|
||||
if dev or pre:
|
||||
new_version = current_version.replace(release=tomorrow.timetuple()[:3]).clear(pre=True, dev=True)
|
||||
new_version = current_version.replace(release=tomorrow.timetuple()[:3]).clear(
|
||||
pre=True, dev=True
|
||||
)
|
||||
if dev:
|
||||
new_version = new_version.bump_dev()
|
||||
else:
|
||||
new_version = new_version.bump_pre(tag=tag)
|
||||
log('Updating version to %s' % new_version.normalize())
|
||||
log("Updating version to %s" % new_version.normalize())
|
||||
version = find_version(ctx)
|
||||
log('Found current version: %s' % version)
|
||||
log("Found current version: %s" % version)
|
||||
if dry_run:
|
||||
log('Would update to: %s' % new_version.normalize())
|
||||
log("Would update to: %s" % new_version.normalize())
|
||||
else:
|
||||
log('Updating to: %s' % new_version.normalize())
|
||||
log("Updating to: %s" % new_version.normalize())
|
||||
version_file = get_version_file(ctx)
|
||||
file_contents = version_file.read_text()
|
||||
version_file.write_text(file_contents.replace(version, str(new_version.normalize())))
|
||||
version_file.write_text(
|
||||
file_contents.replace(version, str(new_version.normalize()))
|
||||
)
|
||||
if commit:
|
||||
ctx.run('git add {0}'.format(version_file.as_posix()))
|
||||
log('Committing...')
|
||||
ctx.run("git add {0}".format(version_file.as_posix()))
|
||||
log("Committing...")
|
||||
ctx.run('git commit -s -m "Bumped version."')
|
||||
|
||||
Reference in New Issue
Block a user