Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move doc-requirements to docs/requirements.txt #76

Closed
wants to merge 2 commits into from

Conversation

syphar
Copy link

@syphar syphar commented Jan 9, 2023

This moves the sphinx requirements into docs/requirements.txt for our doc-build process & readthedocs to use.

This definitely helps with #75 only in that matter that it doesn't break production builds any more.

it doesn't fix the originating issue, only moves it to the doc-build.

I provided specific versions for in docs/requirements.txt, as recommended by readthedocs. I'm hoping that freezing sphinxcontrib.applehelp here helps with fixing this for the doc-build, we'll see when CI passed & how readthedocs handles this.

@codecov
Copy link

codecov bot commented Jan 9, 2023

Codecov Report

Merging #76 (27e3bf1) into main (2fb3b95) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main       #76   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          456       456           
=========================================
  Hits           456       456           
Impacted Files Coverage Δ
measurement/measures/geometry.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link

@awaisdar001 awaisdar001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much.

Copy link
Collaborator

@codingjoe codingjoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there! Looks good, however, I'd prefer to move the requirements to an docs extra. In the setup.cfg so it can be installed via pip install -e .[docs]. Cheers! Joe

@syphar
Copy link
Author

syphar commented Jan 9, 2023

@codingjoe I don't know much about readthedocs, only that it would pick up docs/requirements.txt automatically.

How would we tell readthedocs to pick up the extra?

Comment on lines +40 to 43
pytest_runner
tests_require =
pytest
pytest-cov
Copy link

@amotl amotl Jan 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. Thank you for submitting this patch. I think pytest_runner should be moved into the tests_require section as well. It will not be needed at runtime.

Suggested change
pytest_runner
tests_require =
pytest
pytest-cov
tests_require =
pytest
pytest-cov
pytest_runner

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @amotl , thank you for the review!

Moving pytest_runner to tests_require breaks the current test execution (via python setup.py test).

While this should be fixed, I first only wanted to fix the issue at hand.

Copy link

@striveforbest striveforbest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additionally, now im getting this:

