[PATCH 3/7] gnu: Add python-dotenv.

  • Done
  • quality assurance status badge
Details
2 participants
  • Giacomo Leidi
  • Sarah Morgensen
Owner
unassigned
Submitted by
Giacomo Leidi
Severity
normal
Merged with
G
G
Giacomo Leidi wrote on 2 Aug 2021 20:13
(address . guix-patches@gnu.org)(name . Giacomo Leidi)(address . goodoldpaul@autistici.org)
20210802181359.10695-3-goodoldpaul@autistici.org
* gnu/packages/python-xyz.scm (python-dotenv): New variable.
---
gnu/packages/python-xyz.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

Toggle diff (37 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index cdfc78478c..f415d8b2c8 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -26239,3 +26239,30 @@ enabling you to write CommonMark inside of Docutils & Sphinx projects.")
Qhull} for the computation of the convex hull, Delaunay triangulation, and
Voronoi diagram.")
(license license:expat)))
+
+(define-public python-dotenv
+ (package
+ (name "python-dotenv")
+ (version "0.18.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "python-dotenv" version))
+ (sha256
+ (base32
+ "0b90br3f48ykx5ddfpx2zmsh4vmdqw6s812drcy9pn2q3qyarypg"))))
+ (build-system python-build-system)
+ (propagated-inputs
+ `(("python-click" ,python-click-5)))
+ (native-inputs
+ `(("python-mock" ,python-mock)
+ ("python-pytest" ,python-pytest)
+ ("python-sh" ,python-sh)))
+ (home-page
+ "https://github.com/theskumar/python-dotenv")
+ (synopsis
+ "Setup environment variables according to .env files")
+ (description
+ "This package provides the @code{python-dotenv} Python module to
+read key-value pairs from a .env file and set them as environment variables")
+ (license license:bsd-3)))
--
2.32.0
S
S
Sarah Morgensen wrote on 2 Aug 2021 23:13
control message for bug #49281
(address . control@debbugs.gnu.org)
86pmuv4kjq.fsf@mgsn.dev
merge 49281 49835 49834 49833 49832 49831 49830 49829
thanks
S
S
Sarah Morgensen wrote on 4 Aug 2021 20:35
Re: bug#49281: Add dynaconf
(name . Giacomo Leidi)(address . goodoldpaul@autistici.org)
86fsvp2h3h.fsf_-_@mgsn.dev
Hello,

While we don't actually require doing this when pypi packages don't have
tests, on a lark I went ahead and switched the source to upstream and
enabled tests to make sure they passed. It looks like two are failing,
but I'm not sure why. I've attached the patch to enable tests and the
test output.

Giacomo Leidi <goodoldpaul@autistici.org> writes:

Toggle quote (34 lines)
> * gnu/packages/python-xyz.scm (python-dotenv): New variable.
> ---
> gnu/packages/python-xyz.scm | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
> index cdfc78478c..f415d8b2c8 100644
> --- a/gnu/packages/python-xyz.scm
> +++ b/gnu/packages/python-xyz.scm
> @@ -26239,3 +26239,30 @@ enabling you to write CommonMark inside of Docutils & Sphinx projects.")
> Qhull} for the computation of the convex hull, Delaunay triangulation, and
> Voronoi diagram.")
> (license license:expat)))
> +
> +(define-public python-dotenv
> + (package
> + (name "python-dotenv")
> + (version "0.18.0")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (pypi-uri "python-dotenv" version))
> + (sha256
> + (base32
> + "0b90br3f48ykx5ddfpx2zmsh4vmdqw6s812drcy9pn2q3qyarypg"))))
> + (build-system python-build-system)
> + (propagated-inputs
> + `(("python-click" ,python-click-5)))
> + (native-inputs
> + `(("python-mock" ,python-mock)
> + ("python-pytest" ,python-pytest)
> + ("python-sh" ,python-sh)))
> + (home-page
> + "https://github.com/theskumar/python-dotenv")
^ Nitpick: this can go on one line.
Toggle quote (2 lines)
> + (synopsis
> + "Setup environment variables according to .env files")
^ Likewise.
Toggle quote (4 lines)
> + (description
> + "This package provides the @code{python-dotenv} Python module to
> +read key-value pairs from a .env file and set them as environment variables")
> + (license license:bsd-3)))
Toggle diff (40 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index f4f3b7fb3f..a5b700f2d3 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -26282,16 +26282,31 @@ Voronoi diagram.")
(version "0.18.0")
(source
(origin
- (method url-fetch)
- (uri (pypi-uri "python-dotenv" version))
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://github.com/theskumar/python-dotenv")
+ (commit (string-append "v" version))))
(sha256
(base32
- "0b90br3f48ykx5ddfpx2zmsh4vmdqw6s812drcy9pn2q3qyarypg"))))
+ "1jdccd9s7ypsldafiv0mqgh616662fm5a5ppbhphnin44qv7mir1"))))
(build-system python-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (replace 'check
+ (lambda* (#:key tests? inputs outputs #:allow-other-keys)
+ (when tests?
+ (setenv "PATH"
+ (string-append (assoc-ref outputs "out") "/bin:"
+ (getenv "PATH")))
+ (add-installed-pythonpath inputs outputs)
+ (invoke "py.test" "tests/")))))))
(propagated-inputs
`(("python-click" ,python-click-5)))
(native-inputs
- `(("python-mock" ,python-mock)
+ `(("python-ipython" ,python-ipython)
+ ("python-mock" ,python-mock)
("python-pytest" ,python-pytest)
("python-sh" ,python-sh)))
(home-page
starting phase `check'
============================= test session starts ==============================
platform linux -- Python 3.8.2, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
rootdir: /tmp/guix-build-python-dotenv-0.18.0.drv-0/source, inifile: setup.cfg
plugins: hypothesis-5.4.1
collected 132 items

tests/test_cli.py ..F............F.......... [ 19%]
tests/test_ipython.py ... [ 21%]
tests/test_main.py ..................................................... [ 62%]
[ 62%]
tests/test_parser.py ........................................... [ 94%]
tests/test_utils.py . [ 95%]
tests/test_variables.py ...... [100%]

=================================== FAILURES ===================================
______________________________ test_list_no_file _______________________________

cli = <click.testing.CliRunner object at 0x7ffff5ed8100>

def test_list_no_file(cli):
result = cli.invoke(dotenv.cli.list, [])
Toggle quote (1 lines)
> assert (result.exit_code, result.output) == (1, "")
E AssertionError: assert (-1, '') == (1, '')
E At index 0 diff: -1 != 1
E Use -v to get the full diff

tests/test_cli.py:31: AssertionError
__________________________ test_set_non_existent_file __________________________

cli = <click.testing.CliRunner object at 0x7ffff5f53cd0>

def test_set_non_existent_file(cli):
result = cli.invoke(dotenv.cli.set, ["a", "b"])
Toggle quote (1 lines)
> assert (result.exit_code, result.output) == (1, "")
E AssertionError: assert (-1, '') == (1, '')
E At index 0 diff: -1 != 1
E Use -v to get the full diff

tests/test_cli.py:113: AssertionError
=============================== warnings summary ===============================
tests/test_ipython.py::test_ipython_existing_variable_no_override
tests/test_ipython.py::test_ipython_existing_variable_override
tests/test_ipython.py::test_ipython_new_variable
/gnu/store/m6wza0kv26bnpfaavw8xs1gw2cls6369-python-ipython-7.9.0/lib/python3.8/site-packages/IPython/paths.py:67: UserWarning: IPython parent '/' is not a writable location, using a temp directory.
warn("IPython parent '{0}' is not a writable location,"

================== 2 failed, 130 passed, 3 warnings in 4.49s ===================
--
Sarah
?