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

Consider a .[dev] optional extra in setup.cfg #570

Closed
FollowTheProcess opened this issue Feb 8, 2022 · 5 comments · Fixed by #582
Closed

Consider a .[dev] optional extra in setup.cfg #570

FollowTheProcess opened this issue Feb 8, 2022 · 5 comments · Fixed by #582

Comments

@FollowTheProcess
Copy link
Collaborator

How would this feature be useful?

When developing against nox, I like to create a virtual environment and install the project in editable mode with all the linters and formatters etc. so VSCode helps me out with mypy and things like that. Currently I do something along the lines of:

python -m venv .venv
source .venv/bin/activate.fish

python -m pip install --upgrade pip setuptools wheel
python -m pip install -e .
python -m pip install -r requirements-test.txt
python -m pip install -r requirements-conda-test.txt

Some of this probably isn't necessary? But I like to have everything in my environment 🤓

Describe the solution you'd like

If we put a [dev] optional extra in setup.cfg a user can simply do python -m pip install -e .[dev] to get everything needed in one easy command.

This would look like:

[options.extras_require]
dev =
    <Contents of requirements files>

Describe alternatives you've considered

Just continue using my list of commands.

@cjolowicz
Copy link
Collaborator

You could achieve the same with a requirements-dev.txt, no? It can reference the others and perform an editable install of Nox. There is no need to change the package metadata this way.

@FollowTheProcess
Copy link
Collaborator Author

That works too 👍🏻

@ktbarrett
Copy link
Contributor

I actually like using nox for this.

@nox.session(reuse_venv=True)
def dev(session):
    session.install("pytest", "black", "isort", "mypy")
    session.install("-e", ".")
    if session.posargs:
        session.run(*session.posargs, external=True)

Now you can use it.

nox -e dev  # builds the environment
. .nox/dev/bin/activate  # activates it

or...

nox -e dev -- bash
# you are now in your environment, only an "exit" away from cleanup

@FollowTheProcess
Copy link
Collaborator Author

@ktbarrett Check out the dev session in the cookbook it's very similar!

Coming back to this. Are we interested in a requirements-dev.txt? It's a pretty cheap thing for a small improvement in DX, but not a dealbreaker if not

@DiddiLeija
Copy link
Collaborator

I made #582 for adding a requirements-dev.txt.

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

Successfully merging a pull request may close this issue.

4 participants