pipenv install --keep-outdated --selective-upgrade "pip install git+https://github.com/syphar/python-measurement@no-sphinx-in-prod"
^CTraceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/bin/pipenv", line 5, in <module>
    from pipenv import cli
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/__init__.py", line 63, in <module>
    from .cli import cli
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/cli/__init__.py", line 1, in <module>
    from .command import cli  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/cli/command.py", line 7, in <module>
    from pipenv.cli.options import (
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/cli/options.py", line 3, in <module>
    from pipenv.project import Project
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/project.py", line 19, in <module>
    from pipenv.environment import Environment
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/environment.py", line 17, in <module>
    from pipenv.patched.pip._internal.commands.install import InstallCommand
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/patched/pip/_internal/commands/__init__.py", line 9, in <module>
    from pipenv.patched.pip._internal.cli.base_command import Command
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/patched/pip/_internal/cli/base_command.py", line 15, in <module>
    from pipenv.patched.pip._internal.cli import cmdoptions
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/patched/pip/_internal/cli/cmdoptions.py", line 24, in <module>
    from pipenv.patched.pip._internal.cli.parser import ConfigOptionParser
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/patched/pip/_internal/cli/parser.py", line 12, in <module>
    from pipenv.patched.pip._internal.configuration import Configuration, ConfigurationError
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/patched/pip/_internal/configuration.py", line 26, in <module>
    from pipenv.patched.pip._internal.utils.logging import getLogger
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/patched/pip/_internal/utils/logging.py", line 29, in <module>
    from pipenv.patched.pip._internal.utils.misc import ensure_dir
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/patched/pip/_internal/utils/misc.py", line 38, in <module>
    from pipenv.patched.pip._vendor.tenacity import retry, stop_after_delay, wait_fixed
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/patched/pip/_vendor/tenacity/__init__.py", line 516, in <module>
    from pipenv.patched.pip._vendor.tenacity._asyncio import AsyncRetrying  # noqa:E402,I100
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/patched/pip/_vendor/tenacity/_asyncio.py", line 33, in <module>
    class AsyncRetrying(BaseRetrying):
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/patched/pip/_vendor/tenacity/_asyncio.py", line 67, in AsyncRetrying
    async def __anext__(self) -> typing.Union[AttemptManager, typing.Any]:
                                 ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/typing.py", line 341, in inner
    return cached(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/typing.py", line 460, in __getitem__
    return self._getitem(self, parameters)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/typing.py", line 673, in Union
    return _UnionGenericAlias(self, parameters)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/typing.py", line 1337, in __init__
    self.__parameters__ = _collect_parameters(args)
    ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/typing.py", line 1275, in __setattr__
    if _is_dunder(attr) or attr in {'_name', '_inst', '_nparams',
       ^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/typing.py", line 1224, in _is_dunder
    return attr.startswith('__') and attr.endswith('__')
           ^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt

 ””/noya   ticket/python3.8-upgarde-5424 ⍟5  pipenv install --keep-outdated --selective-upgrade "git+https://github.com/syphar/python-measurement@no-sphinx-in-prod"
Loading .env environment variables...
Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/bin/pipenv", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/cli/options.py", line 57, in main
    return super().main(*args, **kwargs, windows_expand_args=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/cli/command.py", line 239, in install
    do_install(
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/core.py", line 2256, in do_install
    package = Requirement.from_line(package)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 2685, in from_line
    r = vcs_req_from_parsed_line(parsed_line)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 3100, in vcs_req_from_parsed_line
    name=parsed_line.name,
         ^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 603, in name
    if self.setup_info:
       ^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 806, in setup_info
    self.setup_info = self.get_setup_info()
                      ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 795, in get_setup_info
    setup_info = SetupInfo.from_ireq(self.ireq, subdir=self.subdirectory)
                                     ^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 772, in ireq
    self.parse_ireq()
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 936, in parse_ireq
    if self.requirement is not None and self._ireq.req is None:
       ^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 474, in requirement
    self.parse_requirement()
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 1110, in parse_requirement
    raise ValueError(
ValueError: pipenv requires an #egg fragment for version controlled dependencies. Please install remote dependency in the form git+https://github.com/syphar/python-measurement#egg=<package-name>.
 ””/noya   ticket/python3.8-upgarde-5424 ⍟5  pipenv install --keep-outdated --selective-upgrade "git+https://github.com/syphar/python-measurement@no-sphinx-in-prod#egg=measurement"
Loading .env environment variables...
Installing git+https://github.com/syphar/python-measurement@no-sphinx-in-prod#egg=measurement...
Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/bin/pipenv", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/cli/options.py", line 57, in main
    return super().main(*args, **kwargs, windows_expand_args=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/cli/command.py", line 239, in install
    do_install(
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/core.py", line 2436, in do_install
    project.add_package_to_pipfile(pkg_requirement, dev)
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/project.py", line 952, in add_package_to_pipfile
    self.write_toml(p)
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/project.py", line 779, in write_toml
    data = convert_toml_outline_tables(data, self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/utils/toml.py", line 64, in convert_toml_outline_tables
    result = convert_tomlkit_table(table_data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/utils/toml.py", line 44, in convert_tomlkit_table
    result[key.key] = table
    ~~~~~~^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/tomlkit/items.py", line 1244, in __setitem__
    self._value[key] = value
    ~~~~~~~~~~~^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/tomlkit/container.py", line 623, in __setitem__
    self._replace(old_key, key, value)
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/tomlkit/container.py", line 644, in _replace
    self._replace_at(idx, new_key, value)
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/tomlkit/container.py", line 677, in _replace_at
    self._insert_at(i, new_key, value)
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/tomlkit/container.py", line 411, in _insert_at
    or "\n" in previous_item.trivia.trail
               ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/pipenv/2022.12.19/libexec/lib/python3.11/site-packages/pipenv/vendor/tomlkit/items.py", line 389, in trivia
    return self._trivia
           ^^^^^^^^^^^^
AttributeError: 'Null' object has no attribute '_trivia'. Did you mean: 'trivia'?

@@ -103,7 +103,7 @@ def __new__(mcs, name, bases, attrs):
@staticmethod
def square(klass):
for name, unit in klass._units.items():
qs_unit = Unit(factor=unit.factor ** 2)
qs_unit = Unit(factor=unit.factor**2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is irrelevant to the issue.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but CI fails. It's in a separate commit because of that

@@ -170,7 +170,7 @@ def __new__(mcs, name, bases, attrs):
@staticmethod
def cubic(klass):
for name, unit in klass._units.items():
qs_unit = Unit(factor=unit.factor ** 3)
qs_unit = Unit(factor=unit.factor**3)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

@codingjoe
Copy link
Collaborator

Thanks, @syphar and everyone who reviewed. I took the liberty to update the whole packaging and CI process. Since I need to maintain multiple packages, it's best if the pipeline is fairly consistent.

Closed in favor of #77

@codingjoe codingjoe closed this Jan 10, 2023
@syphar syphar deleted the no-sphinx-in-prod branch January 10, 2023 08:55
@syphar syphar restored the no-sphinx-in-prod branch January 10, 2023 08:55
@syphar syphar deleted the no-sphinx-in-prod branch January 10, 2023 08:55
@syphar syphar restored the no-sphinx-in-prod branch January 10, 2023 08:55
@dequis
Copy link

dequis commented Jan 10, 2023

This applies to 4.0 right? Which is a full rewrite. If we're on 3.2.0 we need something else right?

@syphar
Copy link
Author

syphar commented Jan 10, 2023

@codingjoe I'm happy to provide a backport PR to a 3.2 branch, if that's what needed.

( assuming the backport could just contain the simple fix I did previously)

@awaisdar001
Copy link

@codingjoe I'm happy to provide a backport PR to a 3.2 branch, if that's what needed.

( assuming the backport could just contain the simple fix I did previously)

Would appreciate that @syphar

@syphar
Copy link
Author

syphar commented Jan 10, 2023

perhaps I'm missing something, but I think I only can create said PR from my fork when there is an existing 3.2.0 branch, right?

@amotl
Copy link

amotl commented Jan 10, 2023

Right. One of the project maintainers would need to create that branch from the most recent 3.x tag first.

@striveforbest
Copy link

Right. One of the project maintainers would need to create that branch from the most recent 3.x tag first.

@amotl @syphar is there any luck with porting it over to 3.2.0? I'm using django-measurement which requires python-measurement<4.0 so def need a port-over.

@syphar
Copy link
Author

syphar commented Jan 12, 2023

@codingjoe already backported the fix, it's in 3.2.2, which works for us

@striveforbest
Copy link

@codingjoe already backported the fix, it's in 3.2.2, which works for us

@syphar
on github only or does pypi version works for you too?

@syphar
Copy link
Author

syphar commented Jan 12, 2023

On pypi,

We're also a user of django-measurements and it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants