Skip to content

Commit

Permalink
Merge 0.4.11 into default
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael McNeil Forbes committed Mar 15, 2023
2 parents 72d53c7 + df1e3e2 commit e2f28ce
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 44 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Changes
=======
## 0.4.11
- Fix bug with warning on CoCalc.

## 0.4.10
- Add warning on CoCalc if users have not set `LC_HG_USERNAME`, or `LC_GIT_USERNAME`.

Expand Down
40 changes: 25 additions & 15 deletions Notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Developer Notes
Summary:

* <https://alum.mit.edu/www/mforbes/hg/forbes-group/mmf-setup>: Main development
repository (Mercurial) running on our hosted [Heptapod] server. This is where
repository (Mercurial) running on our hosted [Heptapod][] server. This is where
[Issues](https://alum.mit.edu/www/mforbes/hg/forbes-group/mmf-setup/issues), [Merge
Requests](https://alum.mit.edu/www/mforbes/hg/forbes-group/mmf-setup/merge_requests)
etc. should be reported.
Expand Down Expand Up @@ -91,7 +91,7 @@ this is an issue, then the old behavior should be used.
## Releases

To prepare for release, make sure you are running in a development environment with the
Mercurial evolve and topics extensions enabled, and with [Black] and [Nox].
Mercurial evolve and topics extensions enabled, and with [Black][] and [Nox][].

### Release Procedure

Expand Down Expand Up @@ -235,18 +235,24 @@ CoCalc
Prior to 0.4.7, we used to install mercurial, etc. in the users `~/.local` folder. This
broke when the Ubuntu environment was upgraded (related to
https://github.com/sympy/sympy/issues/23897). CoCalc has fixed this, but it prompted us
to use [pipx] instead. This requires a little finesse while we use a bash entry-point
to use [pipx][] instead. This requires a little finesse while we use a bash entry-point
`bin/mmf_setup`, but should work nicely once we switch to python entry-points in version
0.5.
0.5. *(Details: As far as I see it, before we provide python entry-points, we must
[rely on setuptools][] to provision the scripts. When we move to `pyproject.toml`, this
will be done in the `[tools.setuptools]` section with `script-files`.)*

[rely on setuptools]:
<https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#setuptools-specific-configuration>


Testing
=======

We have two types of tests here:

1. Standard python tests run with [pytest]. These are organized in the `tests/` folder
1. Standard python tests run with [pytest][]. These are organized in the `tests/` folder
and can simply be run with `pytest`.
2. Tests of shell and mercurial functionality run with their [`run-tests.py`] script.
2. Tests of shell and mercurial functionality run with their [`run-tests.py`][] script.
These need a bit of care when being run because they execute commands. They should
be run using the `Makefile` which specifies some environmental flags. Some things to
be careful of when modifying these:
Expand All @@ -267,8 +273,8 @@ We have two types of tests here:
We don't do this in the tests because this could be very confusing for a user, but
occasionally check that this does not break the tests.

The tests should be run with [Nox], which will test in an isolated environment against
various versions of python. Simply make sure that [Nox] is installed in your work
The tests should be run with [Nox][], which will test in an isolated environment against
various versions of python. Simply make sure that [Nox][] is installed in your work
environment, then simply run `nox`. This does one of the following (see
`nox.options.sessions` in [`noxfile.py`](noxfile.py)):

Expand All @@ -284,7 +290,7 @@ environment, then simply run `nox`. This does one of the following (see
that the cocalc script tries to install things with `--user` which is disallowed in
virtualenvs.

* If you don't, but have [Conda] installed, then you can have [Nox] install the required
* If you don't, but have [Conda][] installed, then you can have [Nox][] install the required
interpreters with conda by running:

```bash
Expand All @@ -306,8 +312,8 @@ revision numbers etc. for release 0.1.11.)
1. Make sure your code works and that the tests pass. Pull any open
issues into the main release branch, closing those issue branches.

To run the tests, make sure you have [make], [Nox]
and [Conda] installed in some
To run the tests, make sure you have [make][], [Nox][]
and [Conda][] installed in some
environment, then run:

nox
Expand Down Expand Up @@ -429,14 +435,18 @@ The information about building the package for conda is specified in the

<!-- Links -->
[Nox]: <https://nox.thea.codes> "Nox: Flexible test automation"
[Hypermodern Python]: <https://cjolowicz.github.io/posts/hypermodern-python-01-setup/> "Hypermodern Python"
[Hypermodern Python]: <https://cjolowicz.github.io/posts/hypermodern-python-01-setup/>
"Hypermodern Python"
[`pyenv`]: <https://github.com/pyenv/pyenv> "Simple Python Version Management: pyenv"
[`minconda`]: <https://docs.conda.io/en/latest/miniconda.html> "Miniconda"
[Conda]: <https://docs.conda.io> "Conda"
[Heptapod]: <https://heptapod.net> "Heptapod website"
[pytest]: <https://docs.pytest.org> "pytest"
[Poetry]: <https://python-poetry.org> "Poetry": Python packaging and dependency management made easy."
[`run-tests.py`]: <https://www.mercurial-scm.org/wiki/WritingTests> "Mercurial test suite.
[Poetry]: <https://python-poetry.org>
"Poetry: Python packaging and dependency management made easy."
[`run-tests.py`]: <https://www.mercurial-scm.org/wiki/WritingTests>
"Mercurial test suite."
[make]: <https://www.gnu.org/software/make/> "GNU Make"
[pipx]: <https://pypa.github.io/pipx/>
[`init_cell`]: <https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/init_cell>
[`init_cell`]:
<https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/init_cell>
56 changes: 30 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ mmf-setup
[![Binder:notebook](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/forbes-group/mmf-setup/branch/default)

This meta-project provides an easy way to install all of the python tools I typically
use. It also serves as a fairly minimal example of setting up a package tate [`pip`] can
use. It also serves as a fairly minimal example of setting up a package that [pip][] can
install, and specifying dependencies.

In particular, I structure it for the following use-cases:

1. Rapid installation and configuration of the tools I need. For example, I often use
[CoCalc][]. Whenever I create a new project, I need to perform some
initialization. With this project, it is simply a matter of using [`pipx`] to install
initialization. With this project, it is simply a matter of using [pipx][] to install
this package, and then using some of the tools. Specifically:

```bash
Expand Down Expand Up @@ -76,7 +76,7 @@ Quickstart (TL;DR)
```

Note: these includes the `nbextensions` extra. You and run without the `--user` flag
if you want to install them system-wide rather than into [`site.USER_BASE`].
if you want to install them system-wide rather than into [`site.USER_BASE`][].

3. To get the notebook tools for Jupyter (IPython) notebooks, execute the following as
a code cell in your notebook and then trust the notebook with `File/Trust Notebook`:
Expand All @@ -90,7 +90,7 @@ Quickstart (TL;DR)
[NBViewer](http://nbviewer.ipython.org). One can specify different
themes. (Presently only `theme='default'` and `theme='mmf'` are supported.)

4. **Mercurial:** If you want to install mercurial with the [hg-git] and [Evolve]
4. **Mercurial:** If you want to install mercurial with the [hg-git][] and [Evolve][]
extensions, then you can do that with the `hg` extra:

```bash
Expand Down Expand Up @@ -192,8 +192,8 @@ o 198:d michael (20 hours ago) 0.4.0[0.4.0]
...
```

The second version with `-H` adds some useful extensions: [hg-git], [Evolve], and
enables [Topics]. The latter are required, for example, to interface with
The second version with `-H` adds some useful extensions: [hg-git][], [Evolve][], and
enables [Topics][]. The latter are required, for example, to interface with
[Heptapod](https://octobus.net/blog/2019-09-04-heptapod-workflow.html).

Finally, the `-H` option enables an `hg update` hook, which adds `%include ../.hgrc` to
Expand Down Expand Up @@ -251,16 +251,7 @@ share the same project. See [cocalc#370][] for details.)
I recommend the following:
1. Set the following variables on your personal computer:
```bash
# ~/.bashrc or similar
LC_HG_USERNAME=Your Full Name <your.email.address+hg@gmail.com>
LC_GIT_USEREMAIL=your.email.address+git@gmail.com
LC_GIT_USERNAME=Your Full Name
```
2. Forward these by adding the following to your SSH config file (`~/.ssh/config`):
1. Forward these variables in your SSH config file (`~/.ssh/config`):
```
# ~/.ssh/config
Expand All @@ -270,22 +261,30 @@ I recommend the following:
Host cc*
HostName ssh.cocalc.com
ForwardAgent yes
SendEnv LC_HG_USERNAME
SendEnv LC_GIT_USERNAME
SendEnv LC_GIT_USEREMAIL
SetEnv LC_HG_USERNAME=Your Full Name <your.email.address+hg@gmail.com>
SetEnv LC_GIT_USERNAME=Your Full Name
SetEnv LC_GIT_USEREMAIL=your.email.address+git@gmail.com
SetEnv LC_EDITOR=vi
```
The appropriate value for `User` can be found in the project Settings on [CoCalc][]
The appropriate value for `User` can be found in the project Settings on [CoCalc][].
Optionally, use `SendEnv ...` and set these on your personal computer:
3. If you want to run [Git][] or [Mercurial][] from the [CoCalc][] web interface, then
```bash
# ~/.bashrc or similar
LC_HG_USERNAME=Your Full Name <your.email.address+hg@gmail.com>
LC_GIT_USEREMAIL=your.email.address+git@gmail.com
LC_GIT_USERNAME=Your Full Name
```
2. If you want to run [Git][] or [Mercurial][] from the [CoCalc][] web interface, then
create a named terminal -- i.e. `Michael.term` -- and then set these variables in the
terminal startup script. (See https://doc.cocalc.com/terminal.html#startup-files for
details.)
[CoCalc]: <cocalc.com>
# Notes
See [Notes.md](Notes.md) for developer notes. Other notes about python, IPython,
Expand Down Expand Up @@ -326,16 +325,21 @@ etc. are stored in the [docs](docs) folder.
<!-- Links -->
[Nox]: <https://nox.thea.codes> "Nox: Flexible test automation"
[Hypermodern Python]: <https://cjolowicz.github.io/posts/hypermodern-python-01-setup/> "Hypermodern Python"
[Hypermodern Python]: <https://cjolowicz.github.io/posts/hypermodern-python-01-setup/>
"Hypermodern Python"
[`pyenv`]: <https://github.com/pyenv/pyenv> "Simple Python Version Management: pyenv"
[`minconda`]: <https://docs.conda.io/en/latest/miniconda.html> "Miniconda"
[Conda]: <https://docs.conda.io> "Conda"
[Heptapod]: <https://heptapod.net> "Heptapod website"
[pytest]: <https://docs.pytest.org> "pytest"
[`pip`]: <https://pip.pypa.io> "pip: the package installer for Python"
[pip]: <https://pip.pypa.io> "pip: the package installer for Python"
[pipx]: <https://pypa.github.io/pipx/>
"pipx: Install and Run Python Applications in Isolated Environments"
[`site.USER_BASE`]: <https://docs.python.org/3/library/site.html#site.USER_BASE>
[Evolve]: <https://www.mercurial-scm.org/doc/evolution/> "Mercurial Evolve extension"
[Topics]: <https://www.mercurial-scm.org/doc/evolution/tutorials/topic-tutorial.html> "Mercurial Topics tutorial"
[Evolve]: <https://www.mercurial-scm.org/doc/evolution/>
"Mercurial Evolve extension"
[Topics]: <https://www.mercurial-scm.org/doc/evolution/tutorials/topic-tutorial.html>
"Mercurial Topics tutorial"
[hg-git]: <https://hg-git.github.io>
[mercurial]: https://www.mercurial-scm.org/
[git]: https://git-scm.com/
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def read(*names, **kwargs):

setup(
name=NAME,
version="0.4.10",
version="0.4.11",
packages=find_packages("src"),
package_dir={"": "src"},
py_modules=[splitext(basename(_path))[0] for _path in glob("src/*.py")],
Expand Down
4 changes: 2 additions & 2 deletions src/mmf_setup/_data/config_files/cocalc/bash_aliases
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function _vcs_message {

# Mercurial config
if [ -z "${LC_HG_USERNAME}" ]; then
_hg = "$(type -p hg)"
_hg="${_hg:=$(type -p hg)}"
echo "You have not set LC_HG_USERNAME!"
echo "DO NOT USE HG to commit until you set LC_HG_USERNAME"
echo
Expand All @@ -61,7 +61,7 @@ git config --global alias.lg2 $'log --graph --abbrev-commit --decorate --format=
git config --global alias.lg $'!git lg1'

if [ -z "${LC_GIT_USERNAME}" ]; then
_git = "$(type -p hg)"
_git="${_git:=$(type -p git)}"
echo "You have not set LC_GIT_USERNAME!"
echo "DO NOT USE GIT to commit until you set both LC_GIT_USERNAME and LC_GIT_USEREMAIL"
echo
Expand Down

0 comments on commit e2f28ce

Please sign in to comment.