- 31 Aug, 2022 13 commits
-
-
B023: Functions defined inside a loop must not use variables redefined in the loop, because late-binding closures are a classic gotcha. Here's some sample code approximating the poetry code: ```python #!/usr/bin/env python3 def one() -> int: return 1 def two() -> int: return 2 def three() -> int: return 3 factories = [one, two, three] registered = [] for factory in factories: registered.append(lambda: factory()) for registered_factory in registered: print(f"result is {registered_factory()}") ``` output is ``` result is 3 result is 3 result is 3 ``` which is exactly the gotcha that flake8-bugbear's B023 was trying to warn about. I've applied one of the workarounds that various parts of the internet recommend, and you can verify for yourself if you're so inclined that doing the same in the toy script gives the expected output.David Hotham committed -
David Hotham committed
-
David Hotham committed
-
Bjorn Neergaard committed
-
Bjorn Neergaard committed
-
Bjorn Neergaard committed
-
Randy Döring committed
-
Randy Döring committed
-
refactor(provider): remove unused parameter "env" (environment must always be set via contextmanager "use_environment" to avoid inconsistent python_constraint)
Randy Döring committed -
refactor(solver): remove unnecessary parameter "provider" (was only used in tests and can cause inconsistencies between a solver and its provider)
Randy Döring committed -
Co-authored-by: Bjorn Neergaard <bjorn@neersighted.com>
DetachHead committed -
Co-authored-by: Bjorn Neergaard <bjorn@neersighted.com>
finswimmer committed -
eg with this dependency ``` pyscf = { git = "https://github.com/pyscf/pyscf", tag = "v2.0.1"} ``` the cloning of submodules fails - because that project has messed up and not committed the file saying what revision they want of the `doc` submodule. Legacy git client just silently carries on, so I've done the same here.David Hotham committed
-
- 30 Aug, 2022 1 commit
-
-
finswimmer committed
-
- 28 Aug, 2022 4 commits
-
-
David Hotham committed
-
- regular depth-first search already handles circular dependencies and hitting the same package twice - the special cases might have saved a teensy amount of work, but the simplification is preferable - pre-release handling here was not consistent with code elsewhere, and since "elsewhere" happens first, it wins - given a constraint like ">=1.0" the removed code would have allowed 1.0rc1, but elsewhere in the codebase constraints are taken to mean what they sayDavid Hotham committed -
No functional change or fixes here, just tidier code: * prefer Path.exists() * typechecking - NormalizedNames from poetry-core * clean up some unnecessary duplication * minor refactor * gather the pyproject.toml parsing into one block, save a level of indentation * remove more dead code * simplify handling of extras at command line * more abstract types
David Hotham committed -
# Pull Request Check List - [ ] Added **tests** for changed code. - [ ] Updated **documentation** for changed code. Bunch of improvements over `Configuration` documentation: - Better show default value of options - Add some missing `Introduced in <VERSION>` notes - Add backticks around types for better readability Will backport to `1.2` branch before final release.
Mathieu Kniewallner committed
-
- 27 Aug, 2022 3 commits
-
-
test(installer): use locked version of vcs dependency without reference (branch, tag, rev) instead of latest Requires: python-poetry/poetry-core#449
Randy Döring committed -
Randy Döring committed
-
Co-authored-by: Bjorn Neergaard <bjorn@neersighted.com>
finswimmer committed
-
- 26 Aug, 2022 2 commits
-
-
Randy Döring committed
-
Randy Döring committed
-
- 25 Aug, 2022 3 commits
-
-
Bartek Sokorski committed
-
finswimmer committed
-
finswimmer committed
-
- 24 Aug, 2022 3 commits
-
-
`cleo.terminal.Terminal` was replaced in https://github.com/python-poetry/cleo/pull/175 in favor of `shutil.get_terminal_size`
Branch Vincent committed -
At the moment a venv is created on running a `poetry self` command. Even if it is not used in the command itself it's unnecessary and lead to problems as reported in #6222. This PR fixes this. Resolves: #6222
finswimmer committed -
# Pull Request Check List Resolves: #3097 <!-- This is just a reminder about the most common mistakes. Please make sure that you tick all *appropriate* boxes. But please read our [contribution guide](https://python-poetry.org/docs/contributing/) at least once, it will save you unnecessary review cycles! --> - [x] Added **tests** for changed code. I adapted the test in the `tests/console/commands/plugin/test_remove.py` file to reflect the bug fix. - [ ] Updated **documentation** for changed code. <!-- If you have *any* questions to *any* of the points above, just **submit and ask**! This checklist is here to *help* you, not to deter you from contributing! --> Apart from running the ci linting steps and pytest locally for both python 3.6 and 3.8, I also tested the code by running ``` docker run --rm -i --entrypoint bash python:3.8 <<EOF set -e python -m pip install -q git+https://github.com/mmacchia/poetry.git@issue/3097 python -m poetry new foobar pushd foobar sed -i /pytest/d pyproject.toml python -m poetry add --dry-run pycowsay python -m poetry run pip list EOF ``` The corresponding output is: ``` Created package foobar in foobar /foobar / Creating virtualenv foobar-lWDpn5M1-py3.8 in /root/.cache/pypoetry/virtualenvs Using version ^0.0.0.1 for pycowsay Updating dependencies Resolving dependencies... Writing lock file Package operations: 1 install, 0 updates, 0 removals • Installing pycowsay (0.0.0.1) Package Version ---------- ------- pip 21.2.4 setuptools 58.1.0 wheel 0.37.0 ``` As expected, the command `poetry add --dry-run pycowsay` yielded a single output (` • Installing pycowsay (0.0.0.1)`) and did not add the package to the project (see the output of `poetry run pip list`). The change in the PR solves the duplication issue because the creation of the console output when `not self._enabled` is taken care of by the boolean output of the`self._should_write_operation(operation)` function. Please feel free to get in touch if I can help adding more test cases for the `--dry-run` argument or the `_enabled` flag and to add any feedback. I would be happy to improve/clarify the code in this PR. Co-authored-by: Marco Macchia <mmacchia@wayfair.com>
mmacchia committed
-
- 23 Aug, 2022 5 commits
-
-
Randy Döring committed
-
This change improves the consistency of `Pool().remove_repository()` to make it easier to write poetry plugins which mutate the repository pool. 1. Deleting an element from the middle of `Pool()._repositories` decrements the index of later entries. Update `Pool()._lookup` to reflect this. 2. If a primary repository is deleted, decrement `Pool()._secondary_start_idx` to ensure that any additional primary repositories are still added before all secondary repositories. 3. If the default repository is deleted, reset `Pool()._default` so a new one can be added. Co-authored-by: Randy Döring <30527984+radoering@users.noreply.github.com>
Jacob Emmert-Aronson committed -
Bjorn Neergaard committed
-
Mathieu Kniewallner committed
-
Co-authored-by: Bjorn Neergaard <bjorn@neersighted.com>
finswimmer committed
-
- 22 Aug, 2022 6 commits
-
-
finswimmer committed
-
finswimmer committed
-
* test(commands): add tests for `shell` * refactor(commands/shell): move venv check to dedicated function * feat(commands/shell): replace `strtobool` with simpler check Co-authored-by: Xinyuan Chen <45612704+tddschn@users.noreply.github.com> * test(commands/shell): add tests for `_is_venv_activated` * chore(cirrus): explicitly set `SHELL` env var Co-authored-by: Xinyuan Chen <45612704+tddschn@users.noreply.github.com> Co-authored-by: Bartosz Sokorski <b.sokorski@gmail.com>
Mathieu Kniewallner committed -
* add checking for env variable in pypi token getter * add unit tests for env pypi token * add checking for env variable in pypi token getter * add unit tests for env pypi token * add info to the changelog * refactor the structure * fix unit tests * undo changelog addition * change docstring format to sphinx * delete uncrsy unit test * Delete unscry funtion call Co-authored-by: Bjorn Neergaard <bjorn@neersighted.com> * Update src/poetry/utils/password_manager.py Co-authored-by: Bartosz Sokorski <b.sokorski@gmail.com> * fix unit tests * lol * fix type hints Co-authored-by: Bjorn Neergaard <bjorn@neersighted.com> Co-authored-by: Bartosz Sokorski <b.sokorski@gmail.com>
Jan Bronicki committed -
Co-authored-by: Bartosz Sokorski <b.sokorski@gmail.com>
Stijn de Gooijer committed -
feat: fallback to gather metadata via pep517 if reading as Poetry project raises RuntimeError (#5834) * feat: fallback to gather metadata via pep517 if reading as Poetry project raises RuntimeError * test: added tests for fallback to gather metadata via pep517
finswimmer committed
-